Repository navigation
Conversation
The dense rows bound the Q-scale gather with a buffer descriptor, so an exact-size Q scale (for example an all-to-all output) is valid there. Only the gfx950 sorted-sparse rows need Q backed to a whole 256-row tile. Move the check out of the shared validator into fmha_v4_fwd_sparse. Signed-off-by: Niko Säkkinen <niko.sakkinen@amd.com>
🏷️ 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 |
Summary
Fixes the MI350X 8-GPU all-to-all (A2A) CI failure that appeared after the mha_v4-sparse-geometry merge:
The merge put the Q-scale backing check in the validator that dense and sparse launches share. The dense objects bound their Q-scale gather with a buffer descriptor, so they accept a Q scale at its logical size. The A2A op returns exactly that, since its Q scales are unpadded since #6841. This PR moves the check into
fmha_v4_fwd_sparse, so only the gfx950 sorted-sparse path enforces it.This is a workaround, not the full fix. The gfx950 sorted-sparse objects still fetch MX scales with unguarded global loads, so they still need Q scales backed to a whole 256-row query tile. The 64x64 MX-V rows also need V-scale slack. As a result, the sparse path is not compatible with A2A output. Passing A2A packed Q/K/V and scales to
mha_v4_packedwith a block-sparse LUT fails with "MX Q descale needs …". It is a clear error, not a fault or a wrong result. The planned follow-up rebuilds the sparse objects with bounded scale gathers, as the dense ones already have. That makes dense and sparse accept the same scales, removes the sparse-only checks, and removes the gfx950 sparse exclusion intest_mha_v4_dispatchable_objects_bound_their_scale_gathers.PR Self-Review
Reviewed revision
a77e2fed5b4812e7ecb3d7998d4f9535b83f9b98Behavior and intent
csrc/py_itfs_cu/asm_mha_v4_fwd.cu:check_scale_backing_storagecall moves out ofvalidate_packed_mha_v4, which both paths share, intofmha_v4_fwd_sparseafterfind_config. It runs only for E8M0 per-1x32 Q.MHA_V4_QUERY_TILE_ROWS(256) rows, which theaiter.ops.mha_v4_quantproducers already reserve.Validation and unverified scope
All runs were on MI355X (gfx950).
op_tests/multigpu_tests/test_attention_a2a.py -w 2 4 8 --heads 8 40(the CI command):op_tests/test_mha_v4.pyran 328 checks andop_tests/test_mha_v4_sparse.pyran 290, with no failures.PR-specific question
Is a clear error for "A2A output fed into a sparse launch" acceptable until the sparse objects are rebuilt with bounded scale gathers? The alternative is to pad Q and
mxfp6_pV scales inside the A2A op now. That works, but the kernel rebuild would make it unnecessary.Changed op tests
op_tests/test_mha_v4.py:test_mha_v4_packed_accepts_mxfp8_scale_recipe: back to a logical-size Q scale. Dense must accept it; that is the regression this PR fixes.test_mha_v4_packed_sparse_mx_q_scales_need_the_whole_query_tile: the sparse launch must reject a logical-size MX Q scale with "MX Q descale needs", and must run once the storage backs the 256-row tile. This pins down the sparse requirement that the follow-up rebuild removes.