Repository navigation
[Triton/Gluon] bench_sage: route head dim 256 to the hd256 mxfp4/6 producers - #7174
Merged
Merged
Conversation
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Active issues cause 256-wide heads to fail in the hd128-only rotation op and quality reporting to compare mismatched output layouts for aiter_fp8.
2 open issues
What changed in this PR
This benchmark-only change lets bench_sage exercise the hd256 MXFP4 support from #7173 and adds an FP8 comparator. It does not modify runtime or kernel code.
Changes:
- Selects the hd256 MXFP4 producer trio for 256-wide heads.
- Adds an opt-in, unrotated
aiter_fp8row with end-to-end and kernel-only timing.
| File | Description |
|---|---|
op_tests/op_benchmarks/triton/bench_sage.py |
Adds hd256 producer routing and the per-tensor FP8 benchmark runner. |
Review effort: Balanced
jcaraban
force-pushed
the
mha4_hd256_mxfp4_bench
branch
from
October 30, 2026 11:47
c3f3d05 to
21fbe18
Compare
jcaraban
force-pushed
the
mha4_hd256_mxfp4_bench
branch
2 times, most recently
from
October 30, 2026 16:58
7569ad6 to
8396d6b
Compare
5 of 7 tasks
Contributor
Author
|
@k50112113 the failed job is unrelated to this PR, please let me know how to proceed |
jcaraban
force-pushed
the
mha4_hd256_mxfp4_bench
branch
from
November 2, 2026 07:01
8396d6b to
6297254
Compare
MXFP4 is the one recipe with an hd256 object, and its producers are separate entry points rather than a head-dim argument, so the bench has to pick the trio the way mha_v4's raw path does. Stacked on the hd256 kernel branch; it has no object to benchmark without it.
…runner layout --hadamard-rotate 0 passed a 256-wide head to the hd128-only rotation op. The hd256 producers rotate each 128-wide half as its own head, so the cancel now does the same. Only the two sage runners honour --layout; the other 13 are handed BSHD and return BSHD, yet both quality sites permuted every output under --layout bhsd. A follows_layout spec field now gates the permute. The bug predates aiter_fp8, which only inherited it.
The MXFP4 and MXFP6 producer helpers now take their (Q, K, FP6-P V) trio from mha_v4's own table instead of restating the head-dim switch, which also routes mha4_mxfp6 at --d 256 to the hd256 MXFP6 producers. b1 h5 s65536 d256: mha4_mxfp6 4321 TFLOPS kernel-only, 4047 --e2e (mha4_mxfp4 5043). mha4_mxfp4/mxfp6/f6f4/f6f8 at d128 unchanged. Signed-off-by: jcaraban <[email protected]>
jcaraban
force-pushed
the
mha4_hd256_mxfp4_bench
branch
from
November 3, 2026 12:22
6acac67 to
19fd870
Compare
JohnNikolay84
approved these changes
Nov 4, 2026
eppaneamd
added a commit
that referenced
this pull request
Nov 4, 2026
…sp-rs-ag No conflicts; main's new commit touches only op_tests/op_benchmarks/triton/bench_sage.py. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Routes
bench_sageto the hd256 MXFP4/MXFP6 producers from #7173 and adds anaiter_fp8comparator using FMHA v3 per-tensor FP8.Motivation
Stacked on #7173. The hd256 producers have separate entry points, so the benchmark must select the same trio as production.
aiter_fp8provides the non-MX comparator that runs at d=256.Changes
mha_v4_mx_producersand uses the hd256 MXFP6 K view.aiter_fp8viaflash_attn_fp8_pertensor_func. It is deliberately unrotated: xDiT'sAITER_FP8rotates Q/K, so their accuracy is not directly comparable.--hadamard-rotate 0at d=256.--layout bhsd.Performance
Benchmark-only change; no kernel speedup claimed or absolute throughput quoted here. hd256 object throughput is reported in #7173.
Testing
Documentation
mha_v4_mx_producers.Dependencies
Breaking Changes
None. hd256 routing applies only at head dim 256;
aiter_fp8is opt-in. Existing rows retain their behavior except for the rotation-cancellation and quality-layout fixes above.PR Self-Review
Reviewed revision
19fd870Behavior and intent
The benchmark now reaches production hd256 MXFP4/MXFP6 objects, offers an unrotated FP8 comparator, and evaluates quality in the correct output layout rather than mis-permuting native-BSHD results.
Validation and unverified scope
On gfx950 (MI355X):
bench_sage.py --kernel mha4_mxfp4 --d 256 --dv 256 --b 1 --hq 16 --hk 16 --sq 4096 --sk 4096loads_ZN5aiter28fmha_fwd_hd256_mxfp4_gfx950E, confirming hd256 producer selection.dc29c376d,bench_sage.py --b 1 --hq 5 --hk 5 --sq 16384 --sk 16384runsmha4_mxfp6andmha4_mxfp4at d=128/256, kernel-only and--e2e, plus the shared-helper rowsmha4_f6f4/mha4_f6f8at d=128. MXFP6 d256 loads_ZN5aiter28fmha_fwd_hd256_mxfp6_gfx950E.sage_*runners are permuted under--layout bhsd.--b 1 --hq 4 --sq 1024 --sk 1024:mha4_mxfp4 --d 256 --hadamard-rotate 0gives cosine 0.9825. With--layout bhsd --report-quality, cosine is 0.9990/0.9992 foraiter_fp8d128/d256, 1.0000 foraiter_bf16, and 0.9997 forsage_fp8(still permuted). Before the fixes, the former aborts and the latter raises the reported shape mismatch.Unverified: no MI250X/MI300X run.
bench_sage.pyis not collected by CI on any target; all validation was manual.PR-specific question
The manual checks cover hd256 routing, half-head rotation cancellation and runner-specific layout conversion; the pre-fix benchmark cannot complete the latter two cases. Neither
select_triton_tests.pynorsplit_tests.shcollectsop_tests/op_benchmarks/triton/, so no CI job exercises this benchmark.Changed op tests
None. Only
op_tests/op_benchmarks/triton/bench_sage.pychanges; it is a benchmark, not an op test.