LESSON 32.02 · 5 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW
Shape specialization, JIT and AOT
Watch a compile cache meet new input shapes, during serving or before it.
Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 32.02 · COMPILE BAYCALL 1 · COMPILED 85 µs · EAGER 294 µs
01
Stage 1 of 5 · Shape baked in
Shape specialization builds 3 kernels for one shape key. Call 1 runs in 85 µs, against 294 µs in eager mode.
Explain it simply
Eager mode runs 13 small kernels on every call. A compiler traces the ops once and writes 3 fused kernels. With the shape known, it can pick loop sizes and record one CUDA graph, one launch for all 3. The compile takes 1.9 seconds and saves 209 microseconds on a 16-row call, so it pays off after 9091 calls.
Call 1 has 16 rows. Its compiled bar shows 85 microseconds; the dashed eager bar shows 294.
rows per callshape key, cachecompile wait, padding, extra launchesrun timeeager mode
Toy: one MLP block, 10 calls of 16 to 1024 rows, toy GPU
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Each kernel takes the slower of its math and its memory traffic.
PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
- 4 more stages and 2 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.