Log inStart free
LESSON 27.02 · 5 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

The roofline model

See why one GPU runs one kernel at 0.27 TFLOP/s and another at 247.


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/mo
EXPLAINER · 27.02 · ROOFLINEA100 · HBM 2.04 TB/S
01
Stage 1 of 5 · Memory roof
The HBM bandwidth B is 2.04 TB/s. At arithmetic intensity I, memory feeds at most B·I FLOP/s.
Explain it simply

The bottom axis counts FLOPs per byte, the math a kernel does for each byte it moves. The slanted line is the memory roof. Say memory sends 2.04 terabytes a second, and each byte feeds 10 FLOPs. Then the kernel gets at most 20.4 trillion FLOPs a second.

A log-log plot. The slanted memory roof rises with intensity: bandwidth 2.04 TB/s times I.

roofs: bandwidth and peakkernel: ring at its roof, dot achievedlost speed
0.10.111101010010010001000arithmetic intensity I, FLOP per byte (log)TFLOP/s (log)memory roof B·Ithe memory roofA100-like GPUHBM B = 2.04 TB/sB·I: at I = 10, 2.04 × 10 = 20.4 TFLOP/s0.10.111101010010010001000arithmetic intensity I, FLOP per byte (log)TFLOP/s (log)memory roof B·Ithe memory roofA100-like GPUHBM B = 2.04 TB/sB·I: at I = 10, 2.04 × 10 = 20.4 TFLOP/s
Toy: spec-sheet GPUs, three FP16 kernels, toy efficiencies
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Rmem=B⋅I\sy{roof}{param}{R_{mem}} = \sy{B}{param}{B}\cdot \sy{I}{out}{I}
2.04 TB/s×10 FLOP/B=20.4 TFLOP/s2.04\,\text{TB/s}\times 10\,\text{FLOP/B} = 20.4\,\text{TFLOP/s}

Memory alone allows bandwidth times intensity FLOPs per second.

Common mix-ups

MYTHA faster GPU makes more kernels compute-bound.

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

Predict, then reveal
3 CHECKS · PRO
Q01With a batch of 1, is the linear layer memory-bound or compute-bound?

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

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.