GPU, kernels & serving · the compiler track
AI Compilers — From Graph to Kernel
A linearized rebuild of the modern machine-learning compiler: how a high-level tensor program — the y = gelu(x @ w + b) you wrote — becomes a handful of fused, hardware-specialized GPU kernels, derived as one chain of decisions where each pass is forced by an inefficiency the last one left behind.
This is the systems sibling of the GPU Kernels and Triton tracks. Those teach you to hand-write a fast kernel; this teaches you how a compiler generates them automatically — what torch.compile, XLA, TVM, and TensorRT actually do between your Python and the SASS the GPU runs. It is a hub: where kernels, serving, or training go deeper, it links out instead of repeating.
torch.compile/XLA as magic. No compiler-course background assumed — SSA, IR, passes, scheduling, and codegen are all built up from first principles. By the end you should be able to look at any pass in any ML stack and say which inefficiency forced it, and sketch the pipeline yourself.
The spine — one forced chain
Read the diagram left to right. The top row is the compiler's five stages; below, each lesson is a wall, and the arrow to the next is the idea it's forced to introduce. Nothing is here "because compilers have it" — each link exists because, without it, the chain breaks.
The lessons
gelu(x @ w + b) is, eagerly, 3+ kernels and 3+ HBM round trips — the hardware wanted one fused kernel. The five stages of any ML compiler, and the wall→fix→new-wall spine of the whole track. Interactive: a gap meter — stretch an op chain and watch eager waste grow while the fused cost stays flat.softmax through four IR levels.compute_at, stage to SRAM — plus the polyhedral model in a paragraph. Interactive: a schedule explorer where no-tiling sinks and tiles-too-big spill.@autotune, AutoTVM) or prune with a learned cost model (Ansor). The core trade: compile-time search vs run-time speedup, amortized over a million runs. Interactive: an autotune search where a cost model finds the optimum with far fewer measurements.cond/scan) instead of graph breaks. Interactive: a specialization cache — compile storm vs bucketing vs one symbolic compile.y = gelu(x @ w + b) with a dynamic batch and its backward from Python through every stage — capture, IR, rewrite, autodiff, decompose, fuse, quantize, plan, lay out, schedule, codegen, autotune, runtime/CUDA-graph, guard, shard — watching the scoreboard collapse (~5 kernels → 1–2, ~10× bytes → ~2×). Then the frontiers: megakernels, ML-for-compilers, the long tail. Interactive: an end-to-end scoreboard you build pass by pass.How to use this
- Read it in order. Every lesson opens on the exact wall the previous one hit and derives the next idea as the forced fix. Skipping breaks the chain.
- Touch every knob. Each lesson has one widget that turns its core trade into a slider with a configuration that breaks. Drive it until you've seen the failure, not just the happy path.
- Open the code. The IR dumps, FX graphs, and generated Triton are real — read them, don't skim them.
- Follow the cross-links. This track is a hub. Where another series goes deeper — kernels, serving, the training stack — it links out instead of repeating.