Repository navigation
custom_all_reduce: set _dcp_merge_max_rows in __init__, not in _init_fly_rms - #8117
Conversation
… 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.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
…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.
WAITING ON AUTHORPR Self-ReviewRevision 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
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
|
Changed this PR from a test fix to a fix of the cause: 3c3af55..7e9b6b3. Why: the test-only change made Results on MI308X (gfx942), TP2:
gfx1250 is not tested; @zejunchen-zejun, please check |
|
CI at
gfx1250 still needs a check by someone with the hardware (@zejunchen-zejun), as noted in the description. |
Picks up #8117, which fixes test_flydsl_allreduce_rank_agreement (CustomAllreduce has no attribute _is_gfx1250) on main.
…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.
#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]>
…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]>
Summary
CustomAllreducesets_dcp_merge_max_rowsat 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, andop_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__, afterself._init_fly_oneshot():#5670 added
self._init_fly_rms()and the_init_fly_rmsmethod 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_rmsreturns early unless the exact FlyDSL fused AR + RMSNorm engine builds. The engine builds only withAITER_FLY_AR=1on gfx942 or gfx950 (fly_policy.SUPPORTED_ARCHS). This has two consequences:_dcp_merge_max_rowsis never set.should_custom_dcp_mergereads it withgetattr(self, "_dcp_merge_max_rows", 0)and always returnsFalse. Thuscustom_dcp_mergecannot run, andop_tests/multigpu_tests/test_dcp_merge.pytakes its "does not run here: skipped" branch. This is from reading the code; I have no gfx1250 to run it.CustomAllreduce.__new__(CustomAllreduce), sets by hand the attributes that_init_fly_rmsreads, and calls_init_fly_rms. The moved line also readsself._is_gfx1250, which the stand-in does not set. Thustest_matching_ranks_build[fused]fails withAttributeError: '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 = Falsein 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_rowsassignment and its two comment lines from the end of_init_fly_rmsto the end of__init__, afterself._init_fly_rms(). Thus it runs whether or not the FlyDSL fused engine builds, andself._ptris set at that point.self._is_gfx1250 and not self.disabled. When a cross-nodetorch.symm_memgroup cannot map its peers,_init_symm_memsetsself.disabled = Trueand returns without settingself._ptr.__init__then goes on, so with the [HIP] perf(custom_ar): gfx1250 DCP merge: all-to-all and LSE combine in one LL kernel #7801 condition the gfx1250 call would raiseAttributeErroronself._ptr.should_custom_dcp_mergealready returnsFalsewhenself.disabled, so 0 does not change what it returns.op_tests/flydsl_tests/test_flydsl_allreduce_rank_agreement.py: no net change. The first commit of this PR setca._is_gfx1250 = False; the second commit removes it. The test passes without it, because_init_fly_rmsdoes not read_is_gfx1250anymore.should_custom_dcp_mergeand itsgetattrare 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
@zejunchen-zejun (#7801): can you run
op_tests/multigpu_tests/test_dcp_merge.pyon gfx1250 with this branch? It should now take the DCP merge path instead of the skipped branch. I cannot test gfx1250 on MI308X.Documentation
The change restores the intended place of one assignment; no documented behavior changes.
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
7e9b6b3
Behavior and intent
Behavior change: every
CustomAllreducebuilt by__init__now has_dcp_merge_max_rows. It isops.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=1on 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_rmsreads_is_gfx1250, sotest_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, sameAttributeErroras in CI).CustomAllreduce(a local probe script, not committed): withAITER_FLY_ARunset,_dcp_merge_max_rows == 0on both ranks. On main the attribute is missing. WithAITER_FLY_AR=1, it is 0 on both ranks, and the fused and one-shot FlyDSL engines build, the same as on main.disabledisFalseandshould_custom_dcp_mergereturnsFalsein every case.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) andruff check(0.16.0): clean.Unverified: gfx1250 is not tested. On gfx1250 this change makes
dcp_merge_max_rows_gfx1250run 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; thenot self.disabledguard 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 callsops.dcp_merge_max_rows_gfx1250(self._ptr)on every enabled communicator, andshould_custom_dcp_mergecan returnTrue. This is the behavior that #7801 added and tests intest_dcp_merge.py; this PR only makes it reachable again. A disabled communicator with noself._ptrdoes not reach the call, because ofnot 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.