The roofline model is a visual performance model that bounds the attainable throughput of a computational kernel by two hardware limits: peak compute rate and peak memory bandwidth. In AI hardware analysis, it plots achievable operations per second against arithmetic intensity, the number of operations performed per byte moved, and shows at a glance whether a workload is memory-bound or compute-bound.
Introduced by Samuel Williams, Andrew Waterman and David Patterson in 2009, the model became a standard tool for evaluating data-center GPUs, TPUs and NPUs. It explains why a chip advertised at thousands of TFLOPS can deliver only a small fraction of that figure on large language model inference, and it tells engineers which optimization will actually help.
How the roofline model bounds performance
The model rests on one inequality: attainable performance equals the minimum of peak compute and the product of memory bandwidth and arithmetic intensity. On a log-log chart, the bandwidth term forms a sloped line rising from the left, and the compute limit forms a horizontal ceiling. Together they look like a roof, which gives the model its name.
The two lines meet at the ridge point, also called the machine balance. Its x-coordinate equals peak compute divided by peak bandwidth. A kernel whose arithmetic intensity lies left of the ridge point cannot saturate the compute units, no matter how well it is scheduled, because data cannot arrive fast enough.
The following table defines the quantities that appear on every roofline chart.
| Quantity | Unit | Meaning |
|---|---|---|
| Arithmetic intensity | FLOP per byte | Work done per byte of memory traffic |
| Peak compute | FLOP/s or TOPS | Horizontal ceiling of the chart |
| Peak bandwidth | Bytes per second | Slope of the diagonal roof |
| Ridge point | FLOP per byte | Intensity needed to reach peak compute |
| Attainable performance | FLOP/s | Minimum of the two limits |
Ridge points of modern AI accelerators
Accelerator compute has grown much faster than memory bandwidth, so ridge points keep moving to the right. This trend is a direct expression of the memory wall. The values below are approximate dense figures for low-precision tensor math and vary with clock speed, precision and product variant.
| Accelerator class | Dense low-precision compute | Memory bandwidth | Approximate ridge point |
|---|---|---|---|
| NVIDIA Hopper H100 SXM | About 990 TFLOPS in bfloat16 | About 3.35 TB/s HBM3 | About 295 FLOP per byte |
| NVIDIA Blackwell B200 | About 2,250 TFLOPS in bfloat16 | About 8 TB/s HBM3e | About 280 FLOP per byte |
| Laptop NPU | Tens of TOPS in INT8 | About 100 GB/s shared DRAM | Several hundred ops per byte |
| Server CPU socket | A few TFLOPS in FP32 | About 300 to 600 GB/s | About 5 to 15 FLOP per byte |
A ridge point near 300 FLOP per byte means a kernel must reuse each loaded byte hundreds of times to reach peak throughput. Only well-tiled large matrix multiplications achieve that, while most other operations in a neural network fall far to the left.
Where typical AI workloads land
Different stages of a transformer occupy very different positions on the roofline. Batch size, sequence length and numeric precision are the main levers, because they change how many operations each weight or activation byte supports.
| Operation | Typical intensity | Usual bound |
|---|---|---|
| Large training GEMM | Hundreds to thousands FLOP per byte | Compute-bound |
| Prefill with long prompts | High, grows with prompt length | Mostly compute-bound |
| Decode at batch size 1 | About 1 to 2 FLOP per byte | Strongly memory-bound |
| Elementwise ops and normalization | Below 1 FLOP per byte | Memory-bound |
| Attention over a long KV cache | Low without fusion | Memory-bound |
The decode phase of LLM inference illustrates the model clearly. At batch size one, every weight is read once to produce a single token, so throughput is set by memory bandwidth, not TFLOPS. Raising the batch size, quantizing weights to FP8 or FP4, and fusing kernels all move the workload to the right along the slope.
Extensions and hierarchical rooflines
The basic model has one bandwidth line, but real chips have a memory hierarchy. The hierarchical roofline draws a separate slope for each level, such as HBM, L2 cache and shared memory, and computes intensity relative to the traffic at that level. A kernel may be bound by HBM even though its cache traffic is comfortable.
- Additional ceilings: lower horizontal lines show the peak without tensor cores, without fused multiply-add or at higher precision.
- Interconnect rooflines: for distributed training, the slope uses NVLink or network bandwidth and intensity counts FLOP per byte communicated.
- Energy rooflines: the same idea applied to joules per operation and per byte, which relates to TOPS per watt.
- Latency-aware variants: add terms for kernel launch overhead and synchronization, which dominate very small operations.
Using the model in practice and its limits
Performance engineers place each measured kernel on the chart using profiler counters for FLOP executed and bytes transferred. The vertical gap between the point and the roof shows how much performance is left, and the horizontal position shows which resource to attack.
| Kernel position | Diagnosis | Recommended action |
|---|---|---|
| Far below the slope | Poor bandwidth use | Fix access patterns and coalescing |
| On the slope, left of ridge | Truly memory-bound | Raise reuse with tiling, fusion or batching |
| Near the ridge point | Balanced | Tune both data movement and compute |
| Below the flat ceiling | Compute underused | Use tensor cores and lower precision |
The roofline is an upper bound, not a prediction. It ignores latency, load imbalance, synchronization and contention among concurrent kernels. Vendor peak figures often assume structured sparsity or ideal clocks, so a sound analysis uses measured bandwidth and dense compute. Benchmarks such as MLPerf complement the roofline by reporting end-to-end results.
A plain-language summary
Think of a kitchen with very fast cooks and a narrow door for groceries. If the dishes need few ingredients per minute of cooking, the cooks stay busy. If the dishes need many ingredients, the cooks wait at the door.
The roofline model draws this as a simple chart. One line shows how fast the cooks can work. Another shows how fast groceries arrive. Whichever limit is lower decides real speed.
For AI chips, the cooks are the math units and the door is memory. The chart tells engineers whether to buy faster memory or reorganize the work.
An example from practice
An inference team serves a 70-billion-parameter language model on accelerators with about 3.35 TB/s of memory bandwidth. Users complain about slow token generation, and the team first suspects insufficient compute.
A roofline analysis shows that the decode kernels run at roughly 2 FLOP per byte, far left of the ridge point near 300. With 16-bit weights, each token requires reading about 140 GB, so bandwidth caps a single stream at roughly 24 tokens per second per accelerator before parallelism across chips. Compute utilization sits below 5 percent.
The team quantizes weights to FP8, halving the bytes read, and increases batching so that several requests share each weight load. Measured throughput per accelerator rises more than fivefold, and the roofline chart confirms that the kernels moved up the bandwidth slope toward the ridge point.