Skip to content

[Fix] MHAv4: build the MXFP8 test recipe from OCP E4M3 - #8103

Merged
zufayu merged 1 commit into
mainfrom
nsakkine/fix-mha_v4-hdim-issue
Nov 18, 2026
Merged

zufayu merged 1 commit into
mainfrom
nsakkine/fix-mha_v4-hdim-issue

Conversation

@nsakkine

Copy link
Copy Markdown
Collaborator

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'):

AssertionError: expected 'head dimension 256 is dense-only' in ValueError: mha_v4 head dimension 256 is all-MXFP4, all-MXFP6 or MXFP8 only, got FP8_E4M3_FNUZ Q/K with FP8_E4M3_FNUZ V under per-tensor scales

The mxfp8 case 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 used native_fp8_format(), and that is FP8_E4M3_FNUZ on gfx942. Every MXFP8 row in the manifest is OCP FP8_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") returns AttentionFormat.FP8_E4M3 instead of native_fp8_format().
    • The failing test runs on meta tensors on every arch, and with OCP E4M3 it reaches the dense-only check on gfx942 as intended.
    • Every other caller of the helper is gfx950-only, and there native_fp8_format() is already FP8_E4M3, so this changes nothing on gfx950.

No library change.

Testing

On gfx942 (MI300X), each file run as CI runs it (python3 <file>):

File Ran Skipped Failed
op_tests/test_mha_v4.py 67 276 0
op_tests/test_mha_v4_sparse.py 160 454 0

Before the fix, the same test_mha_v4.py run gave 66 ran, 276 skipped, 1 failed, and the one failure was test_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

d974b361cf9a568a7199fcfd60aa417ab3dba54f

Behavior 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.py gives 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.py gives 160 ran, 454 skipped, 0 failed.

Unverified: gfx950. The change is a no-op there because native_fp8_format() already returns FP8_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.
    • It covers selecting the MXFP8 recipe for the hd256 tests.
    • Of its callers, only test_mha_v4_rejects_sparse_head_dim_256 runs off gfx950, and that is the case this fixes.
    • Nothing is added, so there is nothing redundant.

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]>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 8103 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@nsakkine
nsakkine marked this pull request as ready for review November 17, 2026 11:34
@nsakkine
nsakkine requested a review from a team November 17, 2026 11:34
@aiter-bot

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision d974b361cf9a · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior 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.py` gives 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.py` gives 160 ran, 454 skipped, 0 failed.

Unverified: gfx950. The change is a no-op there because `native_fp8_format()` already returns `FP8_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.
  - It covers selecting the MXFP8 recipe for the hd256 tests.
  - Of its callers, only `test_mha_v4_rejects_sparse_head_dim_256` runs off gfx950, and that is the case this fixes.
  - Nothing is added, so there is nothing redundant.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

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

@zufayu zufayu added the ci:mi300x Run MI300X standard and OPUS CI on PRs label Nov 17, 2026
@zufayu
zufayu requested a review from minmengdie November 18, 2026 01:24
@zufayu

zufayu commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

ci failed

@zufayu zufayu added ci:infra and removed ci:mi300x Run MI300X standard and OPUS CI on PRs labels Nov 18, 2026
@zufayu
zufayu merged commit 5939459 into main Nov 18, 2026
@zufayu
zufayu deleted the nsakkine/fix-mha_v4-hdim-issue branch November 18, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants