L1 Beginner · Module 3: The performance mental model

3.1Compute-bound vs memory-bound

Every kernel is limited by something, either the arithmetic units, the memory system, or the overhead around it. Knowing which one tells you which optimizations can help and which are a waste of time.

~15 min

By the end you will be able to

  • ✓Estimate a kernel's compute time and memory time from its FLOPs and bytes
  • ✓Classify a kernel as compute-bound, memory-bound or overhead-bound
  • ✓Explain why an optimization that helps one kind of kernel does nothing for another
  • ✓Read "percent of peak" numbers to diagnose a real kernel

Module 2 showed that a GPU has two separate engines: arithmetic units that can do about 989 TFLOP/s, and a memory system that delivers about 3.35 TB/s (H100 SXM). A kernel needs both, and they work in parallel. Whichever needs more time sets the pace.

Two clocks running at once

For a kernel that does FF floating-point operations and moves QQ bytes to and from HBM:

Tcompute=FPpeakTmemory=QBT  ≳  max⁡(Tcompute, Tmemory)T_{\text{compute}} = \frac{F}{P_{\text{peak}}} \qquad T_{\text{memory}} = \frac{Q}{B} \qquad T \;\gtrsim\; \max\big(T_{\text{compute}},\, T_{\text{memory}}\big)
  • If Tmemory>TcomputeT_{\text{memory}} > T_{\text{compute}}, the kernel is memory-bound: the arithmetic units wait for data.
  • If Tcompute>TmemoryT_{\text{compute}} > T_{\text{memory}}, it is compute-bound: the data arrives faster than it can be used.

Two worked examples on an H100:

KernelFLOPsBytesTcomputeT_{\text{compute}}TmemoryT_{\text{memory}}Bound
Vector add, 10910^9 FP32 elements10910^912 GB15 µs (FP32, 67 TFLOP/s)3.6 msmemory, by 240×
Matmul, 819238192^3, BF161.1×10121.1 \times 10^{12}0.4 GB1.1 ms0.12 mscompute, by 9×

The vector add reads two numbers and writes one (12 bytes) for each single add. No amount of extra arithmetic hardware would speed it up. The matmul reuses each loaded number thousands of times, so the memory system has time to spare.

The third regime: overhead

Small operations often hit neither limit. Each kernel launch costs a few microseconds of CPU and driver work, and Python adds more. If a kernel’s real work takes 2 µs but launching it takes 5 µs, the kernel is overhead-bound, and the GPU sits idle between launches.

Why the label matters

The regime tells you which optimizations can possibly help:

If the kernel is…These helpThese do nothing
Memory-boundmoving fewer bytes: quantization, fusion, better reuse, batchingfaster arithmetic, tensor cores, FP8 math
Compute-boundtensor cores, lower-precision math, avoiding wasted FLOPscaching, compression of data
Overhead-boundCUDA Graphs, fusing kernels, bigger batches, less Pythonanything inside the kernel

Diagnosing a real kernel

Profilers report a kernel’s achieved FLOP/s and achieved bandwidth, often as a percentage of peak (Nsight Compute calls this “Speed of Light”, 7.2). Read them together:

  • High % of memory bandwidth, low % of compute: memory-bound and already efficient. Reduce bytes.
  • High % of compute, low % of bandwidth: compute-bound. Use better math (tensor cores, lower precision).
  • Low on both: neither limit is reached. Look for overhead, poor occupancy (2.5), or a bad access pattern.

Sources

Check your understanding

0 / 4 answered
  1. 1.A kernel does 10 GFLOP and moves 10 GB on an H100 (989 TFLOP/s, 3.35 TB/s). What limits it?

  2. 2.Which optimization helps a memory-bound kernel?

  3. 3.What does "overhead-bound" mean?

  4. 4.A profiler shows 15% of peak bandwidth and 10% of peak compute. What should you suspect first?