Skip to content

feat(perf-integrity): add calibrated cold-cache sweep, rotating buffers, and versioned input recipes (ALMIOPEN-3437) - #143

Open
SamuelReeder wants to merge 1 commit into
users/sareeder/perf-integrity-fixesfrom
users/sareeder/perf-integrity
Open

SamuelReeder wants to merge 1 commit into
users/sareeder/perf-integrity-fixesfrom
users/sareeder/perf-integrity

Conversation

@SamuelReeder

@SamuelReeder SamuelReeder commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Stack

  1. fix(perf-integrity): unify timing modes, compare gates, runtime guards, and telemetry #149 (users/sareeder/perf-integrity-fixes → main): Performance-integrity bug fixes (timing unification, compare gates, runtime guards, telemetry, analytical v2, DVC setup)
  2. feat(perf-integrity): add calibrated cold-cache sweep, rotating buffers, and versioned input recipes (ALMIOPEN-3437) #143 (this PR, users/sareeder/perf-integrity → users/sareeder/perf-integrity-fixes): ALMIOPEN-3437 — Calibrated cold-cache sweep, VRAM-safe rotating buffers, and versioned input recipes
  3. feat(knobs): add strict --knob validation, --sweep-knobs, and --knob-candidates #150 (users/sareeder/knob-sweeps → users/sareeder/perf-integrity): Strict --knob validation, --sweep-knobs, and --knob-candidates

Summary

Completes the ALMIOPEN-3437 deliverables on top of #149:

  • Calibrated read-only cold-cache sweep (timing.py): Replaces cold-cache zero-fill with a coalesced read-only capacity sweep (hiprtc uint4 kernel on HIP, torch.sum on Torch, with truthful zero_fill fallback) sized per GPU (gfx90a: 24 MiB, gfx942/gfx950: 640 MiB, unlisted GPUs: 3 × L2_cache_size clamped to 4 MiB..1 GiB, fallback: 512 MiB).
  • VRAM-safe rotating buffers (--cache-mode rotate, --rotate-buffers N): Cycles N independent I/O buffer sets across launches across all four runtimes (hipdnn, pytorch, rocke, aiter) and hipDNN --oracle children, compatible with --timing-block N. Auto-sized from the active GPU's eviction target and capped at 60% of free VRAM (query_free_vram_bytes), clamping with a warning or failing fast before OOM; primes PyTorch ring sets 1..N-1 before measure() and uses single-prepare() ring binding on AITER and rocKE. Records run.config.rotate_buffers and timing.{flush_method,flush_bytes,rotated_buffers}.
  • Versioned input recipes (--input-recipe {centered,llm,heavy_tail,legacy,zeros}, default centered): Records run.config.input_recipe, run.config.input_recipe_version, and per-graph 12-hex graph.input_fingerprint, forwards --input-recipe to oracle and profiling children, and gates dnn-benchmark compare on input_recipe (treating missing keys in older schema 2/3 files as "legacy").
    • Why centered (zero-mean, dense) replaces U[0, 1) as the default: Zero-mean N(0, 1) is dense and nonzero (< 0.1% round to 0.0 in fp16/bf16; it does not introduce sparsity or zero-skipping shortcuts — --input-recipe zeros is separate and diagnostic-only). Real model weights, LayerNorm/RMSNorm outputs, residuals, GELU/SiLU inputs, and SDPA Q/K are approximately zero-mean signed. By contrast, all-positive U[0, 1) locks sign bits to 0 and compresses exponents into [0.125, 1.0) (lowering MFMA/VALU switching power), collapses SDPA QK^T softmax weights toward uniform, turns ReLU into a 100% pass-through, and hides sign bugs. Under centered, unconstrained operands and SDPA Q/K draw from N(0, 1), fp16/bf16 conv operands draw from U[-1, 1), SDPA V and fp32/fp64 conv operands stay in U[0, 1) to avoid near-zero cancellation false failures, and strictly positive inputs (norm variances, inv_rms, scales, epsilons, dropout scale) draw from U[0.5, 1.5). Use --input-recipe llm or heavy_tail for heavy-tailed activation/outlier studies and --input-recipe legacy for apples-to-apples comparisons against pre-PR runs.

Risk Assessment

Risk Level: 4 / 5 — Changes default input generation (centered), default cold-cache eviction (read_sweep), and adds --cache-mode rotate across 30 files.

Related

  • ALMIOPEN-3437: Cold-cache de-warming (read-only sweep + VRAM-safe rotating buffers) and realistic versioned input-value recipes (centered default). End-to-end verification in this PR ran on gfx90a; the gfx90a/gfx942/gfx950 method comparison measurements live in the ALMIOPEN-3437 ticket research comments, so gfx942/gfx950 CI verification of these defaults is provisional until the gfx950 CI lane runs.

Device / Architecture Coverage

  • gfx90a (MI210, local): Verified centered bf16 SDPA (PyTorch flash/efficient vs MATH: 0 mismatches), batchnorm variance (2 passed), cold read_sweep (24 MiB), auto-sized VRAM-aware rotate (rotated_buffers=48, 24.42 MiB on sample_conv_fwd), PyTorch rotate on scalar-epsilon graphs and with --pytorch-dispatch, and hipDNN --oracle --cache-mode rotate (1.71x).
  • gfx942: Calibrated 640 MiB sweep size from ALMIOPEN-3437 measurements; not re-executed on hardware in this PR.
  • gfx950: Calibrated 640 MiB sweep size from ALMIOPEN-3437 measurements; hipDNN/AITER SDPA validation requires the gpu-tests (gfx950, full suite) CI lane.

Testing Summary

  • black --check (25.12.0): passed on all 40 modified/added Python files.
  • CPU unit tests (PYTHONPATH=src .workspace/.venv/bin/python -m pytest tests/unit -m "not gpu" -q): 2,297 passed, 1 skipped, 0 failed.

Testing Checklist

  • black --check (25.12.0) on all modified/added Python files
  • Full CPU unit suite (2,297 passed, 1 skipped)
  • MI210 (gfx90a) targeted GPU checks (centered bf16 SDPA, batchnorm variance, cold read_sweep, VRAM-aware rotate, hipDNN --oracle rotate, PyTorch --pytorch-dispatch + rotate)
  • gpu-tests (gfx950, full suite) CI lane (hipDNN/AITER SDPA validation on gfx950)

@SamuelReeder
SamuelReeder requested a review from a team as a code owner November 23, 2026 18:15
@SamuelReeder
SamuelReeder force-pushed the users/sareeder/perf-integrity branch from 1ef0cf1 to 53d16db Compare November 24, 2026 18:17
…rs, and versioned input recipes (ALMIOPEN-3437)
@SamuelReeder
SamuelReeder force-pushed the users/sareeder/perf-integrity branch from 53d16db to 526acf8 Compare November 24, 2026 19:06
@SamuelReeder SamuelReeder changed the title feat(perf-integrity): unify timing, cache de-warming, input recipes, and knob sweeps (ALMIOPEN-3437) feat(perf-integrity): add calibrated cold-cache sweep, rotating buffers, and versioned input recipes (ALMIOPEN-3437) Nov 24, 2026
@SamuelReeder
SamuelReeder changed the base branch from main to users/sareeder/perf-integrity-fixes November 24, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant