The roofline model in plain language, without the chart, what is it saying?
Roofline plots achievable FLOP/s against arithmetic intensity. Two ceilings (peak compute, peak bandwidth) cap performance; where a kernel sits says compute-bound or bandwidth-bound.
Imagine a factory has two limits. The first is how many workers it has (compute). The second is how fast trucks can deliver raw materials (bandwidth). If your product needs only a few materials but tons of assembly work, workers are the bottleneck. If it needs tons of materials but barely any assembly, the trucks are the bottleneck. The roofline is a picture that puts both limits on one chart and lets you see at a glance which one is choking your factory. For LLM inference, prefill is worker-bound (compute), and decode is truck-bound (bandwidth).
Detailed answer & concept explanation~5 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: arithmetic intensity definition + two ceilings + knee + LLM prefill vs decode positions + optimization levers by regime + FlashAttention tiling and cache-aware extensions.
Real products, models, and research that use this idea.
- H100 has roughly 1000 TFLOPS BF16 peak compute and roughly 3 TB/s HBM3 bandwidth, putting the knee around 330 FLOPs per byte.
- B200 raises both numbers (around 2.2 PFLOPS FP8, around 8 TB/s HBM3e) with the knee staying in a similar range; FP4 doubles compute again.
- Llama 3.1 70B decode on H100 sits firmly bandwidth-bound; vLLM benchmarks show GPU utilization around 30-50 percent during decode.
- Prefill on the same model with a 2K-token prompt saturates tensor cores at near-peak FLOPs, sitting right of the knee.
- FlashAttention-3 exploits SRAM tiling to effectively raise the bandwidth ceiling for attention; performance jumps even though HBM bandwidth is unchanged.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does FlashAttention's SRAM tiling change a kernel's position on the roofline?
QWhy does batching help decode more than it helps prefill, in roofline terms?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Conflating high FLOP/s with good performance. Hitting the bandwidth ceiling means you cannot go faster regardless of how many FLOPs your kernel does.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.