Skip to content

[DO NOT MERGE] Kernel Interview Track: curriculum + 6 'why is this slow' challenges (134-139) - #349

Draft
kunal-mansukhani wants to merge 3 commits into
mainfrom
kernel-interview-track
Draft

kunal-mansukhani wants to merge 3 commits into
mainfrom
kernel-interview-track

Conversation

@kunal-mansukhani

Copy link
Copy Markdown
Contributor

⚠️ DO NOT MERGE. This is a new paid product (Kernel Interview Track), so it needs Kunal's review first. Merging to main would auto-deploy challenges 134–139 into the public list through deploy-challenges.yml, because the challenge format has no hidden/unlisted flag yet (see "Needed from infra").

Track: tracks/kernel-interview.json (+ tracks/README.md schema)

enabled: false, status: "draft", entitlement: "interview_pass", and pricing is a placeholder only (nothing in Stripe).

# Module Existing challenges (id/slug) Slow-kernel round
1 Memory coalescing 1 vector-addition, 31 matrix-copy, 3 matrix-transpose, 63 interleave-arrays 134
2 Shared memory & tiling 9 1d-convolution, 10 2d-convolution, 28 gaussian-blur, 69 2d-jacobi-stencil 135
3 Reductions & warp primitives 4 reduction, 17 dot-product, 5 softmax, 16 prefix-sum, 13 histogramming, 125 scatter-add 136, 139
4 Occupancy & latency hiding 50 rms-normalization, 113 layer-normalization, 83 fused-residual-add-and-rms-norm, 40 batch-normalization 137
5 Matrix multiplication 2 matrix-multiplication, 22 general-matrix-multiplication-gemm, 30 batched-matrix-multiplication, 57 fp16-batched-matrix-multiplication, 99 grouped-gemm 138
6 Attention & inference 6 softmax-attention, 53 causal-self-attention, 80 grouped-query-attention, 86 paged-kv-cache-attention, 128 split-kv-attention-reduction, 115 fused-qkv-projection-with-rope-and-kv-cache-update n/a

Each module has an objective and a one-line interview tip.

6 new "why is this slow" challenges (medium, access_tier="premium" as a placeholder)

The starter starter.cu is a deliberately slow but correct kernel. This is an intentional exception to the "starter must not solve" rule. The other 5 language starters are empty, per convention.

id Challenge Bottleneck Target speedup Perf test
134 Speed Up Column Scale uncoalesced_loads 4.0× 8192×8192
135 Speed Up Tiled Transpose bank_conflicts 1.5× 8192×8192
136 Speed Up Row Sum warp_divergence 3.0× 16384×4096
137 Speed Up Segment Reverse low_occupancy 4.0× N=67.1M, S=8192
138 Speed Up Matrix Multiply missing_tiling 2.5× 4096³
139 Speed Up Histogram atomic_contention 4.0× N=50M, 32 bins

New proposed Challenge attributes (ignored by the current validator and deploy script): track, problem_type="slow_kernel", bottleneck, target_speedup, baseline_language="cuda", hints (3 progressive).

Verification

  • black / isort / flake8 / clang-format are clean, and validate_challenges.py reports 0 errors.
  • For every example and functional case, CPU checks show reference_impl matches a float64 ground truth within atol/rtol, AND a numpy emulation of each slow starter's thread mapping (and of the reduction tree) matches float64. So the baselines are correct.
  • Not run on a GPU. No GPU or API key on the box, so the speedup targets are uncalibrated estimates for T4.

Needed from infra / frontend

  1. The backend must enforce the speedup: time the user's solution and the baseline starter.cu on the same GPU for the perf test (median of N runs, or a cached baseline per GPU). Pass = correct AND baseline_ms/user_ms ≥ target_speedup. The format can't express this today.
  2. Extend the update_challenges.py payload with track, problemType, bottleneck, targetSpeedup, baselineLanguage, hints, and a listed/hidden flag that the public list respects. This must land before merging this PR.
  3. Track API per frontend-expectations.md: GET /api/v1/tracks/kernel-interview → {enabled, track:{…this JSON + solved/best_speedup}, progress, entitlement}. The profile endpoint's bottleneck.code uses the same enum and targetSpeedup.
  4. Calibrate the targets on T4 before launch.

Full contract: /workspace/interview-track/curriculum-contract.md (mirrored in tracks/README.md).

kunal-mansukhani added a commit that referenced this pull request Oct 15, 2026
…ecoding Attention (141) (#350)

Free, hard LLM-inference kernels. FP8 block-scaled GEMM is the DeepSeek-V3 /
DeepGEMM E4M3 x E4M3 matmul with 1x128 float32 scales. Flash decoding attention
is long-context single-token (T << S) multi-head decode. References accumulate
in float64. Leaves Interview Track #349 (134-139) untouched.
@kunal-mansukhani

Copy link
Copy Markdown
Contributor Author

Updated Interview Track target speedups to Infra's measured T4 values (median of 9 runs, Modal CI env; see infra #448): 134 4.7x, 135 2.0x, 136 3.8x, 137 5.6x, 138 1.3x, 139 6.0x. Targets are about 0.8x each demo's measured speedup; 139 capped at 6x (measured 18.27x) for interview fairness. Still a draft; not merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant