Unit 4 of 12 · about 4 hours · measure

Interleaved trials, raw samples and uncertainty

A best timing hides drift and noise. Paired trials make a comparison less dependent on which variant happened to run first.

You'll be able to

  • Collect paired, interleaved trials with reproducible randomized order and raw samples.
  • Report medians, supported tails and uncertainty without treating launches within a batch as independent trials.
  • Separate statistical evidence from a practically worthwhile improvement.

Covers

Interleaved variants, randomized order and raw repeated trialsMedian, tail, variance, uncertainty and practical significance
1

Read

In this order, only the parts listed

0 of 2 done

  1. Harness noise and repeated-trial requirementsGPU Microbenchmark and Kernel Suite - Harness and Instrumentation

    Core requirements, harness item; Milestone B - Instrumentation, noise and observer overhead; Milestone E - Measurement / optimization, interleaved raw trials; Measurement requirements

  2. CS336: repeated timing summaryCS336 Assignment 2 - Section 2.1 Profiling

    Section 2.1.3, Problem (benchmarking_script), part (b), p. 4

    Use its mean and standard deviation as an initial summary. Ten steps do not establish a reliable p99 or confidence interval under time-correlated drift.

2

Focus on

  • Make a trial pair use identical inputs and timing boundaries. Randomize the order within each pair with a recorded seed and preserve timestamps.
  • Report the estimand: ratio of medians and median paired ratio are different statistics. Keep raw times, not just speedups.
  • Resample whole pairs for paired uncertainty. If adjacent pairs drift together, use blocks or repeated sessions rather than an independent-sample bootstrap.
  • State sample count, percentile convention and a minimum useful gain before inspecting results. Tail estimates need many independent observations, not many launches inside one interval.
Common mistakes · 3
  • Running all baseline trials before all candidate trials and confounding the variant with clock drift.
  • Treating 1,000 launches in one event interval as 1,000 independent latency samples.
  • Reporting a confidence interval without its resampling unit or treating a tiny statistically resolved gain as automatically useful.
3

Try it yourself

Closed-book, before checking anything

Using synthetic paired latencies in milliseconds, baseline [10, 20, 30] and candidate [5, 10, 15], compute both medians and each paired speedup. Both summaries give a speedup of 2. Explain why resampling these perfectly proportional pairs can produce zero spread without proving a noise-free hardware result. Then compute the same summaries on retained interleaved GPU samples.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.Why randomize within a pair rather than always run baseline first?Answer

    It reduces systematic order effects. Pairing limits slow drift, but randomization does not eliminate carryover or all interference.

  2. 2.What is lost when only medians are retained?Answer

    Tails, outliers, order effects and information needed to recompute uncertainty or change the summary.

  3. 3.Does a p99 computed from ten trials give strong tail evidence?Answer

    No. It is effectively an estimate near the sample maximum, with very poor information about rare slow events.

You're done when

Your report can be regenerated from raw paired trials and states the summary statistic, uncertainty method, dependence limits and minimum practically useful gain.

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.