JA EN
LearnComputer Architecture
·★ MEMBER·9 min read

The Memory Wall from Scratch — Why Moving Data Costs More Than Computing

Multiplying two numbers is cheap; delivering them is not. Starting from the physics of charging a wire, we get to why DRAM latency never shrank, the orders of magnitude in the memory hierarchy, Little's law, machine balance and the roofline — and end with a procedure for deciding whether your kernel is compute bound or bandwidth bound.

ModalitytextTaskhardware

The expensive part is not the arithmetic

Start by distrusting the phrase "this computation is heavy". Multiplying two numbers is a remarkably cheap operation. What is expensive is getting those two numbers in front of the arithmetic unit.

The reason is physics. A multiply is a local event across a few thousand transistors, with signals travelling microns. Fetching a value from memory means driving a wire that runs to the edge of the chip — often off it. The energy needed to swing that wire to voltage VV is

E=12CV2E = \tfrac{1}{2} C V^2
(1)

where CC is the capacitance hanging off the wire and VV is the voltage swing. Put in words: the bill for sending a signal down a wire comes from exactly two things — how much charge that wire insists on holding, and how hard you have to swing the voltage — and the second one is squared. And CC grows roughly in proportion to the wire's length, so distance is the price tag. Reading a word from the register next door and reading one from DRAM across the board differ in energy by orders of magnitude. Arithmetic is cheap, movement is expensive: every design decision below rests on that asymmetry.

Why DRAM latency never shrank

Transistor counts rose, clocks rose, arithmetic units multiplied. DRAM latency did not follow at anything like that pace, and the widening gap is the memory wall. The reason is structural.

One DRAM bit is a capacitor and a transistor. To read it you raise the word line and let the cell dump its charge onto the bit line — but hundreds of cells hang off that line, so its capacitance is large and the resulting swing is tiny. A sense amplifier must amplify it before anyone can call it a 0 or a 1. Worse, the read destroys the charge, so the value must be written back and the bit line precharged before the next access.

None of that gets shorter when you shrink the process. A smaller cell holds less charge, which makes the signal weaker and detection harder. Bandwidth is a different story: add I/O pins, raise the transfer clock, stack the dies. Bandwidth can be bought; latency cannot. That asymmetry motivates nearly every trick that follows.

Why nobody builds memory that is both big and fast

So why can't one tier be both? Add capacity and the array occupies more area; wires get longer, resistance and capacitance rise, edges get lazier. At the limit even the speed of light bites: in one cycle at 1 GHz, light travels about 30 cm in vacuum. Big things are, of necessity, far away. Hence the only option: stack a small fast tier on a large slow one.

Tier Implementation Latency, order of Capacity, order of
Registers flip-flops under one cycle hundreds of bytes
L1 cache SRAM a few cycles tens of KB
Last-level cache SRAM tens to hundreds of cycles MB to tens of MB
Main memory DRAM hundreds of cycles (tens to ~100 ns) GB
Storage flash tens of thousands to millions of cycles TB

Top to bottom, latency spans more than six orders of magnitude. On a linear axis the upper tiers simply vanish.

FIG 1Put two different growth rates side by side and the gap inevitably becomes orders of magnitude — which is exactly how compute and memory drifted apart. Switch the y-axis to linear and the lower curves collapse into the floor: the same reason a memory-hierarchy table has to be read logarithmically

Latency can be hidden; bandwidth cannot

Latency and bandwidth are different quantities. What links them is Little's law, the general queueing result.

N=λLN = \lambda L
(2)

NN is the number of accesses in flight at once, λ\lambda is the throughput you want (accesses per second), LL is the latency. Read it as: keep flow times round-trip time worth of inventory in the air at all times. It is the same arithmetic a warehouse lives by, which says that the slower your supplier's round trip — and the faster you want to sell — the more orders you have to keep outstanding simply to keep the shelves from going empty. To move 1 TB/s in 64-byte cache lines you need λ1.6×1010\lambda \approx 1.6 \times 10^{10} accesses per second; at 100 ns latency that is N=1600N = 1600. Unless 1600 reads are outstanding at every instant, the bandwidth stays unused.

Prefetchers, load queues, and a GPU's tens of thousands of threads all exist to maintain that NNinventory whose purpose is to hide latency. But only latency hides: the volume you can move is fixed by bandwidth. That is where the real argument starts.

[The cost of matrix multiplication](/en/a/matrix-multiplication-cost/) defined arithmetic intensity = FLOPs ÷ bytes moved, and showed GEMM reaching while GEMV is stuck near . That is a property of the algorithm. The hardware has a quantity of the same dimension.

What's behind this

§

Members-only from here

371 walkthroughs, 26 textbook chapters, 48 student units and 6 close readings — all included for $4.99/mo, with three new explainers every day. Cancel any time; access runs to the end of the period.

Already a member? Sign in to keep reading

Comments

Sign in to comment