Repository navigation
[Fix] MHAv4: build the MXFP8 test recipe from OCP E4M3 - #8103
Conversation
test_mha_v4_rejects_sparse_head_dim_256(mxfp8) fails on gfx942. _mx_recipe_args() built MXFP8 from native_fp8_format(), which is FNUZ on gfx942. Every MXFP8 manifest row is OCP E4M3, so _check_head_dim() correctly rejects the format before it reaches the dense-only check. Use AttentionFormat.FP8_E4M3 for the MXFP8 recipe. All other callers are gfx950-only, where native_fp8_format() is already FP8_E4M3. Signed-off-by: Niko Säkkinen <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
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 |
|
ci failed |
Problem
The scheduled main run at 83229cd is red on MI300X shard 0 (https://github.com/ROCm/aiter/actions/runs/43966800047) in
test_mha_v4_rejects_sparse_head_dim_256(recipe='mxfp8'):The
mxfp8case came in with #7756 (the gfx950 hd256 MXFP8 kernel), which merged after #7984. #7984's PR-head MI300X run predates it. The case builds its formats through_mx_recipe_args(), which usednative_fp8_format(), and that isFP8_E4M3_FNUZon gfx942. Every MXFP8 row in the manifest is OCPFP8_E4M3, and gfx942 has none. So_check_head_dim()correctly rejects FNUZ MXFP8 at head dim 256 as an unsupported format before it reaches the sparse check.The validation order is right and stays as is. FNUZ MXFP8 has no hd256 row even in dense mode, so "dense-only" would be the wrong message for it.
Changes
op_tests/test_mha_v4.py:_mx_recipe_args("mxfp8")returnsAttentionFormat.FP8_E4M3instead ofnative_fp8_format().native_fp8_format()is alreadyFP8_E4M3, so this changes nothing on gfx950.No library change.
Testing
On gfx942 (MI300X), each file run as CI runs it (
python3 <file>):op_tests/test_mha_v4.pyop_tests/test_mha_v4_sparse.pyBefore the fix, the same
test_mha_v4.pyrun gave 66 ran, 276 skipped, 1 failed, and the one failure wastest_mha_v4_rejects_sparse_head_dim_256(recipe='mxfp8').Not run: gfx950 hardware, and the PR-head CI run on MI300X shard 0 and MI355X. Shards 3 and 5 fail in separate MoE tests and are tracked separately.
PR Self-Review
Reviewed revision
d974b361cf9a568a7199fcfd60aa417ab3dba54fBehavior and intent
Test-only. The MXFP8 recipe in the mha_v4 op tests is now built from OCP
FP8_E4M3, the format every MXFP8 manifest row uses, instead of the arch's native FP8. On gfx942, native FP8 is FNUZ, so the sparse hd256 rejection test passed a recipe that has no hd256 row at all. It then failed on the format error rather than the dense-only error it checks. Library behavior is unchanged, and the validation order is correct.Validation and unverified scope
On gfx942 (MI300X):
python3 op_tests/test_mha_v4.pygives 67 ran, 276 skipped, 0 failed. Before the fix it gave 66 ran, 1 failed, and that failure was the CI one.python3 op_tests/test_mha_v4_sparse.pygives 160 ran, 454 skipped, 0 failed.Unverified: gfx950. The change is a no-op there because
native_fp8_format()already returnsFP8_E4M3. The PR-head CI run on MI300X shard 0 and MI355X is still to come.PR-specific question
Before this PR,
test_mha_v4_rejects_sparse_head_dim_256(recipe='mxfp8')fails on gfx942 with the format ValueError quoted under Problem. It passes on gfx950, where native FP8 is OCP. After this PR it reaches and asserts the dense-only rejection on both arches.No new coverage is added. The existing canonical test now checks what it was written to check, on every arch it runs on.
Changed op tests
op_tests/test_mha_v4.py: only the_mx_recipe_args()helper changed.test_mha_v4_rejects_sparse_head_dim_256runs off gfx950, and that is the case this fixes.