Skip to content

[Triton/Gluon] bench_sage: run mha4_mxfp8 --e2e through mha_v4 - #7755

Open
jcaraban wants to merge 2 commits into
mha4_kmean_gatefrom
mha4_mxfp8_e2e_bench
Open

jcaraban wants to merge 2 commits into
mha4_kmean_gatefrom
mha4_mxfp8_e2e_bench

Conversation

@jcaraban

@jcaraban jcaraban commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stacked on #7754. bench_sage --kernel mha4_mxfp8 --e2e called the producers and mha_v4_packed directly, unlike every other mha4_* recipe; it now calls mha_v4, so it includes the K-smoothing gate and host path real callers pay. Kernel-only mode is unchanged.

Performance

MI355X, mha4_mxfp8 hd128 --e2e, median of 3: b1 h16 s4096 92.6 -> 122.2 us, b1 h5 s65536 3.788 -> 3.814 ms (the cost now measured, not a regression).

PR Self-Review

Reviewed revision

619ac9ce562c

Behavior and intent

For BF16 inputs, --e2e for mha4_mxfp8 measures mha_v4, including the K-smoothing gate, like the other mha4_* recipes. FP16 retains the previous packed-producer path.

Validation and unverified scope

MI355X on f926eca (before the FP16 fallback; current head has not been GPU-validated): bench_sage.py --kernel mha4_mxfp8 --b 1 --hq 16 --hk 16 --sq 4096 --sk 4096 --d 128 --dv 128 --report-quality, with and without --e2e: cosine 0.99956 both, hd128 MXFP8 object loaded. Black/Ruff pass. Unverified: CI does not run bench_sage.py; MXFP8 is gfx950-only, so no MI300X run.

PR-specific question

bench_sage.py is a benchmark, not a correctness test: before this PR its mha4_mxfp8 --e2e skipped the K-smoothing gate and under-reported end-to-end time against real mha_v4 callers.

Changed op tests

op_tests/op_benchmarks/triton/bench_sage.py: benchmark only; routes the mha4_mxfp8 --e2e runner through mha_v4 like the other recipes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The raw mha_v4 path rejects FP16 inputs, breaking the previously supported --kernel mha4_mxfp8 --e2e --dtype fp16 benchmark mode.

1 open issue
What changed in this PR

This PR routes the MXFP8 end-to-end attention benchmark through mha_v4, so timing includes the K-smoothing gate and public wrapper overhead.

Changes:

  • Replace direct quantization and packed execution in mha4_mxfp8 --e2e with mha_v4.
  • Pass the MXFP8 scale modes as named arguments.
  • Leave kernel-only benchmarking unchanged.
File Description
op_tests/​op_benchmarks/​triton/​bench_sage.py Route MXFP8 end-to-end timing through the public attention wrapper.

Review effort: Balanced

@jcaraban
jcaraban requested a review from a team November 11, 2026 08:47
@aiter-bot

aiter-bot commented Nov 11, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 8a551759ce36 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. What behavior would each changed op test fail on before this PR, and why is that coverage not already provided by an existing canonical test?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@jcaraban
jcaraban force-pushed the mha4_mxfp8_e2e_bench branch from 619ac9c to 21833e1 Compare November 12, 2026 12:23
Every other mha4 recipe's --e2e calls mha_v4, which is what models call;
mha4_mxfp8 called its producers and mha_v4_packed directly, so it skipped
the K-mean smoothing gate and the raw API's host path, and its e2e numbers
were not comparable with the other recipes'. Kernel-only mode keeps the
producers. Same output (cosine 0.99956 against BF16 either way).

gfx950, mha4_mxfp8 hd128 --e2e (median of 3), before / after:
  h16 s4096    92.6 us / 122.2 us
  h5  s65536   3.788 ms / 3.814 ms

Signed-off-by: jcaraban <jcaraban@amd.com>
@jcaraban
jcaraban force-pushed the mha4_mxfp8_e2e_bench branch from 21833e1 to 8a55175 Compare November 12, 2026 17:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants