Comparing Architecture Families Fairly › Hardware Efficiency: The Roofline View

Michael BrenndoerferNovember 17, 20263 min read
Language AI HandbookAll chapters
Part 19 of 67Alternative Sequence and Generative Architectures
Chapter 138Comparing Architecture Families Fairly › Hardware Efficiency: The Roofline View
Reading section 7 of 16 · Hardware Efficiency: The Roofline View · 3 minSection 7 of 16 · 3 min

Section 7 of 16 · 3 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Arithmetic intensity is FLOPs performed per byte moved. It helps identify which idealized hardware ceiling is tighter.

Every accelerator has a ridge point: the intensity at which it stops being bandwidth-bound and becomes compute-bound. That ridge point is

Iridge=peak FLOP/speak bytes/sI_{\text{ridge}} = \frac{\text{peak FLOP/s}}{\text{peak bytes/s}}

where:

  • IridgeI_{\text{ridge}}: the arithmetic intensity at which an accelerator stops being bandwidth-bound and becomes compute-bound, in FLOP/byte
  • peak FLOP/s: the accelerator's peak floating-point throughput
  • peak bytes/s: the accelerator's peak memory bandwidth

For the NVIDIA H100 SXM, using the dense BF16 rate of about 9.89×10149.89\times10^{14} FLOP/s and the listed bandwidth of 3.35×10123.35\times10^{12} bytes/s puts the ideal ridge near 295 FLOP/byte. In a weight-streaming approximation, a 7B BF16 model performs about 14 billion multiply-add FLOPs and reads about 14 GB of weights for one token. This weight-only estimate is about 1 FLOP/byte. Actual decode also moves persistent state and other tensors, and feasible batching can amortize weight reads.

Per-sequence resident memory limits the batch that fits on a device. Memory traffic per step affects latency and throughput. In an illustrative 50 GB state budget, a 100 MB state fits 500 sequences and a 20 GB state fits two before any other per-sequence overhead.

The roofline model is an upper bound. Arithmetic intensity helps identify which ceiling is tighter under its assumptions. Measure time separately to see how closely a kernel approaches that ceiling.

The diagonal gives the bandwidth ceiling and the plateau gives the compute ceiling. They meet at the ridge. The lower of the two sets the ideal performance bound.

PythonIn [7]
CollapseExpand
import numpy as np

roofline_intensity = np.logspace(-1.0, 4.0, 300)
peak_tflops = 9.89e14 / 1e12
ridge_intensity = 9.89e14 / 3.35e12
bandwidth_tflops = roofline_intensity * 3.35e12 / 1e12
roofline_throughput = np.minimum(peak_tflops, bandwidth_tflops)
VisualizationOut [8]
CollapseExpand
Roofline chart of throughput versus arithmetic intensity with ridge near 295 FLOP per byte.
Ideal H100 SXM BF16 roofline. The ascending region is bandwidth-limited and the plateau is compute-limited. The ridge is near 295 FLOP/byte. A batch-one weight-streaming estimate of about 1 FLOP/byte falls on the bandwidth-limited side. Actual decode can also move caches and other tensors.

When you report a throughput comparison, report it at a stated batch, a stated context, and a stated roofline position. Otherwise the reader cannot tell whether they are looking at an architecture property or a memory-bandwidth ceiling.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy