Occupancy: a latency-hiding tool, not the performance score
Separate resident warp fractions from ready work, memory traffic, arithmetic intensity, and measured application throughput.
On this page
The question for today
What you’ll understand
- Compute theoretical occupancy from resident and maximum warps.
- Explain why lower occupancy can accompany faster execution.
- Use a synthetic roofline ceiling without mistaking it for a device benchmark.
Occupancy compares resident warps with a device’s supported resident-warp capacity. More resident work can help hide latency when one warp waits and another is ready, but those extra warps may not perform useful work or remove the real bottleneck. A kernel can become faster while occupancy falls because it reuses data, executes fewer instructions, or avoids spills. Optimize the measured task, using occupancy to explain constraints rather than as a score to maximize blindly.
Resident does not mean ready or productive
A resident warp has its context allocated on an SM. It may wait for a dependency, memory, or synchronization. If every resident warp waits on the same limiting resource, adding more can fail to improve throughput. Conversely, a smaller set of warps with sufficient instruction-level parallelism may keep the relevant execution units busy. The required amount of latency-hiding work depends on architecture, instruction mix, memory behavior, and the number of independent operations available within each warp.
Theoretical occupancy describes a resource-based upper configuration, while achieved occupancy summarizes observed active residency over a defined measurement interval. Neither directly measures useful elements completed per second. Tail effects, uneven block work, divergent paths, and memory transactions can reduce effectiveness even with attractive occupancy. Read each profiler metric’s definition and averaging scope. Do not compare a per-SM theoretical fraction with an application-wide average as if they were the same observation.
Data movement can dominate arithmetic capacity
Arithmetic intensity counts operations relative to bytes moved through the selected bottleneck. Reusing data can increase intensity and reduce traffic, even if shared-memory use lowers residency. A roofline model compares a compute ceiling with a bandwidth ceiling. The model needs a defined operation type and data-movement boundary; peak tensor throughput cannot be substituted for scalar arithmetic throughput without justification. Real performance can lie far below both ceilings because the model omits dependencies, synchronization, and inefficient access.
Register pressure creates another tradeoff. Forcing extra resident warps by restricting registers can introduce spills, which consume instructions and memory bandwidth. A larger per-thread working set can sometimes lower occupancy but avoid repeated loading. Validate numerical results when changing algorithms or instruction forms, then compare kernel time and application time under the same workload. If a kernel is only a small part of end-to-end latency, a local improvement can have limited user-visible effect.
Measure a hypothesis rather than chase a percentage
A useful tuning hypothesis names the bottleneck and expected mechanism: fewer transferred bytes, shorter dependent path, less divergent work, or improved residency without excessive spill cost. Record both the resource change and the timing change. Use representative shapes and batch sizes, include warmup where steady state matters, and report variability. A larger launch that improves one large batch can regress small workloads dominated by launch overhead. The final decision should reflect the workload the system actually serves.
The roofline lab has a fixed synthetic compute peak of 1,000 GFLOP/s. Reset, set operational intensity I=4 FLOP/byte and bandwidth B=80 GB/s, predict a 320 GFLOP/s ceiling, then Play or Step. Reset and set I=16 and B=80 to predict the 1,000 ceiling. Playback traces the roof without changing the selected kernel parameters. None of these numbers describes an NVIDIA product or measured occupancy. They isolate how a bottleneck ceiling changes when intensity improves.
Work it through
Lower occupancy, higher useful throughput
Two correct kernels process eight million items on the same fictional device with a 64-warp-per-SM limit. Kernel A has 48 resident warps and takes 0.20 seconds; B has 32 and takes 0.15 seconds on the controlled workload.
A’s occupancy is 48/64=75 percent and B’s is 32/64=50 percent. This is the declared residency model, separate from any profiler’s achieved-occupancy averaging.
Useful throughput is 8 million/0.20=40 million items/s for A and approximately 53.33 million items/s for B. B’s speedup is 0.20/0.15≈1.33.
B is faster despite lower occupancy. The measurements do not identify why; inspect traffic, instructions, dependencies, and spills before claiming a cause. The time reduction is 25 percent, which differs from the approximately 33.3 percent throughput increase.
The relevant result is faster correct work. Occupancy helps explain a resource situation but cannot replace the timed throughput comparison.
The living notebook
Explore the model
Interactive lab · roofline
An explicit synthetic bottleneck ceiling
Reset, set I=4 FLOP/byte and B=80 GB/s, predict 320 GFLOP/s, then Play or Step. Reset and set I=16 and B=80 to predict 1,000. The fixed 1,000 GFLOP/s peak is synthetic; the lab neither measures occupancy nor represents an NVIDIA GPU specification.
- Attainable ceiling
- 640 GFLOP/s
- Ridge intensity
- 12.5 FLOP/byte
- Ceiling regime
- Memory-bound ceiling
Synthetic roofline ceiling min(1000, B·I), in GFLOP/s, with B in decimal GB/s and I in FLOP/byte. Playback traces the roof without changing the selected kernel. This upper-bound model is not a measured throughput prediction, hardware comparison or price model. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forIncreasing data reuse can shift a ceiling, while measured kernel performance still needs real evidence.
Pause & reason
Check your understanding
Your turn
Try it yourself
A synthetic roofline uses Pmax=1,000 GFLOP/s, B=50 GB/s, and I=10 FLOP/byte. Compute the ceiling. Does raising occupancy alone change this formula?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Multiply bandwidth by intensity with decimal units, then apply the compute limit.
Compare with the solution
The bandwidth ceiling is 50×10=500 GFLOP/s, so the model ceiling is 500. Occupancy is not an input to this simplified roofline. It can affect how closely a real kernel approaches a ceiling, but increasing it does not automatically change B, I, or the operation-specific compute peak.
Keep the idea
Take it with you
- Occupancy measures residency rather than useful completed work.
- Reuse, dependencies, divergence, and spills can outweigh a larger warp count.
- Synthetic roofline ceilings and measured throughput must be reported separately.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.