Unit 12 of 12 · about 4 hours · measure

End-to-end translation, regressions and cross-device reproducibility

A local kernel improvement may disappear under dispatch, transfers or unchanged work. Integration and retained regressions determine whether the change is useful.

You'll be able to

  • Predict maximum end-to-end gain from measured kernel share, speedup and added overhead.
  • Evaluate the same mechanism over a declared shape/dtype distribution and retain losing regimes.
  • Produce a reproducible device-specific result and distinguish a second-device experiment from a portability claim.

Covers

Kernel speedup, dispatch cost and end-to-end translationPerformance regressions and retained no-benefit regimesCross-device and cross-generation reproducibility
1

Read

In this order, only the parts listed

0 of 2 done

  1. Integration, negative regimes and reproducibilityGPU Microbenchmark and Kernel Suite - Harness and Instrumentation

    Architecture constraints; Hardware variants; Milestone B - Instrumentation; Measurement requirements; Design-defense questions 5 and 6; Rubric, Measurement and Reproducibility

    Use the harness and reporting requirements here. The complete kernel suite and final design defense belong to later sections. A second device is optional; do not simulate timings and call them measured portability.

  2. Where model time goes before optimizationCS336 Assignment 2 - Section 2.1 Profiling

    Section 2.1, Profiling, opening motivation; section 2.1.4, Problem (nsys_profile), parts (a), (b), (d) and (e), p. 6

2

Focus on

  • For baseline time , replaceable critical-path share , local speedup and added non-overlapped overhead , predict . This assumes unchanged remaining work and dependencies; cumulative overlapping kernel time is not a valid share.
  • Measure both isolated kernel time and completed invocation time, including validation of shape/dtype/device guards and any layout conversion, dispatch or synchronization required in deployment.
  • Declare workload weights and summarize total weighted time, not an unweighted average of speedups. Retain tiny, strided, edge and cold-start cases where the candidate loses.
  • A second GPU of the same generation tests another device, not another compute-capability generation. Rebuild, capture its environment and recompute models; with one device, limit the claim to that device and list portability checks not performed.
Common mistakes · 3
  • Using the sum of overlapping kernel durations as a fraction of wall time and applying a serial Amdahl model to it.
  • Publishing only shapes used for tuning, or dropping no-benefit and slower regimes from the report.
  • Calling the same compute capability a guarantee of identical performance, supported features or library dispatch.
3

Try it yourself

Closed-book, before checking anything

For a synthetic serial workload taking 100 ms, with a replaceable 40 ms kernel accelerated by a factor of 2 and no added overhead, derive 80 ms total time and a speedup of 1.25. Adding 5 ms of dispatch/conversion gives 85 ms and a speedup of about 1.176. Then apply the formula to a retained trace using critical-path share, measure completed invocation latency across your shape matrix, and explain the residual without fitting the share after seeing the answer.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.If only 40% of serial runtime is replaceable, what is the ideal speedup limit with zero overhead?Answer

    As local speedup tends to infinity, the limit is , about 1.667. The unchanged 60% remains.

  2. 2.Why might a twice-as-fast kernel make an operator slower?Answer

    Dispatch, conversion, extra allocation or synchronization can cost more than the saved kernel time, especially for small shapes.

  3. 3.Does passing correctness on two Ampere devices prove cross-generation portability?Answer

    No. It checks those devices and configurations. Other generations, compilers and feature paths need their own compatibility and measurement evidence.

  4. 4.Why retain a shape where the candidate loses?Answer

    It constrains the claim and exposes where a fallback or different dispatch choice is needed. It also protects against a misleading aggregate win.

You're done when

Your report compares predicted and measured completed invocation gain over a declared workload matrix, retains a no-benefit or losing case, and states exactly which device/version paths were checked.

Only when you can do this without notes.

Leads to

Notes

Resources · 2 for this unit, 10 more in the section
  • 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.

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

Also in this 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 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.

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

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

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

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