Repository navigation
[FlyDSL] [CI] Fused all-reduce + RMSNorm - #5670
Merged
Merged
Conversation
Drop unused wave-join and single-wave fanout compiles; default and test the fp16 codec.
Compile-only and cache warming belong in developer scripts, not pytest or QRInt4QuadFanout.compile. Co-authored-by: Cursor <[email protected]>
inttoptr + make_buffer_tensor (nbytes OOB) and BufferCopy128b tiled copies replace the tile/atom/tid arithmetic for local dwordx4 loads and stores. IPC/XGMI fanout stays global_store_dwordx4 nt.
…hey were not FlyDSL-main originals.
…peline so the public API is QRInt4.
… measured keeper; drop unused codec/force_super/bf16 ALU and qr_int4_mem, compiling via flyc.compile. Co-authored-by: Cursor <[email protected]>
…R does the same), and time QRInt4 with run_perftest.
…; WORLD=8 stays kRankAtoms=1. Co-authored-by: Cursor <[email protected]>
…aiter vendored dual header. Co-authored-by: Cursor <[email protected]>
gfx942 already lowers vector<2xf16> to v_pk_max/min/mul/add/fma, so the llvm.inline_asm helpers and f32 absmax round-trip are unnecessary.
The two-shot NT fanout and last-sector handshake are unchanged; gfx942 SQNR vs fp32 all-reduce still passes at TP 2/4/8. Co-authored-by: Cursor <[email protected]>
TP2 ST=8 was packing the next tile into LDS while wave 0 still loaded the previous one. Also match aiter FlyDSL dtype/device checks and stop sorting IPC group ranks. Co-authored-by: Cursor <[email protected]>
Each rank already scored vs its local fp32 NCCL all-reduce. The parent kept rank 0 only, so a broken all-gather on a non-zero rank could pass. Co-authored-by: Cursor <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Fail SQNR on NaN or a zero-power reference with error. Drop the NCCL fallback for Gloo object gather. Reject a rank or world_size that does not match the process group. Co-authored-by: Cursor <[email protected]>
Extend arch support to gfx950, parameterize inbox/launch grid_cap (default 1216 to match HIP QR), and tighten the canonical test bench with --grid-cap and optional JSON export. Co-authored-by: Cursor <[email protected]>
IPC inbox setup needs CPU broadcast_object_list and node-local HIP IPC handles. Fail fast before allocating buffers, matching QuickAllReduce.
Co-authored-by: Cursor <[email protected]>
Clamp persistent grids to conservative residency limits, harden resource cleanup, and validate lossy collective results across ranks. Co-authored-by: Cursor <[email protected]>
Co-authored-by: samremes <[email protected]>
Fix CI Black failures in qr_int4_kernel.py and test_flydsl_qr_int4.py. Co-authored-by: Cursor <[email protected]>
…-fused-comm-kernels
…-fused-comm-kernels
TennyWang1223
self-requested a review
November 17, 2026 07:46
This was referenced Nov 17, 2026
ZLkanyo009
added a commit
that referenced
this pull request
Nov 17, 2026
…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.
4 of 10 tasks
valarLip
pushed a commit
that referenced
this pull request
Nov 18, 2026
…fly_rms (#8117) * [FlyDSL] [Test] test_flydsl_allreduce_rank_agreement: set _is_gfx1250 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. * custom_all_reduce: set _dcp_merge_max_rows in __init__, not in _init_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. --------- Co-authored-by: TennyWang1223 <[email protected]>
2 of 5 tasks
4 of 5 tasks
samremes
added a commit
that referenced
this pull request
Nov 19, 2026
… + GEMM integration - Refresh all 96 gfx950 .co binaries with prologue tile-wide 128-bit plain scale LDS staging and bank-conflict-free swizzle. - Port FlyDSL fused all-reduce + RMSNorm (#5670) and add allreduce_rmsnorm_mx with plain row-major e8m0 scales, MXFP4/MXFP8 output, optional norm_bf16 retention, and padded width masking for D in {8192, 7168, 4096, 3584, 2560}. - Add prepare_downstream_mx_inputs plus end-to-end multi-GPU seam tests and 4-arm CUDA-Graph benchmarks feeding downstream MXFP4 and MXFP8 dense GEMMs. Co-authored-by: Copilot <[email protected]>
3 of 6 tasks
5 of 10 tasks
jhinpan
pushed a commit
to jonahbernard/aiter
that referenced
this pull request
Nov 20, 2026
…e_rmsnorm ROCm#5670 made fused_allreduce_rmsnorm ask each communicator should_fly_allreduce_rmsnorm() before the paths this test checks. The CustomAllreduce stand-in from ROCm#8022 binds only the other routing gates, so the custom_fused case past the Gluon limit raised AttributeError. ROCm#8022's last CI ran on a base without ROCm#5670. Bind the real gate with _fly_rms=None, which is its value on gfx1250, where the FlyDSL fused engine does not build. (cherry picked from commit 06ae37f)
zufayu
pushed a commit
that referenced
this pull request
Nov 20, 2026
…e_rmsnorm (#8313) #5670 made fused_allreduce_rmsnorm ask each communicator should_fly_allreduce_rmsnorm() before the paths this test checks. The CustomAllreduce stand-in from #8022 binds only the other routing gates, so the custom_fused case past the Gluon limit raised AttributeError. #8022's last CI ran on a base without #5670. Bind the real gate with _fly_rms=None, which is its value on gfx1250, where the FlyDSL fused engine does not build.
tkarttunen
added a commit
to tkarttunen/sglang
that referenced
this pull request
Nov 23, 2026
… prefill all-reduce With --enable-aiter-allreduce-fusion, the fused all-reduce + add + RMSNorm was custom all-reduce only and capped at its 64 MiB pool, so prefill chunks that QuickReduce serves were never fused. Ask the QuickReduce dispatcher first: when aiter's FlyDSL kernel (ROCm/aiter#5670) takes the call, it fuses the add and RMSNorm into the INT4 all-reduce, up to the QuickReduce workspace. Anything it declines, and anything over 64 MiB, takes the existing path. Co-authored-by: Cursor <[email protected]>
5 tasks done
zufayu
pushed a commit
that referenced
this pull request
Dec 3, 2026
…e/prefill kernels (#6277) * [ASM] [MLA] Fix and optimize the gfx942 MLA decode/prefill kernels Replace 20 gfx942 MLA code objects with fixed and optimized builds and add one new kernel (32 heads, qlen 1). Kernel names, kernargs and grids are unchanged, so every existing caller dispatches as before. Bugs fixed (stock behavior): - KV loads above 4 GiB: buffer_load offsets were page_id * stride in 32 bits (some kernels also took a 24-bit page id), so pools over 4 GiB read other tokens' KV. KV now loads with 64-bit global addresses in every kernel. - Other 32-bit offset overflows (output/split data, kv_indptr, LSE, Q). - Missing s_waitcnt before using load results (prologue KV tile, V transpose LDS reads, fp8 descales) -> stale data under memory pressure. - MFMA -> VALU read hazard in the softmax (nondeterministic results). - LDS races and missing barriers in the a8w8 qseqlen 1/2/4 kernels. - 32x1 / 64x1 kernels: S == 1 null split pointer fault; the 32-head kernel ran one token per workgroup and was not causal for qlen > 1. - qseqlen-2 a8w8 causal mask, PS empty work items, kv_scale handling in the paged qseqlen-4 PS kernel, reads of unwritten splits for qlen >= 9. Dispatch: gqa_ratio 32, bf16, non-persistent now selects the new MLA_A16W16_1TG_4W_32mx1_16nx1_Coex0_Msk1_QH16_Q1 kernel when max_seqlen_q == 1 (new mla_asm.csv row) and the causal any-qlen kernel otherwise. Performance matches or beats stock on most measured shapes (up to ~20% faster); the 64-bit KV addressing costs up to ~1.5% on a few memory-bound shapes of the a8w8 qseqlen-4 kernels. Tested on MI300X against an fp32/fp64 reference and a bit-exact oracle, including KV pools above 4 GiB, injected stalls and 1 h soak runs, and with op_tests (test_mla.py incl. the CI invocations, test_mla_persistent.py, test_mla_sparse.py and the other MLA op_tests): all pass. Signed-off-by: Jonah Bernard <[email protected]> * [MLA] Extend test_mla_ltx.py gfx942 coverage to every fixed kernel The gfx942 kv_address check now covers each MLA .co this PR fixes, except the page_size 64 ds32 kernel. GFX942_PRESETS maps each preset to the modes (nps / ps / prefill) that reach its kernels. The default gfx942 run sweeps all of them: 84 cases, 20 kernels. - FP8 and A16W8 configs, qlen 1-8, 8/16/32/64/128 heads - mla_prefill_fwd (causal prefill) mode - causal reference for qlen > 1; FP8-Q tolerance 6e-2 - persistent metadata uses the real Q/KV dtypes on gfx942 (gfx950 keeps BF16) gfx950 defaults and presets are unchanged. Signed-off-by: Jonah Bernard <[email protected]> * test_mla_ltx: cover the gfx942 page-64 ds32 MLA kernel at 4 GiB Add qh16_ds32_q1/q2/q4 presets (uint8 KV) for mla_a16w8_qh16_m16x4_n16x1_coex0_mask1_ps_page64_ds32. The harness packs fp8 nope, fp32 block scales and bf16 rope into 64-token pages and runs the kv_address cases on them: one page below, across and above the 4 GiB boundary (page 102,300), plus a 65-page context the metadata splits in two. Signed-off-by: Jonah Bernard <[email protected]> * [MLA] Pick the bf16 32-head qSeqLen 1 kernel only on gfx942 asm_mla.cu set config_max_seqlen_q = 1 for bf16 32-head non-persistent decode with max_seqlen_q == 1 on every arch, but only the gfx942 mla_asm.csv has a qSeqLen 1 row for that config. get_heuristic_kernel_mla needs an exact match, so gfx950 failed with "cannot get heuristic kernel". Gate it on arch_id == "gfx942"; other archs use qSeqLen 0 as before. Signed-off-by: Jonah Bernard <[email protected]> * [ASM] [MLA] Fix the gfx950 MLA kernels and test the fp8 msk0 kernel in CI Rebuild 12 gfx950 MLA .co files from the same sources as the gfx942 kernels in this PR (the .text matches the gfx942 builds). KV is read with 64-bit global loads, so pools above 4 GiB no longer wrap, and the nondeterminism, the non-causal 64-head kernel, the 1-split fault in the 64-head kernel and the bf16-Q/fp8-KV PS fault are fixed. mla_a8w8_qh128_m32x4_n16x2_msk0 has no gfx942 counterpart: it is the fp8 128-head msk1 source built with MASK = 0. Kernel names and mla_asm.csv rows are unchanged. aiter_test.sh: on gfx950, add a test_mla.py run of non-causal fp8 decode with qlen 2 and 4 (128 heads), which is the only path that reaches the msk0 kernel. Signed-off-by: Jonah Bernard <[email protected]> * [HIP] [MLA] Add the missing barrier in mla_reduce_v1's massive row loop In mla_reduce_v1_impl_massive (4 or more splits), warp 0 writes the LSE scales of a row to p_lds_lse_scale, and every warp then reads them to scale its part of the output. The row loop had no barrier after the output pass, so when a block reduces more than one row (qlen > 1, or folded heads), warp 0 could overwrite the scales with the next row's while warp 1 was still reading them. Warp 1's dims (256-511) of that row were then combined with the wrong row's weights. This is the remaining failure in #6731: with this PR's stage-1 kernels, the issue's repro (32 heads, qlen 4, 5 splits) gave 167 wrong calls in 400,000 on MI300X, each one token and one head in dims 256-511 only. With the barrier: 0 in 400,000. Signed-off-by: Jonah Bernard <[email protected]> * [MLA] Add a test_mla_reduce case for the row-loop barrier The previous commit's race needs many splits, many rows per workgroup and a full GPU; none of the existing cases has all three, so they pass with or without the barrier. The new case (16 heads, dv 512, 32 tiles x 64 splits x 32 rows) failed on every run without the barrier on MI300X (50 of 50, plus both dtypes of the full test on two GPUs) and passes with it. Signed-off-by: Jonah Bernard <[email protected]> * [ASM] [MLA] Apply the causal mask in bf16 128-head decode with qlen > 1 The non-persistent bf16 128-head decode always ran mla_dec_stage1_bf16_a16w16_subQ128_mqa128, which has no causal mask, so causal decode with qlen > 1 attended to future tokens (#6733). Run mla_pfl_bf16_a16w16_causal_subQ128_mqa128 for that case instead. It is the masked build of the same kernel and takes the decode arguments unchanged. It skips splits past a query's last token, so stage 2 now uses the per-query split count for it. gfx950 ships the same two kernels (identical .text), so the fix covers it too; it was only tested on gfx942. Signed-off-by: Jonah Bernard <[email protected]> * [Test] test_ar_norm_precedence: give the stand-in should_fly_allreduce_rmsnorm #5670 made fused_allreduce_rmsnorm ask each communicator should_fly_allreduce_rmsnorm() before the paths this test checks. The CustomAllreduce stand-in from #8022 binds only the other routing gates, so the custom_fused case past the Gluon limit raised AttributeError. #8022's last CI ran on a base without #5670. Bind the real gate with _fly_rms=None, which is its value on gfx1250, where the FlyDSL fused engine does not build. (cherry picked from commit 06ae37f) * [Test] test_moe_2stage: accept the gfx942 FlyDSL clamped SiLU route #8178 sends a gfx942 per_Token FP8 SiLU with an active swiglu_limit and no tuned CK row to the FlyDSL whole-graph backend, which applies the clamp, and checks the CK limits only when no FlyDSL backend takes the call. test_plain_fp8_swiglu_limit_dispatch still assumed CK stage 1: it read md.stage1.keywords on a FlyDSL result (AttributeError on MI300X), and it expected NotImplementedError for per_Token at inter_dim 192, which FlyDSL now serves. The first two hunks are #8294's change. The inter_dim 192 expectation is the assertion that #8294's own MI300X run still fails on. * Revert "[Test] test_moe_2stage: accept the gfx942 FlyDSL clamped SiLU route" This reverts commit fdcd7bd. * [fused_moe] Keep CK-capable clamped SiLU off the gfx942 FlyDSL default The whole-graph batch-1 and decode kernels clamp BF16 activations, so a per-token call that CK can clamp was missing the per-token reference and crashing the dispatch test on stage1 being None. Co-authored-by: Cursor <[email protected]> (cherry picked from commit ca91b9f) * [MLA] Route gfx950 128-head bf16 causal qlen>1 decode to the masked prefill kernel too mla_asm_decode_remap only forced ps=0 (and thus the masked-prefill-kernel selection for causal qlen>1) on gfx942, so gfx950 kept running the plain persistent decode kernel for this case, which has no per-query causal mask. Meanwhile mla.py's masked_qh128_bf16 (which drives CAUSAL_PER_QUERY for the stage-2 reduction) was already set for both gfx942 and gfx950, so stage 2 believed splits past each query's causal horizon were skipped on gfx950 too, even though stage 1 never skipped them there. gfx950 already ships and dispatches mla_pfl_bf16_a16w16_causal_subQ128_mqa128.co (hsa/gfx950/mla/mla_asm.csv) with the 64-bit KV addressing fix from this PR, so extending the gate just routes to an existing, already-tested kernel. * Revert "[MLA] Route gfx950 128-head bf16 causal qlen>1 decode to the masked prefill kernel too" This reverts commit 2cd4f38. Forcing ps=0 for gfx950 128-head bf16 decode breaks every persistent 128-head bf16 decode on gfx950. The gfx950 block at the end of mla_asm_decode_remap still tests `persistent`, not `ps`, and remaps the shape to gqa 32 / qSeqLen 4. The lookup then asks for (gqa 32, ps 0, qSeqLen 4), which hsa/gfx950/mla/mla_asm.csv does not have, so test_mla_persistent.py, test_mla_persistent_round_robin.py and test_mla_sparse.py fail on MI35X with "cannot get heuristic kernel! ... gqa:32 ps:0 ... qseqlen:4". The CAUSAL_PER_QUERY concern does not need this change. masked_qh128_bf16 only feeds the stage-2 reduction in the non-persistent branch of mla_decode_fwd. That branch passes num_kv_splits_indptr, so persistent is false and ps is already 0 on gfx950: causal qlen > 1 already selects mla_pfl_bf16_a16w16_causal_subQ128_mqa128 there. Persistent decode reduces with mla_reduce_v1 and runs the qh32_qseqlen4 *_ps kernels, which have causal and msk0 variants. * [CI] [MLA] Gate the gfx950-only msk0 test on the live GPU arch get_gfx() returns the last GPU_ARCHS entry. With GPU_ARCHS="gfx950;gfx942" the gate read gfx942 on a gfx950 GPU and skipped the test; with "gfx942;gfx950" it would run the gfx950-only kernel on gfx942. get_gfx_runtime() reads the arch from rocminfo and ignores GPU_ARCHS. --------- Signed-off-by: Jonah Bernard <[email protected]> Co-authored-by: amd-bartgips <[email protected]> Co-authored-by: Jin Pan <[email protected]> Co-authored-by: jatseng-ai <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Jin Pan <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds FlyDSL fused all-reduce + residual add + RMSNorm kernels (exact one-shot, and INT4 mesh/ring) and integrates them into Aiter's communication dispatcher behind
AITER_FLY_AR=1. The kernels extend the plain FlyDSL all-reduce from #5461 with an RMSNorm epilogue. The fused kernels are tuned for PCIe (MI350P) and xGMI (gfx942/gfx950) interconnects. The mesh/ring schedules ofFlyQuickAllReduceare reworked into an epilogue-based design that the plain all-reduce and the newFlyQuickAllReduceRMSNormshare, and the features of #6369 and #6404 carry over to it.QuickAllReduceInt4, a plain alias ofFlyQuickAllReduceonmain, becomes a deprecated subclass that keeps vLLM's old call working.Motivation
Current Aiter all-reduce + RMSNorm kernels are not optimal for PCIe interconnects. The new FlyDSL fused all-reduce + RMSNorm kernels offer the following speedups on MI350P/PCIe:
cdr_fused_1stage)¹ With
AITER_FLY_AR_FUSED_SPLIT=1. With the default (split off), TP=8 decode is 1.68x–2.57x (avg: 1.99x) vscdr_fused_1stageand 1.54x–2.32x (avg: 1.81x) vs the best exact baseline; see the TP=8 decode table.The average is the geometric mean over the message sizes in each regime. Decode covers payloads of 8–168 KiB (M x K with M in {1..16} and K in {4096, 7168, 8192}). Prefill covers payloads of 8–128 MiB (M in {1024, 4096, 8192} and K in {4096, 7168, 8192}, plus 4681 x 7168).
cdr(1-/2-stage), separatecdr+ RMSNorm and separate RCCL + RMSNorm, among those at or above 30 dB SQNR.hip_fused) and Aiter's QR int4 all-reduce followed by a separate RMSNorm (hip+norm), among those at or above 14 dB SQNR.hip_fusedonly runs on rows that divide its 32 KiB tile, so it is not a candidate at K=7168.On PCIe, Aiter's QR int4 is structurally slow at TP>2 because of its un-cached IPC memory.
Relation to PRs #6369 and #6404
This PR targets mainly PCIe interconnects, but it also improves the performance on xGMI interconnects that were the main target of PRs 6369 and 6404. Speedup of this PR over
main(maintime / this PR's time, > 1× means this PR's implementation is faster)Changes
aiter/ops/flydsl/kernels/comm/):one_shot_allreduce_rmsnorm.py(exact 1-stage),quick_allreduce_rmsnorm.py,quick_allreduce_fusions.pyandquick_allreduce_epilogue.py(shared epilogue, row geometry, padding for arbitrary hidden dims, row-split exchange word) for the INT4 mesh and ring schedules.OneShotAllReduceRMSNorm(aiter/ops/flydsl/one_shot_allreduce.py) andFlyQuickAllReduceRMSNorm(aiter/ops/flydsl/quick_allreduce.py). The mesh and ring kernels (quick_allreduce_mesh.py,quick_allreduce_ring.py) are reworked so that the plain and the fused forms share one epilogue interface.QuickAllReduceInt4changes from a plain alias ofFlyQuickAllReduceto a deprecated subclass (see Breaking Changes).kernels/comm/allreduce_shared.pyis renamed totransport.py.allreduce_host_shared.pygains the split-row exchange state in the meta block andcheck_fused_aliasing()(onlyresidual_outmay aliasresidual_in, exactly), and takes the inbox-memory default from the policy (default_inbox_memory).quick_allreduce_codec.pyaccepts any block that is a multiple ofBLOCK_ALIGNup toMAX_BLOCK, which the padded widths need.allreduce_policy.py) with per-(arch, link, world_size)family windows, JSON tuning ladders (configs/comm/fused_allreduce_ladders.json, overridable withAITER_FLY_AR_FUSED_LADDERS), and env overridesAITER_FLY_AR_FUSED_<ALG>_{MIN,MAX}_BYTES,AITER_FLY_AR_FUSED_HIDDENS,AITER_FLY_AR_FUSED_SPLIT.flydsl_backends.py,communicator_cuda.py,custom_all_reduce.py,quick_all_reduce.py): FlyDSL fused path is tried first whenAITER_FLY_AR=1, otherwise the existing fused kernels run. Initialization votes across ranks: a rank that declines alone cannot leave peers waiting in a collective.split_tests.shadds three pytest suites to the standard shard (test_flydsl_allreduce_policy.py,test_flydsl_quick_allreduce_codec.py,test_flydsl_allreduce_rank_agreement.py), andaiter_test.shruns them withpytest.AITER_FLY_AR=1is set.Performance
Hardware: 8x MI350P (gfx950, PCIe), HIP-graph replay timing (graph of 10 calls, 10 timed replays per sample, median of 12 rotated rounds, slowest rank). Representative rows, the full per-shape tables and geomeans are in the collapsible sections below.
cdr_fused_1stagecdr_fused_1stagecdr_fused_1stagehip+norm)hip_fused)hip_fused)Decode TP=8 rows marked ¹ use
AITER_FLY_AR_FUSED_SPLIT=1(opt-in, see Row splitting). Speedup of this PR overmainon xGMI is in the "Relation to PRs #6369 and #6404" table above.Testing
Documentation
Documentation is in
aiter/ops/flydsl/kernels/comm/README.md(routes, windows, ladders, env vars, row splitting, hidden-size preparation). No user-guide or performance-guide page covers the FlyDSL all-reduce path.Dependencies
Breaking Changes
QuickAllReduceInt4changes from a plain alias ofFlyQuickAllReduceto a deprecated subclass inaiter.ops.flydsl.quick_allreduce(still importable fromaiter.ops.flydsl). It keeps the old callQuickAllReduceInt4(group=, device=, rank=, world_size=)working:algorithmdefaults to"mesh", as before,min_bytesdefaults to 0, since the old class had no payload floor and vLLM picks the payloads it sends, andcompile()callspreload(). vLLM'screate_flydsl_quick_all_reduce_int4needs no change. UseFlyQuickAllReduce, which takesalgorithmexplicitly, in new code.aiter/dist/device_communicators/flydsl_utils.pyis removed, its content moved intoflydsl_backends.py.aiter/ops/flydsl/kernels/comm/allreduce_shared.pyis renamed totransport.py. It is an internal kernel module, and every in-tree importer is updated.op_tests/multigpu_tests/test_flydsl_quick_allreduce_int4_rmsnorm.pyis removed, and its tests are folded intotest_flydsl_quick_allreduce.py.AITER_FLY_AR=1. Hence, Aiter's default dispatching behavior does not change.Technical Details
This PR extends the plain
all-reducekernel from #5461 with an RMSNorm eplogue. RMSNorm is row-local, so every kernel maps one workgroup to one token row: the row is reduced across ranks, added to the residual, normalized, and written out (outandresidual_out) from registers. There are three kernel families, each with its own heuristics to pick the best instance:main([FlyDSL] QuickAllReduce INT5/INT6 and all-reduce cleanup #5555), the ring's reduce-scatter lap defaults to INT6 at TP ≥ 4 to hold the 18 dB SQNR floor; the mesh stays INT4 at every world size. Mesh pushes to all peers directly, ring forwards to one neighbour (bandwidth optimal, one destination per store, optimal for a PCIe host). Aimed at large (prefill) messages where bandwidth dominates.A policy picks the family for each message size where it beats the current Aiter kernel, and is integrated into Aiter's communication dispatcher: with
AITER_FLY_AR=1the FlyDSL kernels are tried first and, if not applicable, the existing Aiter fused all-reduce kernels are used.Padding for arbitrary hidden dims. A native build needs the hidden dim to split into whole waves/blocks of threads. Otherwise the build pads: the workgroup is widened to
h_pad(the hidden dim rounded up to the next valid width) and the pad lanes are masked off with a per-row buffer descriptor bounded tohidden * 2bytes, so out-of-bounds loads return 0 and stores are dropped by the hardware. Row strides and the RMS denominator use the true hidden dim, so results are unaffected. The only cost is extra wire volume for the pad columns on the quantized kernels. The only requirement is that the hidden dim is a whole number of 16 B atoms (a multiple of 8 bf16 elements), which makes every hidden dim up to the workgroup limit (1024 threads) addressable. The padding makes the FlyDSL kernels more flexible than the existing HIPqr_int4kernel that is limited to power-of-two hidden dims for BF16/FP16.Dispatch policy and JSON tuning ladders
The fused dispatch makes its decisions on two levels, both keyed by
(arch, link, world_size)withlinkinpcie/xgmi(detected from the KFD topology):FUSED_FAMILY_POLICIESinaiter/ops/flydsl/allreduce_policy.py). Each family has a window of payload sizes. WithAITER_QUICK_REDUCE_QUANTIZATION=INT4, the mesh and ring windows take their payloads first, then the one-shot. Without quantization, only the exact one-shot runs and everything else falls through toCustomAllreduce/ RCCL. The windows can be overridden withAITER_FLY_AR_FUSED_<ALG>_{MIN,MAX}_BYTES.aiter/ops/flydsl/configs/comm/fused_allreduce_ladders.json). The kernel instances are tuned per platform and per hidden size. The ladders live in a JSON file rather than in Python, so a retune replaces one file, and a deployment can pointAITER_FLY_AR_FUSED_LADDERSat its own file without code changes.min_bytesorder, starting at 0.min_bytesis either an integer or a string such as"56 KiB"or"24 MiB". A payload runs on the last rung whosemin_bytesis at most its size. A hidden size with no ladder of its own uses thedefaultladder of its family, so untuned widths still run.atoms(16 B atoms per thread, which sets the block width),grid_cap,fanout(peeroratom), andsplit(the number of workgroups one token row is spread over). Split rungs only take effect withAITER_FLY_AR_FUSED_SPLIT=1, otherwise they run unsplit. Thedefaultladder must not split, because it has to build at every width.super_tileandgrid_cap. The entry setsatoms_per_row(nullmeans the engine default, otherwise it must divide a rank's reduce-scatter chunk of8 / world_sizeatoms). Mesh rungs may also setlow_latencyparameter.benchsweeps of the two multi-GPU tests (--operation ar_rmsnorm --candidates ...). For each world size and width, the fit times every pinned configuration next to the shipping engine and the stock kernels.Row splitting (opt-in)
For small decode batches, one workgroup per token row leaves most of the GPU idle. A split one-shot rung spreads each row over
splitworkgroups. It is off by default (AITER_FLY_AR_FUSED_SPLIT=1turns it on) because the split changes the numerics of the RMSNorm reduction.The workgroups of a split row must combine their partial sums of squares, and every rank must decode exactly the same bits. They therefore join through an integer atomic in HBM, so the row's sum of squares is a fixed-point number instead of an fp32 one. This has three consequences:
epsdominates) can differ from the unsplit build by one bf16 ulp on a small share of lanes (under 1%). Ranks still agree bit for bit.outNaN. The largest sum of squares one wave may contribute depends on the writer count: at 4096 wide andatoms=1(8 writers), a single element ofresidual_outat or above 11585.2 (11648 in bf16) poisons its row, and at 8192 wide (16 writers) 8192 does.residual_outand the other rows are unaffected, and the unsplit build has no such limits. The limits for every writer count are in the README, andtest_one_shot_allreduce_rmsnorm_split_poisonsweeps consecutive bf16 values across each boundary and requires exactly the values at or above it to poison.atoms=1and 31.7k atatoms=2. Wider rows run unsplit.The ladders keep their tuned split rungs either way. With the split off, a split rung runs unsplit with the same
atoms,grid_capandfanout, so by default the exact one-shot always reduces the sum of squares in fp32. The cost is the slower TP8 decode rows marked ¹ in the results.Relation to PR #6369
PR #6369 (merged) added
allreduce_rmsnorm()andallreduce_rmsnorm_mxfp4()to the previousQuickAllReduceInt4design. This PR carries those features over to the epilogue-based mesh/ring design and functionality added in PR #6369 stays available on the new kernels.Tests from PR #6369 are adapted to the new API and folded into
op_tests/multigpu_tests/test_flydsl_quick_allreduce.py. They cover Gemma, in-place, MXFP4 (bit-exact against the unfused quantizer), and the low-latency mesh. The dispatcher (AITER_FLY_AR=1) does not route Gemma norm or MXFP4 output. Both are used through theFlyQuickAllReduceRMSNormAPI directly.Test Plan
Benchmark the new kernels against the existing Aiter kernels using the benchmarking script introduced in #5461, and add fused all-reduce + RMSNorm tests to the existing test suites:
op_tests/multigpu_tests/test_flydsl_one_shot_allreduce.pyop_tests/multigpu_tests/test_flydsl_quick_allreduce.pyTest Result
op_tests/multigpu_tests/test_flydsl_quick_allreduce.pypasses on 8x MI350P (gfx950, PCIe) at TP 2/4/8.Benchmarks were run on 8x MI350P (gfx950, PCIe) with HIP-graph replay timing: a graph of 10 calls, 10 timed replays per sample, and the median of 12 rotated rounds on the slowest rank. Commands:
In the tables,
fly_autois the fused instance the heuristics select, and speedup isbaseline us / fly_auto us.For the decode regime, the first baseline is Aiter's fused 1-stage cross-device-reduce kernel (
cdr_fused_1stage, the production choice for these sizes). The second is the fastest exact stock path, which at TP2 is the two-launchcdr+ RMSNorm. The heuristics select the exact one-shot kernel for every decode size at all three world sizes, so every row is in the geomean.For the prefill regime, the FlyDSL fused QRInt4 kernel (mesh or ring) is compared against the best quantized and the best exact Aiter/RCCL baselines (defined in Motivation). SQNR is reported next to latency because the QRInt4 kernels are lossy. The exact baselines are at 48 dB or above.
Decode shapes
TP=2 (decode)
cdr_fused_1stage(us)cdr_fused_1stagecdr+normcdr+normcdr+normcdr+normcdr+normcdr+normcdr+normcdr+normcdr+normcdr+normcdr+normcdr+normcdr+normcdr+normcdr+normcdr+normTP=4 (decode)
cdr_fused_1stage(us)cdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr+normTP=8 (decode)
cdr_fused_1stage(us)cdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr_fused_1stagecdr+normcdr+normcdr+normcdr+normcdr+norm¹ With
AITER_FLY_AR_FUSED_SPLIT=1: the TP8 ladders for hidden 7168 and 8192 spread a row over several workgroups at these sizes. With the defaultAITER_FLY_AR_FUSED_SPLIT=0, these rows run unsplit at 11.30 µs (1×7168), 12.14 µs (1×8192) and 12.24 µs (2×7168). That is 1.74x, 1.71x and 1.76x faster thancdr_fused_1stage, which brings the TP8 decode geomeans to 1.99x (vscdr_fused_1stage) and 1.81x (vs best stock).Prefill shapes
TP=2 (prefill)
hip_fusedrccl+normhip+normrccl+normhip_fusedrccl+normhip_fusedrccl+normhip+normrccl+normhip+normrccl+normhip+normrccl+normhip+normrccl+normhip+normrccl+normhip+normrccl+normTP=4 (prefill)
hip_fusedrccl+normhip+normrccl+normhip_fusedrccl+normhip_fusedrccl+normhip+normrccl+normhip+normrccl+normhip_fusedrccl+normhip_fusedrccl+normhip+normrccl+normhip_fusedrccl+normTP=8 (prefill)
hip_fusedcdr+normhip+normcdr+normhip_fusedcdr+normhip_fusedcdr+normhip+normcdr+normhip+normcdr+normhip_fusedcdr+normhip_fusedcdr+normhip+normrccl+normhip_fusedrccl+normBetween the regimes (256 KiB–8 MiB, quantized path)
TP=2 (between regimes, quantized path)
hip+normcdr+normhip+normrccl+normhip+normrccl+normhip+normrccl+normhip+normrccl+normTP=4 (between regimes, quantized path)
hip+normrccl+normhip+normrccl+normhip+normrccl+normhip_fusedrccl+normhip+normrccl+normhip_fusedrccl+normTP=8 (between regimes, quantized path)
hip+normcdr+normhip+normcdr+normhip_fusedcdr+normhip_fusedcdr+normhip+normcdr+normhip+normcdr+normPR Self-Review
Reviewed revision
f697884Behavior and intent
With
AITER_FLY_AR=1,fused_allreduce_rmsnormnow tries FlyDSL kernels first: an exact fp32 one-shot all-reduce + residual add + RMSNorm for small (decode) payloads, and INT4 mesh/ring schedules with the RMSNorm applied as an epilogue on the reduced chunk for large (prefill) payloads. A per-(arch, link, world_size)policy and JSON ladders choose the family and configuration. Payloads outside the windows fall through to the existingcdr/RCCL path. The existing behavior is insufficient on PCIe: Aiter's fused 1-stage and QR int4 kernels are slow there (QR int4 is structurally slow at TP>2 because of its un-cached IPC memory), and QR int4 cannot serve non-power-of-two hidden dims. The PR also reworks theFlyQuickAllReducemesh/ring schedules into an epilogue-based design, so the #6369/#6404 features (Gemma norm, in-place, MXFP4 output, low-latency mesh) carry over to the fused kernels. Default behavior is unchanged withoutAITER_FLY_AR=1. The row-split one-shot is a further opt-in (AITER_FLY_AR_FUSED_SPLIT=1) because it changes RMSNorm numerics.Validation and unverified scope
Validated on 8x MI350P (gfx950, PCIe) at TP 2/4/8:
python op_tests/multigpu_tests/test_flydsl_quick_allreduce.pypasses, and the benchmarks in Test Result (--operation ar_rmsnorm --scenario benchfor both multi-GPU tests) produce the speedup tables above with HIP-graph replay timing and an SQNR floor per baseline. The fused one-shot is checked bit-exact onresidual_outand bit-identical across ranks against an fp32 rank-order reference. Unverified or not run: MI250X and MI300X (the gfx942 windows and ladders are not re-tuned here and rely on the xGMI tuning), the row-split path in production beyond its dedicated tests, MI355X tuning of gfx950/xGMI beyond the shipped ladders. The pytest suitesop_tests/flydsl_tests/test_flydsl_allreduce_policy.pyandtest_flydsl_allreduce_rank_agreement.pyare CPU-only andtest_flydsl_quick_allreduce_codec.pyneeds one GPU. All three run in the standard CI shard. The rank-agreement suite is there because its failure mode is a hang (a rank that declines alone leaves its peers waiting in a collective), which only a multi-process test sees, and it needs no GPU: 28 cases in about 75 s, over gloo, with stand-in engines whose constructor is a collective, as the real IPC handle exchange is. The multi-GPU tests are run by the PR's required CI on MI350X (xGMI) only. They have not run on gfx942 or on PCIe in CI (logs from manual runs are attached in the review reply).PR-specific question
The CI change is limited to two shell lists:
.github/scripts/split_tests.shaddstest_flydsl_allreduce_policy.py,test_flydsl_quick_allreduce_codec.pyandtest_flydsl_allreduce_rank_agreement.pyto the aiter test list, and.github/scripts/aiter_test.shruns those three withpython3 -m pytest -q(as it already does fortest_flydsl_pa_decode.py). The skip of theflydsl_allreduce_bench.pyhelper module is already onmain. No workflow file, permission, secret, trigger, orpull_request_targetlogic changes, and the added entries are fixed repo-relative paths, not PR-controlled text. Fork PR code can only reach the same test runner it already reaches today, with no new privileged path.Changed op tests
op_tests/flydsl_tests/test_flydsl_allreduce_policy.py: CPU-only structural checks of the plain and fused dispatch tables, ladder JSON parsing/validation, env overrides, and backend selectors. It fails if a window overlaps, a ladder is malformed, or an override is accepted where it must be rejected. No canonical test covers the new fused policy.op_tests/flydsl_tests/test_flydsl_allreduce_rank_agreement.py(new in the CI list, CPU-only, about 75 s): multi-process checks that a rank that declines or fails to build FlyDSL (including per-width fused builds) makes every rank decline instead of hanging peers in a collective.op_tests/flydsl_tests/test_flydsl_quick_allreduce_codec.py: single-GPU codec checks (memory path equals register path, analytic error bound, degenerate groups, block widths and per-world codec defaults). It covers the shared codec module that the schedules use.op_tests/multigpu_tests/test_flydsl_one_shot_allreduce.py: multi-GPU exact one-shot verify/bench, extended for the fused form (bit-exactresidual_out, padded widths, split rows, split rows with an element above the exchange's range (test_one_shot_allreduce_rmsnorm_split_poison), run-ahead under rank skew, fresh inputs, capture readiness, dispatch), and zero-byte payloads on the plain and fused engines (test_one_shot_allreduce_zero_bytes, a native and a padded width).op_tests/multigpu_tests/test_flydsl_quick_allreduce.py: extended with the fused (ar_rmsnorm) operation next to the plain one; mesh/ring verify and bench, including edge inputs, divisor, transport, run-ahead, padded widths, low latency, Gemma, in-place and zero-byte payloads (test_quick_allreduce_zero_bytes). It absorbs the tests of the deleted_int4_rmsnormfile.op_tests/multigpu_tests/test_flydsl_quick_allreduce_int4_rmsnorm.py: deleted; its coverage (Gemma, in-place, MXFP4, low-latency mesh) is folded intotest_flydsl_quick_allreduce.pyon the new fused API.op_tests/multigpu_tests/flydsl_allreduce_bench.py: shared timing/reporting harness for bothbenchscenarios (one process and input, graph replay, rotated rounds, slowest rank, SQNR floor); a helper, not a test, so it is skipped inaiter_test.sh.