Unit 11 of 12 · about 4 hours · measure

Warp stalls, resource evidence and bottleneck classification

A stall name describes a warp state, not necessarily the critical path. A bottleneck claim needs converging evidence and an experiment that could disprove it.

You'll be able to

  • Predict launch-, memory- and compute-sensitive regimes before collecting profiles.
  • Combine scheduler, memory, pipeline and resource evidence rather than diagnosing from one stall percentage.
  • Distinguish bandwidth saturation from latency, occupancy, synchronization, transfer and host limits.

Covers

Warp stalls, occupancy, register pressure and resource evidenceLaunch, memory, compute, resource, synchronization, transfer and host bottlenecks
1

Read

In this order, only the parts listed

0 of 3 done

  1. Resource and bottleneck reasoningAI Systems Performance Engineering - Chapters 6 to 8

    Chapter 8, Analyzing Warp Stall Reasons with Nsight Compute; Inspecting Achieved Occupancy and GPU Utilization; Iteratively Profiling and Determining the Kernel Bottleneck; Profiling and Mitigating Register Pressure

    Do not use the Memory-Related Stalls paragraph's definition of Not Selected as waiting for memory transaction slots. It is incorrect; use NVIDIA's Warp Stall Reasons table. Do not infer bandwidth saturation from a large scoreboard percentage alone.

  2. Nsight Compute 2026.3.1: scheduler states and section evidenceNsight Compute Profiling Guide

    Section 2.2.2, Sections and Rules: SchedulerStats, WarpStateStats, SourceCounters, Occupancy, MemoryWorkloadAnalysis and ComputeWorkloadAnalysis; section 2.4.7, Warp Stall Reasons

    Read the long-scoreboard, short-scoreboard, not-selected, barrier and math-pipe-throttle entries. Check availability and definitions on the target architecture before collecting them.

  3. Occupancy API and static-resource exampleAI Systems Performance Engineering companion code - Chapters 6 to 8

    Commit b57e4c6: exampleKernel; main from cudaOccupancyMaxPotentialBlockSize through theoretical occupancy calculation

    Read the resource-query sequence, not its first-ten-elements check as a complete correctness suite. Recompute device limits for Ampere and use ceiling division for warps when a block size is not a multiple of 32.

2

Focus on

  • Use the timeline first for host gaps, launch supply, transfers and dependencies. Low compute and memory throughput can reflect little work rather than a faulty kernel.
  • A long scoreboard indicates a dependency on L1TEX work, not proof of DRAM saturation. Not Selected means an eligible warp lost selection to another warp; it can accompany healthy latency hiding.
  • Inspect SchedulerStats issue activity before chasing stalls. Corroborate with MemoryWorkloadAnalysis, ComputeWorkloadAnalysis, resource reports and a controlled size or block-size sweep.
  • Use ptxas register/spill reports and occupancy API limits as static evidence. Theoretical residency is not measured achieved occupancy or throughput; reducing registers can cause spills and make execution slower.
Common mistakes · 3
  • Treating high theoretical occupancy as the goal instead of measuring latency and spill costs.
  • Calling every long-scoreboard stall DRAM traffic; local spills and cache-served loads can also create dependencies.
  • Inferring a universal bottleneck from one small shape or a stall percentage averaged over different source regions.
3

Try it yourself

Closed-book, before checking anything

Before running, classify a tiny copy, a streaming copy larger than L2, and a matrix-multiply size sweep as candidate launch-, memory- and compute-sensitive regimes. For each, write one falsifier. Collect interleaved event timings, a timeline and static launch/resource evidence; add the relevant minimal counter sections where permitted. Report confirmed, contradicted or unresolved hypotheses rather than forcing all three labels when the evidence is incomplete.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Why can many Not Selected warps be harmless?Answer

    They are eligible to issue, but another warp issued that cycle. The scheduler may be productive; this is not itself a memory dependency.

  2. 2.What distinguishes memory latency from saturated DRAM bandwidth?Answer

    Latency-limited work can wait on dependencies while transferring well below sustainable bandwidth. Saturation requires evidence of high actual traffic throughput, not merely waiting warps.

  3. 3.Can the occupancy API establish achieved occupancy?Answer

    No. It predicts resource-limited residency. Runtime work distribution, tails and stalls require execution evidence.

  4. 4.How can you test a launch-overhead hypothesis without counters?Answer

    Use a short timeline and size/batch sweeps. Look for launch-supply gaps and near-flat small-work latency, while keeping completed timing boundaries consistent.

You're done when

Each of your three regime reports links a predeclared hypothesis to a model, timing, timeline and resource evidence, and clearly separates confirmed conclusions from blocked counter checks.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 9 more in the section
  • AI Systems Performance Engineering - Chapters 6 to 8Chris Fregly · primary

    Read Chapters 6 to 8: GPU architecture and occupancy, profiling and tuning memory access, and occupancy, warp efficiency and instruction-level parallelism, with their Nsight Systems, Nsight Compute and roofline workflows. Treat every quoted speedup as a hypothesis for your own hardware.

  • AI Systems Performance Engineering companion code - Chapters 6 to 8Chris Fregly · required

    Use selected baseline and optimized pairs from code/ch06, code/ch07 and code/ch08 plus the shared benchmark and verification machinery. Run only hardware-compatible paths, inspect the tests first, retain raw artifacts and document any guard or unavailable feature.

  • Nsight Compute Profiling GuideNVIDIA · required

    Study the profiling model, replay, metric collection, sections, roofline and source correlation. Collect the smallest counter set that can falsify your bottleneck hypothesis and record profiler overhead.

Also in this section

  • Nsight Systems User GuideNVIDIA · required

    Learn capture, statistics, CUDA API and GPU timeline views, NVTX ranges and report export. Produce one trace that attributes a host gap, transfer or synchronization cost without using the kernel profiler first.

  • Compute SanitizerNVIDIA · required

    Run memcheck plus applicable racecheck, initcheck and synccheck cases against seeded defects. Preserve minimal reproducers and regression tests, and distinguish unsupported checks from a clean result.

  • Roofline: An Insightful Visual Performance ModelUC Berkeley · required

    Read the original model and construct one roofline plot with explicit peak assumptions, useful operations and bytes. Add measured points and explain gaps from launch, resource, cache or instruction effects.

  • CUTLASS GEMM Performance Measurement MethodologyNVIDIA · support

    Apply the environment, clock, warmup, timing, verification and reporting guidance to the benchmark harness. Generalize the method beyond GEMM and document every intentional deviation.

  • CS336 Assignment 2 - Section 2.1 ProfilingStanford University · support

    Do the benchmarking_script, nsys_profile, mixed_precision_accumulation and memory_profiling problems on a model size that fits your GPU instead of the handout's B200 settings. Keep raw timings, traces and memory snapshots.

  • TensorTonic Language Modeling from Scratch - Measure Kernel Timeline UtilizationTensorTonic · support

    Solve the timeline-utilization problem after the timeline unit, then repeat the calculation on a trace you captured yourself.

  • GPU Microbenchmark and Kernel Suite - Harness and InstrumentationRoadmap-Final · support

    Complete Milestones A and B: correct references, synchronized timing, raw samples, noise characterization, environment capture, operation and byte models, timeline traces and profiler evidence.

  • PyTorch 2.14 numerical accuracy and tensor testingPyTorch · reference

    Read the numerical-accuracy introduction, Extremal values, non-finite inputs and Ampere precision sections, plus the assert_close contract and make_tensor parameters. These supply current comparison semantics missing from the pool's project checklist.

  • CUDA 13.4 Floating Point and IEEE 754NVIDIA · reference

    Read sections 2.2, 3.1 to 3.2 and 4.4 for reduction order and single-precision flush-to-zero flags. Do not use the historical CPU-has-no-FMA statements as current hardware facts.