What limits a GPU
The memory ladder
A big GPU can do about 1,000 trillion math operations a second in BF16. But data must be brought to the math, and memory comes in tiers:
- Registers: tiny, right next to the math units, the fastest.
- SRAM: small fast memory on the chip itself, tens of MB in total.
- HBM: the big GPU memory (the VRAM), like 80 GB, but much slower than SRAM. The weights and KV cache live here.
CPU memory is slower still.
Memory bandwidth
Memory bandwidth is how many bytes per second HBM can deliver. Big data-center GPUs reach a few TB per second, about 2 to 8 on recent ones. Each decode step reads all the weights, so bandwidth sets a speed limit. A 7B model in BF16 is 14 GB; at 2 TB/s, one read takes about 7 ms. So one user gets at most about 140 tokens a second.
Compute-bound or memory-bound
Work is compute-bound when the math units are the limit. It is memory-bound when waiting for data is the limit. Prefill does lots of math per weight read, so it is usually compute-bound. Decode with few users does little math per weight, so it is memory-bound.
Arithmetic intensity
Arithmetic intensity is math operations per byte moved. In decode with one user, each 2-byte weight is used for about 2 operations: about 1 per byte. With a batch of 32, the same read feeds 32 users: about 32 per byte. A big GPU needs a few hundred per byte to keep its math busy.
The roofline
The roofline is a chart of speed against intensity. At low intensity, speed rises along a slope set by bandwidth. At high intensity, it hits a flat roof: peak compute. Where the slope meets the roof is the ridge point. Left of it, more bandwidth or intensity helps; right of it, only more compute helps.
Remember
- Memory is a ladder: registers, SRAM, HBM.
- Bandwidth limits how fast weights are read each decode step.
- Decode is usually memory-bound; prefill compute-bound.
- Batching raises math per byte.
- The roofline: a bandwidth slope, then a compute roof.