Before you start: words you need#
| Word | Plain meaning |
|---|---|
| FLOP | One floating-point operation: one add or one multiply on real numbers. “FLOP/s” is how many per second. |
| Bandwidth | How many bytes per second a memory can deliver to the processor. |
| Operational intensity | FLOPs done per byte moved between the chip and its main memory (DRAM). The paper’s name for what this material calls arithmetic intensity (2.f). |
| Kernel | One self-contained piece of computation, such as a matrix multiply or a stencil sweep. |
| Ridge point | The intensity at which a machine’s two limits (maths and memory) meet. Below it you are memory-bound; above it, compute-bound. |
| Ceiling | A lower, horizontal or slanted line under the roof that you only rise above by doing a specific optimisation (SIMD, prefetching, and so on). |
| Multicore | A chip with several processor cores. In 2008 this was new and every vendor built it differently. |
1. The paper#
- Title: “Roofline: An Insightful Visual Performance Model for Multicore Architectures”
- Authors: Samuel Williams, Andrew Waterman, David Patterson (UC Berkeley)
- Venue: Communications of the ACM, vol. 52, no. 4, April 2009, pp. 65–76. An earlier, longer version is Berkeley technical report UCB/EECS-2008-134 (17 October 2008).
- Links: DOI 10.1145/1498765.1498785 · free technical report PDF
It is the oldest paper in this module and the only one that is not about machine learning. It is here because every other paper in the module is, at bottom, an argument about where a computation sits on this one graph.
2. The problem#
In 2008 every chip maker had just switched to multicore, and each did it differently: a few fat out-of-order cores (Intel Xeon, AMD Opteron), many simple multithreaded cores (Sun Niagara), or a main core plus small cores with their own local memory (IBM Cell). Programmers and compiler writers had no simple way to answer two questions:
- How fast could this kernel run on this machine?
- If it runs slower than that, which optimisation should I try first?
Detailed simulators and statistical models existed, but they were hard to use and rarely told you what to change. The authors wanted something you could draw on a whiteboard.
3. The idea#
Performance is capped by whichever runs out first: the maths units or the memory. Write that as one line:
Attainable FLOP/s = min( Peak FLOP/s , Peak memory bandwidth × Operational intensity )Plot it on log–log axes with operational intensity on x and FLOP/s on y. Bandwidth × intensity is a 45° slanted line; peak FLOP/s is a flat line. Together they look like a roof. A kernel sits on a vertical line at its own intensity, and its performance can be no higher than where that line hits the roof.
flowchart LR
K["Kernel: count FLOPs and DRAM bytes"] --> I["Operational intensity = FLOPs / bytes"]
M["Machine: peak FLOP/s and measured bandwidth"] --> R["Ridge point = peak FLOP/s / bandwidth"]
I --> C{"Intensity below ridge?"}
R --> C
C -- yes --> MB["Memory-bound: cut bytes, raise reuse"]
C -- no --> CB["Compute-bound: use SIMD, balance mul/add"]
class K,I,M,R compute
class C neutral
class MB,CB memoryTwo details made it more than a formula:
- Measured, not datasheet, bandwidth. The slanted roof uses the steady-state bandwidth from a benchmark (STREAM-like), “not the pin bandwidth of the DRAM chips”.
- Ceilings. Under the roof the authors draw extra lines, one per missing optimisation: no instruction-level parallelism or SIMD, unbalanced multiplies and adds, non-unit-stride access, no memory affinity, no software prefetch. You cannot break through a ceiling without doing its optimisation, so the ceilings give an order of work.
The rule they draw from it: improve operational intensity (cut memory traffic) first, because that can move a kernel into a different region of the graph.
4. How it works#
Step 1: draw the machine. The paper’s first example is a dual-socket 2.2 GHz AMD Opteron X2 with 17.6 GFLOP/s of peak double precision and 15 GB/s measured bandwidth. Its ridge point is at about 1 FLOP/byte (17.6 ÷ 15 ≈ 1.2; the paper calls it 1.0). A kernel with intensity 2 is compute-bound there; a kernel with intensity 1 is memory-bound.
Step 2: compare machines. The Opteron X4 that followed had four cores and roughly four times the peak FLOP/s, but the same socket and so the same memory bandwidth. Its ridge point moved right to 4.4. The lesson: a “faster” chip only helps kernels whose intensity is above 1. Everything else runs at the same speed as before.
Step 3: place the kernels. Operational intensity counts DRAM traffic after caches, so caches change it. The 3Cs of cache misses (compulsory, capacity, conflict) map onto the graph: compulsory misses fix the best possible intensity, and capacity and conflict misses push a kernel left. Padding arrays or using no-allocate stores pushes it back right.
Step 4: optimise in the order the ceilings say. If the kernel is left of the ridge, work on the memory ceilings first; if right, on the compute ceilings.
The same arithmetic in today’s units: an H100 SXM has about 989 dense BF16 TFLOP/s and 3.35 TB/s, so its ridge point is about 295 FLOP/byte (22.b). One decode step of a 70B model at batch 1 does about 2 FLOPs per weight and reads 2 bytes per weight, an intensity near 1. It sits far down the slanted roof, which is why decode is memory-bound (12.c) and why batching (2.d) is the main lever.
5. Results#
The authors built Roofline models for four 2007–08 multicores and optimised four kernels from the “Seven Dwarfs” list of scientific methods. Numbers are from the paper’s text and Table 1.
| Machine | Peak GFLOP/s (DP) | Measured GB/s | Ridge point (FLOP/byte) |
|---|---|---|---|
| Intel Xeon (Clovertown) | 75 | 5.9 | 6.7 |
| AMD Opteron X4 (Barcelona) | 74 | 16.6 | 4.4 |
| Sun UltraSPARC T2+ (Niagara 2) | 19 | 26.0 | 0.33 |
| IBM Cell QS20 (SPEs) | 29 | 47.0 | 0.65 |
| Kernel | Operational intensity (FLOP/byte) |
|---|---|
| Sparse matrix–vector multiply (SpMV) | 0.17 to 0.25 |
| Lattice-Boltzmann (LBMHD) | 0.70 to 1.07 |
| 3-D stencil | 0.33 to 0.50 |
| 3-D FFT | 1.09 to 1.64 |
Every optimised result landed under its machine’s roofline and above the ceilings for the optimisations that had been applied. The model did not predict exact speed; it bounded it, and the bounds held for all 16 machine–kernel pairs. The machine with the most FLOP/s (Xeon) was often the slowest, because almost every kernel sat left of its ridge point.
6. What held up and what did not#
Held up
- The core formula. Every GPU profiler now draws it: Nsight Compute has a roofline chart (22.h), and inference engineers decide “memory-bound or compute-bound?” with it every day (22.c).
- The observation that peak FLOP/s grows faster than bandwidth. In 2008 ridge points were 0.3 to 7; on an H100 it is about 295, on a B200 in BF16 a little lower (7.c), and FP8/FP4 push it higher. The gap the paper warned about grew by two orders of magnitude.
- “Improve intensity first.” FlashAttention (30.f), kernel fusion (13.j) and weight quantization (13.c) are all intensity-raising moves.
Did not, or needed extending
- One roof is too few. Modern use draws one slanted roof per memory level (HBM, L2, shared memory) — the hierarchical roofline that Williams and colleagues developed later — and one flat roof per number format (FP32, BF16, FP8, FP4 tensor cores).
- It ignores latency, launch overhead and communication. A decode step can sit below every roof because of kernel-launch gaps (5.f) or waiting on an all-reduce (9.g). Those need other models.
- Operational intensity depends on cache behaviour, so it is not a fixed property of an algorithm. The paper said so; readers often forget.
7. Where it lives in 2026#
- Taught in depth in 2.f (counting FLOPs and bytes), 6.a (measuring a GPU’s roofline) and 22.b (using it while debugging). Memory-bound vs compute-bound decisions: 22.c.
- Built into NVIDIA Nsight Compute, AMD Omniperf/ROCm Compute Profiler and Intel Advisor as a standard chart.
- It is the first sanity check in nearly every paper in this module: Efficiently Scaling Transformer Inference (30.j) is essentially a roofline analysis of a whole model across many chips.
Checked on 13 November 2026.
8. Questions#
- Write the roofline formula from memory and say what each term means.
- An accelerator has 2,000 TFLOP/s and 8 TB/s. What is its ridge point? Is a GEMV with intensity 1 memory-bound or compute-bound on it?
- Why did the authors use measured bandwidth instead of the DRAM datasheet figure?
- Between the Opteron X2 and X4, peak FLOP/s quadrupled but many kernels did not get faster. Why?
- Why can caches change a kernel’s operational intensity? Give one optimisation that raises it.
- Name two things that make a real inference step run below its roofline that the model does not capture.
- How does quantizing weights from BF16 to FP8 move a decode GEMV on the roofline graph?
9. Further reading#
- Williams, Waterman, Patterson, technical report EECS-2008-134 — the longer version, with more on ceilings.
- The CACM article: DOI 10.1145/1498765.1498785.
- 2.f, 6.a, 22.b and 22.c in this material for the hands-on side.
- Next in this module: Attention Is All You Need (30.b).