Repository navigation
Conversation
lirui927
force-pushed
the
xiaobingsuper/m3-mi455-perf-stack
branch
from
November 10, 2026 07:46
2c8902d to
3499407
Compare
lirui927
force-pushed
the
fuse/f1a-ar-norm-quant
branch
2 times, most recently
from
November 12, 2026 04:45
d2ac969 to
77aa016
Compare
lirui927
changed the base branch from
xiaobingsuper/m3-mi455-perf-stack
to
main
November 12, 2026 04:45
On gfx1250 decode, the LL path of fused_allreduce_rmsnorm[_quant] runs the gluon plain all-reduce and then a separate HIP add_rmsnorm(_quant) kernel. Fold residual add, Gemma/plain RMSNorm and the optional per-token FP8 quant into the epilogue of the existing _all_reduce_kernel, so each call is one launch: - senders are unchanged in role; epilogue launches run 8 waves per program, one 384-value chunk per wave - one receiver program owns a whole row, one wave per slab; the sum of squares and the row max are reduced through LDS in the HIP kernel's order, so outputs are bitwise equal to all-reduce + add_rmsnorm_quant - without the epilogue the kernel compiles to the same instructions - CudaCommunicator routes hidden 6144, M <= AITER_GLUON_AR_NORM_MAX_TOKENS (default 256) to it; AITER_GLUON_AR_NORM=0 keeps the previous path TP4 MI455X, HIP graph replay, slowest rank, per call (M16 / M64 / M256): FP8 path 7.84 / 9.54 / 19.92 -> 6.41 / 8.06 / 16.23 us, bf16 path 7.59 / 9.24 / 20.10 -> 5.99 / 7.95 / 15.88 us versus the LL quant epilogue alone. Part of wuhuikx/LLM-Booster#393. Co-Authored-By: Claude Opus 5.5 <[email protected]>
lirui927
force-pushed
the
fuse/f1a-ar-norm-quant
branch
from
November 12, 2026 08:11
77aa016 to
980096b
Compare
lirui927
marked this pull request as ready for review
November 12, 2026 08:16
…pilogue all_reduce_rmsnorm took only hidden 6144. A row is now cdiv(hidden, 384) chunks with a partial last chunk; a program runs norm_waves(hidden) waves (the next power of 2 of cdiv(hidden, 768), at most 32), 2 chunks a receiver wave. Values past the row are masked: senders post every line of a chunk (0 past the row, with the tag), receivers do not poll chunks past the row. Hidden 6144 keeps its 8 waves, unmasked senders and the HIP reduction order, so it stays bitwise equal to all-reduce + add_rmsnorm(_quant). norm_waves is the one dispatch rule: hidden a multiple of 8, 8 to 24576. Tests grade the other sizes against an fp32 reference (residual_out exact, out within 1 bf16 ulp or 1 FP8 code, scale within 1 bf16 ulp of the row max) and replay a graph into NaN-filled outputs. The dispatch mock gains the attributes the base branch now reads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
valarLip
requested changes
Nov 13, 2026
valarLip
left a comment
Collaborator
There was a problem hiding this comment.
⚠️ Action required before merge (5)
- Drop the bf16
fused_allreduce_rmsnormbranch, or show it beats Lamport on current main.aiter/dist/device_communicators/communicator_cuda.py:501-519runs after the gfx1250 Lamport one-shot AR+RMSNorm (:420,custom_all_reduce.py:2273). Lamport is on by default for TP4 up to 8 MiB, hidden%256==0, hidden<=8192, so it takes 4096/6144/7168/8192 decode. The existing Gluon fused kernel (:388) takes power-of-2 hidden before Lamport does. Your dispatch tests only reach the new branch because they mockshould_lamport_ar_rms=Falseandgluon_ar=None(test_fused_ar_rms.py:1473,1483). The bf16 "before" numbers come from2c8902d, which predates #7499 (Lamport). Either remove the branch or post a TP4 A/B against Lamport for the sizes it is meant to serve. - Extend the existing Gluon fused kernel instead of adding a second AR+RMSNorm(+FP8) op, or explain in the PR why you can't.
aiter/ops/triton/comms/fused/all_reduce_rmsnorm_quant.py:19(_all_reduce_rmsnorm_kernel) already fuses AR + residual + RMSNorm + FP8 on gfx1250. It is missing per-token scale and non-power-of-2 hidden. The newall_reduce_rmsnorm(aiter/ops/triton/comms/all_reduce.py:124) has the same signature and a different scale contract:(tokens,1)vs(tokens,hidden//128). Duplicates like this are whataiter/ops/triton/README.md:15forbids. If two kernels really have to stay, give the new op a name that says per-token, and state the reason in the PR. - Remove the
getattrdefense for test mocks.communicator_cuda.py:36usesgetattr(comm, "gluon_ar_norm", False), but__init__and thereuse_frompath always set the attribute. Usecomm.gluon_ar_normand addgluon_ar_norm=Falseto theSimpleNamespacecomms intest_fused_ar_rms.pythat don't set it (e.g. the one patched at:1329). - Re-measure the FP8 path against its real base. The table compares against
2c8902d, not main + #7082. Post per-call µs for main+#7082 (LL AR +add_rmsnorm_quant) vs this PR at M 1/16/64/256, hidden 6144, plus at least one end-to-end decode number from the ATOM consumer (ATOM_ENABLE_GLUON_FUSED_AR, per-tokenfused_allreduce_rmsnorm_quant). - Rebase on main after #7082 lands, get CI green, and fix the small items. The base is
lirui927/stack-on-7082, so no CI has run ona65bc68b3. Small items: the comment atcommunicator_cuda.py:507("the HIP add_rmsnorm below") describes the fallback, not this branch. The_gluon_ar_norm_commdocstring says only transport is mocked, butall_reduceis aMock. Passquant=by keyword at bothall_reduce_rmsnormcall sites.
Reviewed at a65bc68. Stacked on unmerged #7082. #7445 (HIP fused-AR barrier) touches a different kernel and merges cleanly with this PR.
Contributor
Author
lirui927
pushed a commit
that referenced
this pull request
Nov 16, 2026
lirui927
pushed a commit
that referenced
this pull request
Nov 16, 2026
…launch The all_reduce_rmsnorm epilogue of #7396, on main and without #7082. The plain Gluon all-reduce (_all_reduce_kernel, set up on TP4 with AITER_GLUON_FUSED_AR=1) gains an optional epilogue: residual add, RMSNorm and optionally the per-token FP8 quant, so the call is one launch. Any hidden that is a multiple of 8 up to 24576 works (norm_waves). At hidden 6144 the outputs are bit for bit those of the same all-reduce followed by add_rmsnorm (and the per-token quant of its bf16 out); other sizes are within 1 bf16 ulp or 1 FP8 code of an fp32 reference. Without the epilogue the kernel is unchanged. CudaCommunicator, TP4, bf16 in: all_reduce_rmsnorm takes calls up to the 4 MiB of the plain all-reduce, but only up to _GLUON_AR_NORM_MAX_TOKENS (128) rows where the Lamport one-shot could take them, as Lamport is faster past that. The #6923 Gluon AR + RMSNorm keeps its bf16 sizes (power-of-2 hidden), and emit_bf16 stays on Lamport. AITER_GLUON_AR_NORM=0 turns the new path off. TP4 MI455X, HIP graph replay, slowest rank, hidden 6144, per call (M1 / M16 / M64 / M128), against the Lamport kernels: FP8 7.58 / 8.70 / 10.01 / 13.29 -> 5.74 / 6.68 / 8.09 / 11.42 us, bf16 6.74 / 7.54 / 8.85 / 11.94 -> 5.54 / 6.24 / 7.72 / 11.10 us. Part of wuhuikx/LLM-Booster#393. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit e0fe5ee) Conflict: aiter/dist/device_communicators/communicator_cuda.py, the same qr_comm line as in the previous commit; kept.
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.
Stacked on #7082 (base branch
lirui927/stack-on-7082= currentmain+ #7082). Once #7082 lands, this PR will be rebased ontomain.What this PR does
On gfx1250 TP4 decode (small M), each row-parallel output goes through all-reduce, residual add, RMSNorm, and, before an FP8 GEMM, a per-token FP8 quant. Today that takes 2–3 kernel launches. This PR reduces it to one.
fused_allreduce_rmsnorm_quantused to skip the LL all-reduce +add_rmsnorm_quantpath whenever QuickReduce was enabled. It now skips that path only when QuickReduce would actually take the message. Decode sizes get the 2-kernel path; large prefill messages stay on QuickReduce._all_reduce_kernelgains an optional epilogue (bf16 norm, or norm + per-token FP8), so the whole call is one launch. It works for any hidden size that is a multiple of 8, up to 24576. A row is split intocdiv(hidden, 384)chunks over a power-of-two number of waves, with the last chunk masked. The supported range comes from one helper,norm_waves(hidden), which the dispatch also uses.add_rmsnorm(_quant), so outputs are bitwise identical. Other sizes are within 1 bf16 ulp or 1 FP8 code of an fp32 reference.AITER_GLUON_AR_NORM_MAX_TOKENS(default 256).AITER_GLUON_AR_NORM=0turns it off; larger M keeps the existing routes.Benefit
Against the previous stack (hidden 6144, time per call in µs; MI455X x4, TP4, HIP graph replay, slowest rank, median of 4 rounds; A/A noise <= 0.13 µs):
"Before" was measured on the earlier gfx1250 perf stack (
2c8902d), not onmain+ #7082.Other hidden sizes: fused vs unfused (Gluon all-reduce +
add_rmsnorm(_quant)), µs, same setup, M16 / M64 / M256:Fused is faster at every size and M measured (M 1–256): 2–23% faster than unfused. Supporting arbitrary hidden did not slow down 6144: A/B against the 6144-only version is within ±0.1 µs for bf16 and 0.1–0.4 µs faster for FP8.
Testing
op_tests/multigpu_tests/triton_test/test_all_reduce_rmsnorm.pyon TP4: hidden 6144 bitwise against all-reduce +add_rmsnorm(_quant); hidden 2048/4096/5120/6152/7168/8192/16384 at M 1/7/64 within 1 bf16 ulp / 1 FP8 code of an fp32 reference; graph replay mixing sizes into NaN-filled outputs.op_tests/multigpu_tests/test_fused_ar_rms.pydispatch tests (20 passed): any supported hidden takes the fused path (including 4096); sizes it cannot serve do not.