LESSON 27.C1 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
Removing overhead from a decode step
Watch three fixes shorten a decode loop on one time axis.
Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 27.C1 · OVERHEAD BAY89.0 µs PER TOKEN · GPU BUSY 39%
01
Stage 1 of 5 · Eager loop
Each token needs 13 CUDA calls and 20 µs of host work. Launch waits and turns leave the GPU idle 61%.
Explain it simply
The CPU launches 12 kernels one by one, then asks to copy the new tokens back. The GPU works while the CPU launches. But the host work waits for the GPU to finish, so those two never overlap. Each token takes 89.0 µs.
Eager loop of 3 tokens: 267.0 µs, 89.0 µs per token. The GPU is busy 39% of the time.
kernelCUDA call, host work1 µs startGPU idle (brick), CPU wait (grey box), run before the fix (grey line)copy, token, end
Toy: 3 tokens, 12 kernels per step, a 1 TB/s GPU
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
CPU time per step is the calls times their cost, plus host work.
PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
- 4 more stages and 3 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.