Skip to content

Add --profile to the W4A16 perf test for external profiler captures - #1068

Merged
mgehre-amd merged 2 commits into
gfx11from
matthias.w4a16-perf-test-profile-flag
Jul 29, 2026
Merged

Add --profile to the W4A16 perf test for external profiler captures#1068
mgehre-amd merged 2 commits into
gfx11from
matthias.w4a16-perf-test-profile-flag

Conversation

@mgehre-amd

@mgehre-amd mgehre-amd commented Jul 29, 2026

Copy link
Copy Markdown

Problem

Capturing a single kernel dispatch with rocprofv3 --att was impractical against this test.
Two things got in the way:

  • the session-scoped _warm_up_gpu fixture sweeps sorted(SHAPES)[0] across all 13 batch sizes
  • do_bench issues hundreds of launches per measurement

A capture therefore contained thousands of dispatches, overflowed the ATT buffer
(Wave incomplete: The trace was cutoff before all waves ended), and decoded to traces
dominated by warm-up kernels of an unrelated shape. Concretely, a first attempt at capturing
gemma-4-31B gate_up produced two decoded dispatches of a g=128 warm-up shape plus a
118 MB __amd_rocclr_copyBuffer — and none of the kernel actually under study.

Change

--profile makes the run capture-shaped:

  • skips the GPU warm-up pass
  • one warmup + one measured launch. do_bench derives its iteration counts as
    max(1, int(budget_ms / estimate_ms)), so a zero budget clamps both to 1
  • implies --eager, since graph-captured kernels are invisible to per-dispatch profilers

Single-shape runtime drops ~7 s -> ~3.1 s, and a capture contains one dispatch of the target
kernel.

pytest tests/kernels/quantization/test_hybrid_w4a16_perf.py -q -s --profile \
  -k "i5376-o43008-g32-hybrid-w4a16-zp and not bf16"

Signed-off-by: Matthias Gehre <matthias.gehre@amd.com>
Capturing a single kernel dispatch with rocprofv3 ATT was impractical.
Two things got in the way: the session-scoped GPU warm-up fixture sweeps
a different shape across all 13 batch sizes, and do_bench issues hundreds
of launches per measurement. A capture then contains thousands of
dispatches, the ATT buffer overflows ("Wave incomplete"), and the decoded
traces are dominated by warm-up kernels of an unrelated shape rather than
the kernel under study.

--profile makes the run capture-shaped:
  - skips the GPU warm-up pass entirely
  - one warmup + one measured launch (do_bench derives its counts as
    max(1, int(budget_ms / estimate_ms)), so a zero budget clamps to 1)
  - implies --eager, since graph-captured kernels are invisible to
    per-dispatch profilers

Runtime for a single shape drops ~7s -> ~3.1s and a capture contains one
dispatch of the target kernel.

Changes:
- Out-of-band results are reported but not asserted under --profile. A
  single un-warmed launch sits ~20% below the golden band by construction,
  so failing would report a regression that is not one, and a non-zero
  exit under a profiler reads as a broken run.
- Timings from a --profile run are NOT comparable to the golden baselines
  (0.55 vs 0.70 TFLOP/s on the shape used here). It is a capture mode, not
  a measurement mode; the help text and docstrings say so.
- Includes the --eager commit it builds on, which was not upstreamed
  separately.

Used to capture gemma-4-31B gate_up (1x43008x5376) on gfx1151: single
dispatch, correct instantiation, no buffer truncation.

Signed-off-by: Matthias Gehre <matthias.gehre@amd.com>
@mgehre-amd
mgehre-amd merged commit aee60d0 into gfx11 Jul 29, 2026
10 of 11 checks passed
@mgehre-amd
mgehre-amd deleted the matthias.w4a16-perf-test-profile-flag branch July 29, 2026 21:50
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.

2 participants