Arte SheetsLearn. Try. Understand.

Cloud Infrastructure & AI Systems Engineering

Roofline Model Compute vs Memory-Bound Formula

Diagnose LLM inference vs training bottlenecks via Samuel Williams, Andrew Waterman, and David Patterson’s (2009) Roofline ceiling MIN(Peak_TFLOPS, Operational_Intensity * HBM_Bandwidth) and Ridge Point.

Explain why batch-1 LLM token decoding uses <2% of GPU compute FLOPS!

Buying higher-TFLOPS GPUs does ZERO good if a kernel is starved waiting for High-Bandwidth Memory (HBM) bytes! Samuel Williams, Andrew Waterman, and David Patterson (2009) unified processor Peak Compute P_peak (TFLOP/s = 10^12 FLOP/s), Sustained Memory Bandwidth BW_mem (TB/s = 10^12 Bytes/s), and a kernel’s Operational (Arithmetic) Intensity OI = Total_FLOPs / Total_HBM_Bytes_Moved (FLOP/Byte) into the Roofline Performance Ceiling: P_attainable = MIN(P_peak, OI * BW_mem)! The exact transition knee where memory ceiling meets compute ceiling is the Machine Balance / Ridge Point OI_ridge = P_peak / BW_mem (FLOP/Byte): any kernel with OI < OI_ridge (like batch-1 autoregressive LLM decoding at OI ~ 1–2 FLOP/Byte) is strictly Memory-Bandwidth Bound, whereas dense GEMM training / large-batch prefill (OI > OI_ridge) is Compute Bound!

Verify on a modern AI accelerator with Peak_BF16_Compute P_peak = 990.0 TFLOP/s (B2) and HBM3_Bandwidth BW_mem = 3.30 TB/s (B3), running a small-batch kernel performing Kernel_GFLOPs = 66.0 (B4) over HBM_GBytes_Moved = 11.0 (B5 -> Operational Intensity OI = 66 / 11 = 6.00 FLOP/Byte): Hardware Ridge Point is 990.0 / 3.30 = 300.00 FLOP/Byte! Since OI = 6.00 < 300.00, Attainable Performance hits the sloped memory roof MIN(990, 6.00 * 3.30) = 19.80 TFLOP/s (only 19.80 / 990 = 0.0200 = 2.00% compute utilization — "Memory-Bandwidth Bound"!), whereas batching 64x (B4 = 4,224 GFLOPs over the same 11 GB weight load -> OI = 384 > 300) saturates the flat compute roof at 990.00 TFLOP/s ("Compute Bound")!

Roofline Metric (P_peak = 990 TFLOP/s, BW = 3.30 TB/s)FormulaVerified Output
Hardware Ridge Point (OI_ridge)P_peak / BW_mem = 990 / 3.30300.00 FLOP / Byte
Kernel Operational Intensity (OI)GFLOPs / GBytes = 66 / 116.00 FLOP / Byte
Attainable Roofline CeilingMIN(P_peak, OI * BW_mem)19.80 TFLOP/s (2.00% Peak!)
Bottleneck Regime ClassificationIF(OI < OI_ridge, "Memory-Bound", ...)Memory-Bandwidth Bound

Hardware Ridge Point & Attainable Roofline Ceiling Formula

Notice unit harmony: dividing TFLOP/s (10^12) by TB/s (10^12) cancels 10^12 cleanly to FLOP/Byte, matching GFLOPs (10^9) divided by GBytes (10^9)!

=LET(p_pk, B2, bw_m, B3, fl_g, B4, by_g, B5, IF(OR(p_pk <= 0, bw_m <= 0, fl_g <= 0, by_g <= 0), "Invalid Roofline Input", LET(oi_k, fl_g / by_g, ROUND(MIN(p_pk, oi_k * bw_m), 2))))

Roofline Bottleneck Regime Classifier Formula

Optimize memory-bound kernels with quantization (FP8/INT4), KV-cache compression, and operator fusion; optimize compute-bound kernels with lower-precision Tensor Cores!

=LET(p_pk, B2, bw_m, B3, fl_g, B4, by_g, B5, IF(OR(p_pk <= 0, bw_m <= 0, fl_g <= 0, by_g <= 0), "Invalid Roofline Input", IF((fl_g / by_g) < (p_pk / bw_m), "Memory-Bandwidth Bound", "Compute Bound")))

Try the example

Use the original values or change them to test your understanding.

Further reading