Skip to content

[FlyDSL] Fix attention A2A MX Q-scale backing for mha_v4 query-tile gather - #7804

Merged
gyohuangxin merged 1 commit into
mainfrom
fix/attention-a2a-mx-scale-slack
Nov 11, 2026
Merged

gyohuangxin merged 1 commit into
mainfrom
fix/attention-a2a-mx-scale-slack

Conversation

@TennyWang1223

Copy link
Copy Markdown
Contributor

Summary

Fixes the main-branch Multi-GPU CI failure in op_tests/multigpu_tests/test_attention_a2a.py on MI350X. The fused intranode A2A op now reserves the zeroed 256-row query-tile slack that the mha_v4 launcher requires behind packed MX Q scales.

Motivation

#6575 made the mha_v4 launcher check that MX Q descales are backed out to a whole 256-row query tile (check_scale_backing_storage in csrc/py_itfs_cu/asm_mha_v4_fwd.cu). The A2A op from #5815, merged before #6575, still allocates packed Q scales unpadded (its comment said "Q scales are unpadded since #6841"). Whenever world_size * sequence is not a multiple of 256, passing its packed MX Q scales to mha_v4 fails. For example, e4m3_pc at ws=4, s=1184, h=8 (CI run 42930574634):

RuntimeError: MX Q descale needs 38912 mapped bytes so the kernel's speculative tile gather stays in bounds, but only 37888 are backed; allocate it with the aiter.ops.mha_v4_quant producers, which reserve zeroed slack

Changes

  • aiter/ops/flydsl/attention_a2a_intranode.py _scale_padding_size: for role Q with mxfp4/mxfp6/mxfp8 in packed return, add (ceil(seq/256)*256 - seq) * heads_local * 4 bytes of slack. This matches mha_v4_quant.query_block_scale (batch is 1 and head_dim is 128, which the op already enforces).
  • The existing K/V padding path already zeroes the slack. The returned scale views keep the same logical shape and strides. Sequences aligned to 256 and non-MX Q codecs get no padding, so their behavior is unchanged.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

This is an internal allocation fix with no API change.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None

PR Self-Review

Reviewed revision

e340012

Behavior and intent

Packed MX Q scales returned by AttentionA2AIntraNodeOp now carry the zeroed query-tile slack that mha_v4 requires. They can be consumed directly by mha_v4_packed for any sequence length, which is what the op's packed return is for.

Validation and unverified scope

  • I checked the padding formula against the CI failure. ws=4, s=1184, h=8 gives seq_full=4736 and heads_local=2, so the padding is 1024 B. 37888 + 1024 = 38912, exactly the number the launcher requires.
  • Not run on gfx950 yet. The failing recipe (e4m3_pc) and the other packed MX / v4-consumer recipes are gfx950-only, and the only machine I had was gfx942. I'm relying on this PR's Multi-GPU (MI350X) CI job to verify the fix. That run also covers the gfx950 recipes after e4m3_pc, which never ran on main because the test exits at the first failure.

PR-specific question

To be answered after the automated PR Self-Review comment.

Changed op tests

None

🤖 Generated with Claude Code

…ather

#6575 made the mha_v4 launcher require MX Q descales to be backed out to a
whole 256-row query tile (check_scale_backing_storage), but the fused
intranode A2A op (#5815) still allocated packed Q scales unpadded. Whenever
world_size * sequence is not a multiple of 256, feeding its packed MX Q
scales to mha_v4 failed, e.g. in test_attention_a2a.py e4m3_pc at ws=4
s=1184 h=8:

  MX Q descale needs 38912 mapped bytes ... but only 37888 are backed

Reserve the same zeroed slack as mha_v4_quant.query_block_scale for
mxfp4/mxfp6/mxfp8 Q scales in packed return. Logical shape and strides are
unchanged; aligned sequences and non-MX Q codecs get no padding.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TennyWang1223
TennyWang1223 requested a review from a team November 11, 2026 06:23
@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 7804 --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.

@aiter-bot

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision e34001244232 · 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 is the most important boundary or failure mode introduced by this change, and what evidence covers it?
  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 — PR-specific question is too short to show concrete reasoning (9 units; need 14)

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

@gyohuangxin gyohuangxin added the ci:multi-gpu Trigger multi-GPU op tests on PR label Nov 11, 2026
@gyohuangxin
gyohuangxin merged commit f6ac01d into main Nov 11, 2026
@gyohuangxin
gyohuangxin deleted the fix/attention-a2a-mx-scale-slack branch November 11, 2026 14:09
vpietila-amd pushed a commit that referenced this pull request Nov 12, 2026
…ather (#7804)

#6575 made the mha_v4 launcher require MX Q descales to be backed out to a
whole 256-row query tile (check_scale_backing_storage), but the fused
intranode A2A op (#5815) still allocated packed Q scales unpadded. Whenever
world_size * sequence is not a multiple of 256, feeding its packed MX Q
scales to mha_v4 failed, e.g. in test_attention_a2a.py e4m3_pc at ws=4
s=1184 h=8:

  MX Q descale needs 38912 mapped bytes ... but only 37888 are backed

Reserve the same zeroed slack as mha_v4_quant.query_block_scale for
mxfp4/mxfp6/mxfp8 Q scales in packed return. Logical shape and strides are
unchanged; aligned sequences and non-MX Q codecs get no padding.

Co-authored-by: TennyWang1223 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
eppaneamd added a commit that referenced this pull request Nov 13, 2026
…kreduce-sp-rs-ag

Brings in #7804, which makes the attention A2A op reserve the MX Q-scale
slack that the mha_v4 query-tile gather requires. Without it,
op_tests/multigpu_tests/test_attention_a2a.py fails in the 8-GPU job. No
conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:multi-gpu Trigger multi-GPU op tests on PR FlyDSL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants