CPU, GPU AND RAM

GPU roofline analysis: counting work per byte moved

In this article
THE QUICK TAKE

GPU arithmetic intensity must name the memory boundary and useful operation count; a roofline is a constraint model rather than an automatic performance forecast.

Roofline reasoning connects an operation’s arithmetic work with the data movement needed to supply it. Arithmetic intensity is the ratio between those quantities at a stated memory boundary. It helps ask whether optimization should first reduce traffic or improve use of arithmetic resources, provided that the boundary and work definition are explicit.

Define the denominator before dividing

Traffic at external memory differs from traffic served by an on-chip cache. An intensity computed using one boundary should be compared with a bandwidth ceiling for that same boundary. Allocation size is not necessarily transferred bytes, especially when a kernel reuses data or reads it repeatedly. State whether the count describes mathematical minimum traffic or observed movement. Those are useful but different ways to characterize an implementation.

Primary reference: Nsight Compute Profiling Guide.

A reused matrix changes intensity

Imagine multiplying many input vectors by the same weight tile. Loading the tile once and reusing it increases useful arithmetic per transferred byte compared with repeatedly fetching it. The tile still requires storage and coordination, which can create other constraints. Roofline reasoning explains why reuse is promising; it does not establish that a particular tile implementation realizes the minimum traffic or reaches the arithmetic ceiling.

Primary reference: CUDA C++ Best Practices Guide.

The arithmetic ceiling needs a matching operation

A device has different execution capabilities for different formats and instruction families. Comparing a general scalar kernel with a tensor-operation peak can assign it an unreachable ceiling. Padding and conversion work also need an honest accounting: issued arithmetic is not always useful mathematical work. Choose the operation definition that matches the question, and retain the numerical acceptance criteria when comparing formats or instruction paths.

Primary reference: CUDA Programming Guide: Writing SIMT Kernels.

A point below the roof needs explanation

A kernel can sit below both simple ceilings because of dependencies, insufficient parallelism, synchronization or an unfavorable memory access pattern. The roofline does not identify the cause by itself. Combine it with launch and instruction evidence. A low-intensity classification can motivate a traffic experiment, while a large gap beneath the bound asks whether the expected bandwidth is available under the actual access pattern and concurrency.

Use the model to prioritize a change

For the reused-weight example, compare a traffic-reduction design with a purely arithmetic rewrite. Keep useful output and input shapes fixed, then record the chosen boundary, observed bytes and completion. If traffic falls without a timing gain, another constraint may have become dominant. That is information for the next experiment. The value of the roofline is a clear, falsifiable explanation of limits, not a label that permanently assigns a workload to one category.

Related reading: A GPU inference benchmark you can trust; Reproducible inference stacks: preserving a GPU pilot’s result.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles