The Roofline Model
The roofline model plots achievable performance against arithmetic intensity, showing whether a kernel is limited by compute or by memory bandwidth.
One picture of the limit
The roofline model captures a machine's two fundamental ceilings on a single plot: peak arithmetic rate (FLOP/s) and peak memory bandwidth (bytes/s). The horizontal axis is arithmetic intensity, the number of floating-point operations performed per byte of data moved from memory. The vertical axis is achievable performance.
Reading the roof
The performance ceiling is the minimum of two lines: a flat compute roof (peak FLOP/s) and a sloped memory roof (bandwidth times intensity). Low-intensity kernels fall under the sloped roof, they are memory-bound. High-intensity kernels fall under the flat roof, they are compute-bound. The crossover intensity, peak FLOP/s divided by bandwidth, marks the machine balance point.
Arithmetic intensity examples
- Vector add (a[i]+b[i]): about 1 FLOP per 12 bytes, deeply memory-bound
- Stencil updates: modest intensity, usually memory-bound
- Dense matrix multiply: intensity grows with tile size, can become compute-bound
How to use it
Measure a kernel's intensity and performance and plot the point. Its vertical distance to the roof shows the headroom; its position relative to the crossover shows which resource limits it. A memory-bound kernel improves by raising intensity, through cache blocking or better data reuse, not by adding FLOPs.
Why it guides tuning
The model prevents wasted effort. Speeding up arithmetic in a memory-bound kernel, or adding bandwidth to a compute-bound one, yields nothing. Roofline analysis turns tuning from guesswork into a directed search toward the relevant ceiling.