Pidoku

HBM and Memory Bandwidth

Module 4 Lesson 4.e 45 min Difficulty 2/5

Prerequisites 4.b, 4.d


Before you start: words you need#

WordPlain meaning
DRAMThe ordinary kind of computer memory: dense, cheap, slower than on-chip memory.
HBM (high-bandwidth memory)DRAM chips stacked on top of each other and placed right beside the GPU.
StackOne tower of 8–16 DRAM dies. A GPU has 4–12 stacks around it.
Bus widthHow many data wires connect memory to the processor. More wires = more bits per clock.
Data rateHow many bits each wire carries per second (Gb/s per pin).
TSV (through-silicon via)A tiny vertical wire drilled through a chip, connecting the dies in a stack.
InterposerA slab of silicon the GPU and HBM stacks sit on, carrying thousands of short wires between them.
GDDRThe memory on gaming and many inference cards: separate chips on the circuit board, cheaper, narrower.

1. What is it?#

Data-center GPUs use HBM: memory dies stacked vertically and placed millimetres from the GPU on a shared silicon base. The point is not capacity. It is bandwidth — how many bytes per second can flow between memory and the arithmetic units.

flowchart LR
  subgraph PKG["One GPU package"]
    direction LR
    subgraph STACK["HBM stack (4–12 around the chip)"]
      direction TB
      D1["DRAM die"] --- D2["DRAM die"] --- D3["DRAM die"] --- D4["... 8 to 16 dies, joined by TSVs"]
    end
    INT["Silicon interposer<br/>thousands of short wires"]
    DIE["GPU die"]
    STACK --- INT --- DIE
  end
  class D1,D2,D3,D4 memory
  class INT neutral
  class DIE compute

Lesson 4.b showed why this number matters so much: decoding one token means reading every weight once, so for one user tokens/s ≤ bandwidth ÷ model bytes. This lesson is about where the bandwidth comes from and what limits it.


2. Why does it exist?#

Because arithmetic got cheap faster than memory did. A GPU that can do a quadrillion operations per second is useless if the numbers arrive slowly — and in LLM decode they arrive slowly by default, because each weight byte is used for only about 2 operations per sequence (2.f).

Ordinary memory cannot keep up. Memory modules sit centimetres away on the circuit board; only a few hundred wires fit between them and the processor, and long wires cannot be switched very fast. HBM was invented to get thousands of short wires instead.


3. Simple analogy#

A kitchen with fifty chefs and one narrow door to the pantry. Hiring more chefs does nothing; they queue at the door. The only fix is a wider door — or a pantry built right against the kitchen wall with a hundred hatches. HBM is the hundred hatches.


4. Tiny example#

Bandwidth is a simple product:

bandwidth = stacks × wires per stack × bits per second per wire ÷ 8

H100 (HBM3):    5 stacks × 1,024 wires × ~5.2 Gb/s ÷ 8 ≈ 3.35 TB/s
B200 (HBM3e):   8 stacks × 1,024 wires × ~8 Gb/s   ÷ 8 ≈ 8 TB/s
Rubin (HBM4):   8 stacks × 2,048 wires × ~11 Gb/s  ÷ 8 ≈ 22 TB/s   (above the 8 Gb/s JEDEC baseline)

Compare a desktop CPU: two DDR5 channels, 128 data wires in total, ~6.4 Gb/s each → about 100 GB/s. HBM wins mostly through the number of wires, not their speed.

You can feel memory-bound behaviour on your own machine. This program copies 1 GiB (no arithmetic at all) with more and more threads:

Go
// bandwidth.go — measure how fast this machine can stream bytes through memory.
package main

import (
	"fmt"
	"runtime"
	"sync"
	"time"
)

func main() {
	const n = 1 << 28 // 256M float32 = 1 GiB per array
	src, dst := make([]float32, n), make([]float32, n)
	for i := range src {
		src[i] = 1
	}
	copy(dst, src) // warm-up: touch every page so no timed run pays for page faults

	for workers := 1; workers <= runtime.NumCPU(); workers *= 2 {
		chunk := n / workers
		t0 := time.Now()
		var wg sync.WaitGroup
		for w := 0; w < workers; w++ {
			a, b := src[w*chunk:(w+1)*chunk], dst[w*chunk:(w+1)*chunk]
			wg.Add(1)
			go func() {
				defer wg.Done()
				copy(b, a) // read 4 bytes, write 4 bytes, no arithmetic at all
			}()
		}
		wg.Wait()
		dt := time.Since(t0).Seconds()
		fmt.Printf("%2d workers: %6.1f GB/s\n", workers, 2*4*float64(n)/dt/1e9)
	}
}

On an Apple M4 laptop (unified LPDDR5X memory) it printed:

 1 workers:   58.8 GB/s
 2 workers:  101.4 GB/s
 4 workers:  101.8 GB/s
 8 workers:   96.4 GB/s

Two workers saturate the memory; adding more cores changes nothing. That flat line is the memory bandwidth, and it is what “memory-bound” feels like. An H100 sits at about 3,350 GB/s — 33 times higher — which is the whole reason it can serve a model this laptop cannot.


5. Technical explanation#

The memory generations#

MemoryFound inBandwidth per GPUCapacity per GPU
GDDR6 / GDDR6XT4, L4, L40S, RTX 40900.3–1.0 TB/s16–48 GB
GDDR7RTX 5090, RTX PRO 6000 Blackwell~1.8 TB/s32–96 GB
HBM2eA100~2.0 TB/s40–80 GB
HBM3H100~3.35 TB/s80 GB
HBM3eH200, B200, B300, AMD MI325X/MI355X~4.8–8 TB/s141–288 GB
HBM4NVIDIA Rubin, AMD MI455X (2026)~20–22 TB/s (vendor figures)288–432 GB

Details per product are in Module 7. Three things to notice:

  1. HBM4 doubles the wires per stack (1,024 → 2,048). That is why Rubin’s bandwidth jumps about 2.75x over Blackwell with the same number of stacks — the biggest single-generation bandwidth gain in years, and the most important Rubin feature for decode (7.e).
  2. Capacity grows by stacking higher. B300’s 288 GB uses 12-high stacks (B200: 8-high). Taller stacks add capacity, not bandwidth.
  3. GDDR closed some of the gap. GDDR7 cards at ~1.8 TB/s and 96 GB are now serious single-node inference parts for models up to ~70B at low precision.

Why HBM is the bottleneck of the AI industry#

HBM is hard to make: dies must be thinned, drilled with TSVs, stacked and tested, and one bad die can ruin a stack. Only three companies make it — SK hynix, Samsung and Micron — and through 2024–2026 HBM supply, more than GPU dies, limited how many AI accelerators could be built. It also costs a large share of each accelerator’s bill of materials. When you read that a new GPU “is supply-constrained”, it is very often the memory.

Peak versus achieved#

The datasheet number is a peak. Real workloads reach:

large sequential copies        85–92% of peak
well-written decode kernels    70–85%
small or scattered reads       far less — see coalescing (6.b)

Plan capacity with the achieved number you measure (4.a exercise), not the datasheet.

Capacity versus bandwidth#

They are different numbers and they fail differently:

  • Too little capacity → the model or its KV cache does not fit; the server fails to start or rejects requests (out of memory).
  • Too little bandwidth → everything runs, slowly, while nvidia-smi cheerfully reports 100% utilisation (22.d).

6. Under the hood#

Why stacked, short wires are faster:

  • Wire count. Wires on a circuit board are limited by the space for pins and traces. Wires on a silicon interposer are microns wide, so thousands fit.
  • Wire length. A signal on a short wire needs less energy and settles faster, so each wire can run at a high data rate without errors.
  • Energy. Moving a bit from HBM costs a few picojoules; from off-board DDR several times more. Memory traffic is a large share of GPU power (4.g), so HBM saves power as well as time.

The price is heat and manufacturing complexity: the stacks sit right next to a 700–1,400 W GPU, which is part of why the newest parts need liquid cooling.


7. Performance implications#

  • For decode, tokens per second per GPU scale almost linearly with bandwidth. Moving the same model from H100 (3.35 TB/s) to H200 (4.8 TB/s) gives roughly 1.4x decode speed with no software change.
  • Fewer bytes per weight act like more bandwidth. FP8 weights halve the bytes read per token, FP4 quarters them (13.e, 13.g). Quantization is, at heart, a bandwidth optimisation.
  • The KV cache competes for the same bandwidth. With long contexts and many users, reading the KV cache can cost more bandwidth than reading the weights (12.f).

8. Production implications#

  • Benchmark bandwidth on every new node type and alert if a node falls well below its peers: a degraded HBM stack or a misconfigured GPU shows up as low bandwidth first.
  • Watch for HBM errors. Uncorrectable ECC errors and row remapping events in nvidia-smi -q -d ECC,ROW_REMAPPER mean a GPU should be drained and reset or replaced.
  • Price per TB/s is a better first filter for decode-heavy fleets than price per TFLOP.

9. Common mistakes#

  1. Using the datasheet peak in capacity plans. Use measured bandwidth.
  2. Thinking more capacity means more speed. A taller stack adds room, not bandwidth.
  3. Ignoring the KV cache’s share of bandwidth at long context and high concurrency.
  4. Blaming the GPU for a memory-bound workload that batching or quantization would fix.

10. Hands-on exercise#

  1. Run bandwidth.go. At what worker count does the number stop improving? Why does adding cores not help?
  2. With your measured bandwidth, what is the upper limit on tokens/s for a 4 GB model on your CPU? Try it with llama.cpp (15.e) and compare.
  3. A 70B model at FP8 (70 GB) on one GPU with 8 TB/s: what is the maximum tokens/s for a single sequence? With 22 TB/s?
  4. On a GPU, run the copy benchmark from 4.a. What fraction of the datasheet bandwidth do you get?

11. Interview questions#

  1. What physical design gives HBM its bandwidth?
  2. Compute an HBM GPU’s bandwidth from its stack count, bus width and data rate.
  3. Why does a gaming GPU with similar FLOPs serve LLMs more slowly than a data-center GPU?
  4. What does HBM4 change, and why does it matter for decode?
  5. Why is quantization described as a bandwidth optimisation?
  6. Why has HBM, rather than GPU dies, often limited AI accelerator supply?

12. Further reading#

Checked on 11 November 2026.

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in