Roofline Model Analysis

Roofline Model Analysis is the visual performance modeling framework that plots achievable performance (FLOP/s) against arithmetic intensity (FLOP/byte) to determine whether a computation is memory-bound or compute-bound — providing immediate insight into the performance bottleneck and the maximum achievable speedup, making it the most practical first-step analysis tool for understanding and optimizing the performance of any computational kernel on any hardware.

Roofline Construction

  • X-axis: Arithmetic Intensity (AI) = FLOPs / Bytes transferred (operational intensity).
  • Y-axis: Attainable Performance (GFLOP/s or TFLOP/s).
  • Memory ceiling: Diagonal line with slope = memory bandwidth. Performance = AI × BW.
  • Compute ceiling: Horizontal line at peak compute rate.
  • Performance = min(Peak_Compute, AI × Peak_Bandwidth).

Roofline for NVIDIA A100

Peak FP32: 19.5 TFLOPS
HBM Bandwidth: 2.0 TB/s
Ridge Point: 19,500 / 2,000 = 9.75 FLOP/byte

  TFLOP/s
    19.5 |__________________________ (compute ceiling)
         |                  /
         |                /
         |              /    ← memory ceiling (slope = 2 TB/s)
         |            /
         |          /
         |        /
         |      /
         |    /
         |  /
         |/__________________________ AI (FLOP/byte)
                9.75
              (ridge point)
  • Left of ridge: Memory-bound → optimize memory access (coalescing, caching, reuse).
  • Right of ridge: Compute-bound → optimize computation (SIMD, FMA, algorithm efficiency).

Computing Arithmetic Intensity

KernelFLOPs/elementBytes/elementAIBound
Vector add (a+b→c)112 (3×4B)0.08Memory
Dot product2N8N+4~0.25Memory
Dense GEMM (NxN)2N³3×4N²N/6Compute (for large N)
1D stencil (3-point)24 (with reuse)0.5Memory
SpMV (sparse)2×NNZ12×NNZ0.17Memory

Roofline Extensions

CeilingDescription
L1 bandwidth ceilingPerformance bound by L1 cache bandwidth
L2 bandwidth ceilingPerformance bound by L2 cache bandwidth
SIMD ceilingPenalty for non-vectorized code
FMA ceilingPenalty for not using fused multiply-add
Tensor Core ceilingPeak when using tensor cores (mixed precision)

Using Roofline for Optimization

1. Profile kernel: Measure actual FLOP/s and bytes transferred.
2. Plot on roofline: Where does the kernel sit relative to ceilings?
3. If below memory ceiling: Memory access inefficiency → fix coalescing, add caching.
4. If at memory ceiling: Memory-bound → increase AI (algorithm change, tiling, reuse).
5. If at compute ceiling: Compute-bound → use wider SIMD, tensor cores, better algorithm.

Tools

  • Intel Advisor: Automated roofline analysis for CPU.
  • NVIDIA Nsight Compute: Roofline chart for GPU kernels.
  • Empirical Roofline Toolkit (ERT): Measures actual machine ceilings.

The roofline model is the most effective framework for understanding computational performance — by instantly revealing whether a kernel is memory-bound or compute-bound and quantifying the gap to peak performance, it guides optimization effort toward the actual bottleneck rather than wasting time on non-limiting factors.

Take roofline model analysis further

Ask the copilot about this term, or have our engineers assess it against your process.