Log inStart free
LESSON 27.20 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Persistent kernels

Watch the same tiles run as one block each, then on blocks that stay.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 27.20 · KERNEL BAY10 TILES · 4 SMS · WORK 20.0 µs
01
Stage 1 of 6 · The tiles
A matmul kernel splits its output into 10 tiles. A toy GPU with 4 SMs runs them.
Explain it simply

Each teal chip on top is one tile, a small block of the output. Its width is the work it needs, 2 microseconds for every tile. The four grey lanes are the SMs, the parts of the GPU that run the work. Each SM runs one block of threads at a time.

A row of 10 tile chips above 4 empty SM lanes. The tiles need 20.0 µs of work.

tile workblock setup, idle SMqueue fetchkernel end
SM 0SM 1SM 2SM 302468µstiles0123456789tiles and SMsW = 10 × 2.0 µs = 20.0 µs of tile workSM 0SM 1SM 2SM 302468µstiles0123456789tiles and SMsW = 10 × 2.0 µs = 20.0 µs of tile work
Toy: 4 SMs, 6 to 24 output tiles, one block per SM at a time
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
W=∑iwi\sy{w}{data}{W} = \sum_i \sy{wi}{data}{w_i}
W=10⋅2.0=20.0 μsW = 10 \cdot 2.0 = 20.0\ \mu\text{s}

The total work adds the work of every tile.

Common mix-ups

MYTHA persistent kernel always ends sooner than a normal launch.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01If the block setup grows to 2 µs, which loses more: the normal launch or the static persistent kernel?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 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.