Log inStart free
LESSON 26.06 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

The GPU memory hierarchy

Follow each read from HBM up to the registers.


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/mo
EXPLAINER · 26.06 · MEMORY BAYHBM 80 GB · L2 16 KB · L1 8 KB A SM
01
Stage 1 of 6 · Global memory
Global memory holds a and b, 4 KB each. It lives in HBM, 80 GB beside the GPU chip.
Explain it simply

The wide band at the bottom is HBM, the GPU's big main memory. It sits next to the chip, not on it, so one read takes about 500 cycles. Global memory is the memory in HBM that every thread can read. On the right you see what it holds: the vectors a and b, and room for c and d.

Five memory levels as stacked bands. Each of 2 SMs has registers, L1 and shared memory. L2 sits on the chip, HBM below it. HBM holds vectors a and b, 1,024 floats each.

inputsresultson chip: SMs, hitsHBM readsnot written yet
GPU chipSM 0SM 132 B a cycle32 B32 B128 B128 Bregisters32 KB · 1 cycleL1 8 KB35 cyclesshared 8 KB30 cyclesregisters32 KB · 1 cycleL1 8 KB35 cyclesshared 8 KB30 cyclesL2 · both SMs16 KB · 250 cyclesHBM · global memory80 GB · 500 cyclesholds a, babcdglobal memory1 cell = 32 floats = 128 Ba GPU and its memorya₀ at byte 0, b₀ at byte 4096GPU chipSM 0SM 132 B a cycle32 B32 B128 B128 Bregisters32 KB · 1 cycleL1 8 KB35 cyclesshared 8 KB30 cyclesregisters32 KB · 1 cycleL1 8 KB35 cyclesshared 8 KB30 cyclesL2 · both SMs16 KB · 250 cyclesHBM · global memory80 GB · 500 cyclesholds a, babcdglobal memory1 cell = 32 floats = 128 Ba GPU and its memorya₀ at byte 0, b₀ at byte 4096
Toy: 2 SMs, memories shrunk to fit
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
sector=⌊address/32⌋\sy{s}{param}{\text{sector}} = \left\lfloor \sy{addr}{data}{\text{address}} / 32 \right\rfloor
a8:⌊32/32⌋=1a_8: \lfloor 32 / 32 \rfloor = 1

Global memory moves in sectors of 32 bytes, 8 floats each.

Common mix-ups

MYTHL1 keeps a kernel's data for the next kernel.

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

Predict, then reveal
3 CHECKS · PRO
Q01With inputs from global memory, does L1 serve more sectors for the blur or for the vectors?

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 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.