core24 min studyLesson 454 in Engineering

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

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.

O=WresidentWsupported,X=NusefulTO=\frac{W_{\rm resident}}{W_{\rm supported}},\qquad X=\frac{N_{\rm useful}}{T}
O is a dimensionless occupancy fraction for a defined SM configuration; X is useful items per second when T is elapsed seconds. The two ratios have different numerators, denominators, and purposes.↔ Scroll wide equations horizontally.

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.

P≤min⁡(Pmax⁡,BI)P\leq\min(P_{\max},BI)
P and P_max use the same operation-per-second units, B is bytes per second, and I is operations per byte at the chosen memory boundary. This is an idealized ceiling, not a guarantee of achieved throughput or a rule tying P to occupancy.↔ Scroll wide equations horizontally.

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.

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.

  1. 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.

  2. 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.

  3. 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 result

The relevant result is faster correct work. Occupancy helps explain a resource situation but cannot replace the timed throughput comparison.

Explore the model

Interactive lab

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.

An explicit synthetic bottleneck ceilingSynthetic 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. Current readings: Attainable ceiling: 640 GFLOP/s; Ridge intensity: 12.5 FLOP/byte; Ceiling regime: Memory-bound ceiling. All parameters are adjustable with the labeled controls below.Hypothetical roofline upper bound: 640 GFLOP per second at operational intensity 8 FLOP per byte and bandwidth 80 gigabytes per second.0.1110641101001000Operational intensity · FLOP/byte · log scaleCeiling · GFLOP/s · log scalePeak: 1000
Attainable ceiling / kernelBandwidth roof / traceCompute ceiling
Attainable ceiling
640 GFLOP/s
Ridge intensity
12.5 FLOP/byte
Ceiling regime
Memory-bound ceiling
t = 0 s

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.

Check your understanding

A correct rewrite lowers occupancy and also lowers measured runtime. What should you do?

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.

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.