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.
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 floating-point operations and moves bytes to and from HBM:
- If , the kernel is memory-bound: the arithmetic units wait for data.
- If , it is compute-bound: the data arrives faster than it can be used.
Two worked examples on an H100:
| Kernel | FLOPs | Bytes | Bound | ||
|---|---|---|---|---|---|
| Vector add, FP32 elements | 12 GB | 15 µs (FP32, 67 TFLOP/s) | 3.6 ms | memory, by 240× | |
| Matmul, , BF16 | 0.4 GB | 1.1 ms | 0.12 ms | compute, 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 help | These do nothing |
|---|---|---|
| Memory-bound | moving fewer bytes: quantization, fusion, better reuse, batching | faster arithmetic, tensor cores, FP8 math |
| Compute-bound | tensor cores, lower-precision math, avoiding wasted FLOPs | caching, compression of data |
| Overhead-bound | CUDA Graphs, fusing kernels, bigger batches, less Python | anything 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 answered1.A kernel does 10 GFLOP and moves 10 GB on an H100 (989 TFLOP/s, 3.35 TB/s). What limits it?
2.Which optimization helps a memory-bound kernel?
3.What does "overhead-bound" mean?
4.A profiler shows 15% of peak bandwidth and 10% of peak compute. What should you suspect first?