Skip to content

custom_all_reduce: set _dcp_merge_max_rows in __init__, not in _init_fly_rms - #8117

Merged
valarLip merged 3 commits into
mainfrom
lingzha/rank-agreement-is-gfx1250
Nov 18, 2026
Merged

valarLip merged 3 commits into
mainfrom
lingzha/rank-agreement-is-gfx1250

Conversation

@ZLkanyo009

@ZLkanyo009 ZLkanyo009 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

CustomAllreduce sets _dcp_merge_max_rows at the end of _init_fly_rms, not in __init__. This happened when #5670 and #7801 merged at almost the same time. Thus the gfx1250 DCP merge cannot run, and op_tests/flydsl_tests/test_flydsl_allreduce_rank_agreement.py::test_matching_ranks_build[fused] fails on main on every run. This PR moves the assignment back to the end of __init__, where #7801 put it.

Motivation

In the diff of #7801, the assignment is at the end of __init__, after self._init_fly_oneshot():

# Rows a source the gfx1250 DCP merge takes, 0 where it does not run
# (see custom_dcp_merge).
self._dcp_merge_max_rows = (
    ops.dcp_merge_max_rows_gfx1250(self._ptr) if self._is_gfx1250 else 0
)

#5670 added self._init_fly_rms() and the _init_fly_rms method at that position. #5670 merged at 07:47 UTC on 2026-11-17 and #7801 at 07:51 UTC. The last head of #7801 (9eb751c) is from 2026-11-16, so no PR CI ran the two together. The squash merge of #7801 (03f9f37) put the hunk at the end of _init_fly_rms (L1578-L1582 at b9e08daca8).

_init_fly_rms returns early unless the exact FlyDSL fused AR + RMSNorm engine builds. The engine builds only with AITER_FLY_AR=1 on gfx942 or gfx950 (fly_policy.SUPPORTED_ARCHS). This has two consequences:

  1. On gfx1250 the engine never builds, so _dcp_merge_max_rows is never set. should_custom_dcp_merge reads it with getattr(self, "_dcp_merge_max_rows", 0) and always returns False. Thus custom_dcp_merge cannot run, and op_tests/multigpu_tests/test_dcp_merge.py takes its "does not run here: skipped" branch. This is from reading the code; I have no gfx1250 to run it.
  2. The rank-agreement test (from [FlyDSL] [CI] Fused all-reduce + RMSNorm #5670) builds CustomAllreduce.__new__(CustomAllreduce), sets by hand the attributes that _init_fly_rms reads, and calls _init_fly_rms. The moved line also reads self._is_gfx1250, which the stand-in does not set. Thus test_matching_ranks_build[fused] fails with AttributeError: 'CustomAllreduce' object has no attribute '_is_gfx1250'. The MI35X Standard Tests shard that gets this file fails on unrelated PRs, for example:

The first version of this PR set _is_gfx1250 = False in the test. That made the test pass, but it did not fix consequence 1. This version fixes the cause and reverts the test change.

cc @vpietila-amd (#5670)

Changes

  • aiter/dist/device_communicators/custom_all_reduce.py: move the _dcp_merge_max_rows assignment and its two comment lines from the end of _init_fly_rms to the end of __init__, after self._init_fly_rms(). Thus it runs whether or not the FlyDSL fused engine builds, and self._ptr is set at that point.
  • op_tests/flydsl_tests/test_flydsl_allreduce_rank_agreement.py: no net change. The first commit of this PR set ca._is_gfx1250 = False; the second commit removes it. The test passes without it, because _init_fly_rms does not read _is_gfx1250 anymore.
  • should_custom_dcp_merge and its getattr are not changed.

Performance (if applicable)

Not applicable: the change moves an attribute assignment in the constructor. No kernel or dispatch path changes on gfx942 or gfx950, where the value is 0 before and after.

Testing

  • Unit tests added or updated
  • Performance benchmarks run (not applicable)
  • Tested on MI250X
  • Tested on MI300X (MI308X, gfx942)

@zejunchen-zejun (#7801): can you run op_tests/multigpu_tests/test_dcp_merge.py on gfx1250 with this branch? It should now take the DCP merge path instead of the skipped branch. I cannot test gfx1250 on MI308X.

Documentation

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

The change restores the intended place of one assignment; no documented behavior changes.

Dependencies

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

Breaking Changes

None.

PR Self-Review

Reviewed revision

7e9b6b3

Behavior and intent

Behavior change: every CustomAllreduce built by __init__ now has _dcp_merge_max_rows. It is ops.dcp_merge_max_rows_gfx1250(self._ptr) on gfx1250 when the communicator is enabled, and 0 otherwise. Before, the attribute existed only when the FlyDSL fused engine built (AITER_FLY_AR=1 on gfx942 or gfx950), and then it was always 0.

Why the existing behavior is insufficient: the #5670 + #7801 merge put the assignment in _init_fly_rms, which returns early on gfx1250. Thus the gfx1250 DCP merge from #7801 cannot run. Also, _init_fly_rms reads _is_gfx1250, so test_matching_ranks_build[fused] fails on main on every run.

Validation and unverified scope

Validated at 7e9b6b3 on MI308X (gfx942), ROCm 7.2.4, torch 2.10.0, FlyDSL 0.5.0, TP2 on 2 GPUs. The image's aiter build (95d2112) is overlaid with every tracked file under aiter/ from this branch (no kernel is rebuilt). The op tests come from this branch.

  • python3 op_tests/flydsl_tests/test_flydsl_allreduce_rank_agreement.py, test file identical to main: 28 passed (main b9e08da: 1 failed, 27 passed, same AttributeError as in CI).
  • A real two-rank CustomAllreduce (a local probe script, not committed): with AITER_FLY_AR unset, _dcp_merge_max_rows == 0 on both ranks. On main the attribute is missing. With AITER_FLY_AR=1, it is 0 on both ranks, and the fused and one-shot FlyDSL engines build, the same as on main. disabled is False and should_custom_dcp_merge returns False in every case.
  • The same result on this branch and on main for:
    • python3 -m pytest tests/test_custom_ar_fused_rms_row_options.py tests/test_custom_ar_residual_guard.py tests/test_custom_all_reduce_layout.py tests/test_all_reduce_config.py: 36 passed.
    • op_tests/multigpu_tests/test_dcp_merge.py -t 2: skipped branch (gfx1250 only).
    • op_tests/multigpu_tests/test_custom_allreduce.py -t 2 --regression: exit 0.
    • op_tests/multigpu_tests/test_custom_allreduce_size_env.py: 16 passed.
    • op_tests/multigpu_tests/test_custom_allreduce_capture_registration.py -t 2: all scenarios passed.
  • black (26.10.1) and ruff check (0.16.0): clean.

Unverified: gfx1250 is not tested. On gfx1250 this change makes dcp_merge_max_rows_gfx1250 run in __init__ and enables the DCP merge path, as #7801 intended, but I cannot run it on MI308X. The cross-node symm_mem failure path is not run either; the not self.disabled guard for it is from reading the code. gfx950 is covered by the CI of this PR.

PR-specific question

The most important boundary: on gfx1250, __init__ now calls ops.dcp_merge_max_rows_gfx1250(self._ptr) on every enabled communicator, and should_custom_dcp_merge can return True. This is the behavior that #7801 added and tests in test_dcp_merge.py; this PR only makes it reachable again. A disabled communicator with no self._ptr does not reach the call, because of not self.disabled. On gfx942 and gfx950 the value is 0 before and after, which the probe and the unchanged test results above show. The gfx1250 side needs a run by @zejunchen-zejun.

Changed op tests

None. The net diff against main changes no op test: the second commit reverts the one-line test change of the first.

… on the __new__-built CustomAllreduce

test_matching_ranks_build[fused] builds a CustomAllreduce with __new__
and sets by hand the attributes that _init_fly_rms reads. Since #7801,
_init_fly_rms also reads self._is_gfx1250 after the engine is built, to
size the gfx1250 DCP merge. __init__ sets this attribute on every
instance, but the stand-in did not. Thus both ranks raised
AttributeError and the case failed on main.

Set it to False. The stand-in host is gfx950 (ARCH), and the FlyDSL
fused backend builds only on gfx942 and gfx950. With True, which is the
module value on a gfx1250 runner, _init_fly_rms calls
dcp_merge_max_rows_gfx1250(self._ptr), and the stand-in has no _ptr.

MI308X (gfx942), main b9e08da: the file gives 1 failed, 27 passed
before this change, and 28 passed after it.
@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 8117 --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.

…fly_rms

#7801 set _dcp_merge_max_rows at the end of __init__, after
_init_fly_oneshot(). #5670 merged four minutes earlier and changed the
same region. The squash merge of #7801 (03f9f37) placed the hunk at
the end of _init_fly_rms instead. _init_fly_rms returns early when the
FlyDSL fused AR + RMSNorm engine does not build. The engine builds only
with AITER_FLY_AR=1 on gfx942 or gfx950. Thus:

- On gfx1250 the attribute is never set, so should_custom_dcp_merge
  always returns False and the gfx1250 DCP merge cannot run.
- The rank-agreement test builds a CustomAllreduce with __new__, then
  calls _init_fly_rms. That call now reads _is_gfx1250, which the stand-in
  does not set. test_matching_ranks_build[fused] fails with
  AttributeError on main.

Move the assignment and its comment back to __init__, after
_init_fly_rms(). Also require "not self.disabled". The cross-node
symm_mem failure path disables the communicator and returns before it
sets self._ptr, so the gfx1250 call would raise on it.

Revert the test change of the previous commit. The test file is now
identical to main.

MI308X (gfx942), TP2:
- test_flydsl_allreduce_rank_agreement.py: 28 passed (main: 1 failed,
  27 passed).
- A real CustomAllreduce has _dcp_merge_max_rows == 0 with AITER_FLY_AR
  unset and with AITER_FLY_AR=1. On main the attribute is missing when
  the variable is unset.
@github-actions github-actions Bot changed the title [FlyDSL] [Test] test_flydsl_allreduce_rank_agreement: set _is_gfx1250 on the __new__-built CustomAllreduce [Test] test_flydsl_allreduce_rank_agreement: set _is_gfx1250 on the __new__-built CustomAllreduce Nov 17, 2026
@github-actions github-actions Bot removed the FlyDSL label Nov 17, 2026
@aiter-bot

aiter-bot commented Nov 17, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 0de744d4554a · 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 — Reviewed revision must contain at least the first 7 characters of the current head SHA

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

@ZLkanyo009 ZLkanyo009 changed the title [Test] test_flydsl_allreduce_rank_agreement: set _is_gfx1250 on the __new__-built CustomAllreduce custom_all_reduce: set _dcp_merge_max_rows in __init__, not in _init_fly_rms Nov 17, 2026
@ZLkanyo009

Copy link
Copy Markdown
Contributor Author

Changed this PR from a test fix to a fix of the cause: 3c3af55..7e9b6b3.

Why: the test-only change made test_matching_ranks_build[fused] pass, but the cause is in the product code. The #5670 + #7801 merge put the _dcp_merge_max_rows assignment at the end of _init_fly_rms, which returns early unless the FlyDSL fused engine builds (gfx942 or gfx950 only). Thus on gfx1250 the attribute is never set, and the DCP merge from #7801 cannot run. 7e9b6b3 moves the assignment back to the end of __init__, as in #7801, with not self.disabled added for the cross-node symm_mem failure path, which has no self._ptr. It also reverts the test line, so the test file is identical to main.

Results on MI308X (gfx942), TP2:

  • test_flydsl_allreduce_rank_agreement.py: 28 passed (main: 1 failed, 27 passed).
  • Real CustomAllreduce: _dcp_merge_max_rows == 0 with AITER_FLY_AR unset and set to 1. On main the attribute is missing when the variable is unset.
  • test_dcp_merge.py -t 2, test_custom_allreduce.py -t 2 --regression, test_custom_allreduce_size_env.py, test_custom_allreduce_capture_registration.py -t 2 and 4 tests/ files: same results as on main.

gfx1250 is not tested; @zejunchen-zejun, please check test_dcp_merge.py there. The title and description are updated.

@ZLkanyo009

Copy link
Copy Markdown
Contributor Author

CI at 7e9b6b392 (run 44110004540):

  • The test this PR fixes passes on MI35X now: op_tests/flydsl_tests/test_flydsl_allreduce_rank_agreement.py, 28 passed (shard 3), with the test file unchanged from main.
  • The only failing shard, 2, is op_tests/test_flydsl_hgemm.py, check "changed-input graph": graph replay mismatch: 0.0004385964912280702. It fails with the same ratio on [Perf] hipb_mm: keep hipBLASLt layouts, descriptor and algorithm per configuration #8116, and this PR touches neither GEMM nor that test, so it looks like a separate current main issue on MI35X.

gfx1250 still needs a check by someone with the hardware (@zejunchen-zejun), as noted in the description.

@TennyWang1223 TennyWang1223 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

JiaoliangYu added a commit to JiaoliangYu/aiter that referenced this pull request Nov 22, 2026
…nfig

Drop M_LEQ_1, M_LEQ_4 and M_LEQ_8: on MI455X the M_LEQ_16 config
(BLOCK_N 32, 2 warps) is the fastest at M=2..8 and within 0.1 us at M=1,
bit-identical. Also drop the rank-agreement fixture line; main fixed that
test in ROCm#8117.
JiaoliangYu added a commit to JiaoliangYu/aiter that referenced this pull request Nov 23, 2026
JiaoliangYu added a commit that referenced this pull request Nov 24, 2026
#8262 brought back ca._is_gfx1250 = False in the CPU stand-in of
test_flydsl_allreduce_rank_agreement.py. Since #8117 _init_fly_rms no longer
reads _is_gfx1250, so the line has no effect.

Co-authored-by: JiaoliangYu <[email protected]>
azaidy pushed a commit that referenced this pull request Nov 24, 2026
…ig (DeepSeek kv_b_proj) (#7962)

* [Triton/Gluon] [gfx1250] gemm_a16w16: add N=32768 K=512 config

DeepSeek-V3/R1 kv_b_proj at attention TP1. M<=128 keeps the DEFAULT
entries; M<=256 uses compute_bound 256x128x64 and larger M 256x256x64.

* [Triton/Gluon] complete kv_b_proj compute-bound config entries

* [FlyDSL] initialize the gfx950 fused rank-test fixture

* [Triton/Gluon] gemm_a16w16 N=32768 K=512: M<=16 takes the M_LEQ_16 config

Drop M_LEQ_1, M_LEQ_4 and M_LEQ_8: on MI455X the M_LEQ_16 config
(BLOCK_N 32, 2 warps) is the fastest at M=2..8 and within 0.1 us at M=1,
bit-identical. Also drop the rank-agreement fixture line; main fixed that
test in #8117.

---------

Co-authored-by: [email protected] <[email protected]>
Co-authored-by: JiaoliangYu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants