LESSON 28.03 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW
Tiled attention with SRAM reuse
Watch attention run tile by tile without writing scores to HBM.
Needs28.02 Online softmax
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 28.03 · MEMORY BAYTILE 4 · SET 176 B / 256 B
01
Stage 1 of 6 · Split into tiles
FlashAttention splits Q, K and V into tiles of 4 tokens. One tile set needs 176 B of the 256 B SRAM.
Explain it simply
Attention needs every query row to meet every key row. The chip's fast memory holds only 256 bytes, so it can't hold all of that. The kernel cuts Q, K and V into tiles, small blocks of 4 rows. The gauge shows that one set of tiles fits on the chip.
HBM holds Q, K and V in 4 tiles each. SRAM shows empty slots for one tile set.
Q, K, VS, P, max m, sum ℓ (in the bars: traffic to remove); gradients dashedO, L (written to HBM) and byte countsSRAM, tile setempty, never written, or does not fit
Toy: 1 head, 16 tokens × 4 values in FP16, seeded random, not trained; SRAM 256 B
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
One tile set holds Q, K, V and O tiles, scores and row statistics.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 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.