Inferensys

Glossary

Roofline Model

The Roofline Model is an analytical performance model that visually relates an application's operational intensity to its attainable performance, bounded by either peak compute throughput or memory bandwidth.
ML engineer running AI model benchmarks, performance charts on multiple screens, late night home office setup.
PERFORMANCE ANALYSIS

What is the Roofline Model?

The Roofline Model is a visual performance model used to analyze the theoretical limits of computational kernels on parallel hardware.

The Roofline Model is an analytical performance model that visually relates an application's arithmetic intensity—the number of operations per byte of DRAM traffic—to its attainable performance, which is bounded by either the hardware's peak compute throughput or its memory bandwidth. It provides a visual 'roofline' that represents the absolute performance ceiling for a given hardware platform, classifying kernels as either compute-bound or memory-bound based on their operational characteristics.

For compiler engineers optimizing kernel fusion, the model is essential for diagnosing bottlenecks. Fusing multiple operations increases arithmetic intensity by keeping intermediate results in registers or caches, moving the kernel's performance point to the right on the roofline chart. This shift can transition a kernel from being limited by memory bandwidth to being limited by peak compute, thereby achieving higher FLOPS and validating the efficacy of fusion and other memory hierarchy optimizations.

ANALYTICAL PERFORMANCE MODEL

Key Components of the Roofline Model

The Roofline Model visualizes the fundamental performance limits of a computational kernel or application on a given hardware architecture. It provides a two-dimensional plot relating operational intensity to attainable performance, bounded by either peak compute throughput or memory bandwidth.

01

Operational Intensity

Operational Intensity is the primary x-axis metric in the Roofline Model, defined as the number of floating-point operations (FLOPs) performed per byte of data transferred between the processor and main memory (DRAM). It is calculated as:

  • Formula: Operational Intensity = Total FLOPs / Total DRAM Bytes Transferred
  • High Intensity: Kernels with high operational intensity (e.g., dense matrix multiplication) are compute-bound.
  • Low Intensity: Kernels with low operational intensity (e.g., element-wise vector addition) are memory-bound. This metric classifies an application's fundamental bottleneck.
02

Attainable Performance

Attainable Performance is the primary y-axis metric, measured in GigaFLOPs per second (GFLOPS) or TeraFLOPs per second (TFLOPS). It represents the actual computational throughput achieved by a kernel. In the Roofline plot:

  • A point's vertical position shows its measured performance.
  • The roofline ceiling above it shows the maximum possible performance for its operational intensity.
  • The gap between the point and the ceiling indicates performance optimization headroom. The goal of kernel fusion and other optimizations is to move points vertically toward the roofline.
03

Ridge Point

The Ridge Point is the critical operational intensity value where the performance limit transitions from being constrained by memory bandwidth to being constrained by peak computational throughput. It is calculated as:

  • Formula: Ridge Point = Peak Memory Bandwidth (GB/s) / Peak Compute Performance (GFLOPS/byte)
  • Left of Ridge: Applications are memory-bound; performance scales linearly with operational intensity.
  • Right of Ridge: Applications are compute-bound; performance is capped at the hardware's peak FLOP/s rate. This point defines the two fundamental regimes of the model.
04

Memory-Bound Ceiling

The Memory-Bound Ceiling is the diagonal line on the left side of the roofline plot. It represents the maximum performance achievable when an application is limited by the system's memory bandwidth.

  • Slope = Bandwidth: The slope of this line equals the system's peak memory bandwidth (in units of GFLOPS per byte).
  • Governing Law: Performance ≤ Operational Intensity × Peak Memory Bandwidth.
  • Optimization Target: For kernels under this ceiling, optimizations must focus on reducing DRAM traffic (e.g., via kernel fusion, tiling, improving memory coalescing) to increase effective operational intensity and move the point to the right.
05

Compute-Bound Ceiling

The Compute-Bound Ceiling is the horizontal line on the right side of the roofline plot. It represents the maximum performance achievable when an application is limited by the processor's raw computational capabilities.

  • Flat Line: Performance is capped at the hardware's peak FLOP/s rate, regardless of increased operational intensity.
  • Governing Law: Performance ≤ Peak Compute Throughput.
  • Optimization Target: For kernels under this ceiling, optimizations must focus on improving computational efficiency (e.g., increasing kernel occupancy, leveraging tensor cores, maximizing instruction-level parallelism) to move the point vertically toward the flat ceiling.
06

Application in NPU Optimization

For Neural Processing Unit (NPU) acceleration, the Roofline Model is used to:

  • Diagnose Bottlenecks: Identify if a fused kernel or model layer is memory-bound or compute-bound on the target NPU.
  • Guide Kernel Fusion: Fusing multiple operations (e.g., Conv + Bias + ReLU) increases operational intensity by keeping intermediate data in fast on-chip memory, moving the kernel's point to the right on the plot, potentially crossing the ridge point into the compute-bound region.
  • Evaluate Hardware Fit: Compare the rooflines of different NPUs to select the best architecture for a specific AI workload's operational intensity profile.
  • Set Optimization Goals: Quantify the performance gap to the ceiling, providing a clear target for compiler engineers and performance architects.
PERFORMANCE BOUND ANALYSIS

Application Classification via the Roofline Model

This table classifies computational kernels based on their operational intensity relative to a system's hardware ceilings, identifying the primary performance bottleneck and the corresponding optimization strategy.

ClassificationArithmetic Intensity (AI) RangePrimary Performance BoundDominant BottleneckKey Optimization Strategy

Memory-Bound

AI < AI_balance (Peak BW / Peak FLOPs)

Attainable GFLOPs/sec = AI * BW_peak

Memory Bandwidth (BW)

Reduce data movement, improve data reuse, optimize memory access patterns (coalescing).

Compute-Bound

AI > AI_balance

Attainable GFLOPs/sec = Peak FLOPs

Compute Throughput (FLOPs)

Increase arithmetic intensity, leverage specialized units (Tensor Cores), optimize instruction mix.

Latency-Bound

N/A (Low Concurrency)

Performance << Roofline

Instruction/Memory Latency, Low Occupancy

Increase parallelism, hide latency via software pipelining, improve kernel occupancy.

Cache-Bound / L1/L2 Bound

AI between memory and compute bounds

Performance limited by cache bandwidth

Cache-to-Register Bandwidth

Optimize for data locality (tiling), manage shared memory, reduce register spilling.

Roofline At-Ceiling

AI at or near AI_balance

Performance at intersection of BW and FLOPs ceilings

Balanced System Pressure

Fine-tune for both compute and memory optimizations; system is optimally utilized.

I/O-Bound

Extremely Low AI

Performance << Memory-Bound Roofline

PCIe/NVLink/Storage Bandwidth

Overlap computation with data transfer (async), use pinned memory, batch data transfers.

ROOFLINE MODEL

Frequently Asked Questions

The Roofline Model is a foundational analytical tool for performance engineers and compiler architects. It provides a visual framework for diagnosing the fundamental bottlenecks—compute or memory—limiting application performance on modern hardware accelerators like NPUs and GPUs.

The Roofline Model is an analytical performance model that visually relates an application's arithmetic intensity (operations per byte of DRAM traffic) to its attainable performance, bounded by either peak compute throughput or memory bandwidth. It works by plotting performance (in FLOPS) on the y-axis against arithmetic intensity (in FLOPs/Byte) on a logarithmic x-axis. The model creates two distinct performance ceilings: a diagonal memory bandwidth roof, where performance is limited by how fast data can be moved, and a horizontal peak compute roof, where performance is limited by the hardware's maximum arithmetic throughput. The attainable performance for any kernel is the minimum of these two ceilings at its specific arithmetic intensity, providing an immediate visual diagnosis of whether the kernel is compute-bound or memory-bound.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.