LESSON 27.19 · 5 STAGES · 2 CONTROLS · 2 CHECKSPRO · PREVIEW
Fused elementwise kernels: SiLU, SwiGLU and RoPE
Watch RoPE and SwiGLU run as many small kernels, then as two fused kernels.
Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 2 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 27.19 · FUSION BAYFUSED · 0 KERNELS · HBM 0 B
01
Stage 1 of 5 · Inputs in HBM
The GEMMs left q, k, g and u in HBM as FP16. An elementwise kernel does only a few FLOPs per value.
Explain it simply
At the bottom is HBM, the big main memory of the GPU. The token's query q and key k hold 8 values each. The gate g and the up value u hold 16 each. Each value needs only a few math steps, so moving it costs more time than its math.
HBM holds q and k, 8 values each, the cos and sin tables, and g and u, 16 values each. The register blocks above are empty.
inputs, values in registerscos and sin, anglesresultstemporaries, extra HBM tripsempty or not stored
Toy: the 27.C3 decode token; q and k have 8 values, g and u have 16
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Intensity is the math done for each byte moved.
PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
- 4 more stages and 2 live controls
- 2 mix-up cards and 2 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.