Repository navigation
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
|
Needs owner ruling: should a one-launch LL all-reduce + RMSNorm + FP8 kernel build on this PR, or replace its epilogue? @xytpai
Evidence4 x MI455X, TP4, hidden 6144, bf16, Gemma norm, FP8 per-token quant, graph replay, us a call (measured 10-30 against that day's main):
Residual and FP8 outputs match the split path bit for bit; the bf16 output is within 1 ulp. A MiniMax-M3 layer's AR + norm + quant kernels go from 5 to 2. The branch also lets the two-stage fused path take messages up to 128 MiB instead of 64 MiB. |
|
Rebase needed: new |
…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.
zufayu
left a comment
There was a problem hiding this comment.
AITER SOP code review on current head 8f7115b:
Verified blocker: the new LL CA branch is evaluated before the existing Gluon fused RMSNorm fallback. With AITER_GLUON_FUSED_AR=1 on gfx1250 BF16 (for example hidden size 4096), the new branch can steal traffic from the fused Gluon route and replace it with plain all-reduce plus a separate epilogue, changing backend selection and risking a performance regression.
Primary reviewer: @TennyWang1223 (communication dispatch owner); @zufayu can co-review the norm/quant integration.
Author action: preserve the Gluon route priority, or explicitly exclude Gluon-enabled cases, and add a dispatch regression test with Gluon enabled. Required CI is green, but Multi-GPU Tests were skipped, so fresh gfx1250 TP2/TP4 coverage is still required.
TennyWang1223
left a comment
There was a problem hiding this comment.
Requesting changes. The PR head hasn't changed since the last review, and it now conflicts with main.
-
Please rebase onto current main and resolve the conflict in
op_tests/multigpu_tests/test_fused_ar_rms.py. -
Main now has #8022, which runs all-reduce + RMSNorm + per-token FP8 in one Lamport kernel on gfx1250 (TP2 up to 16 MiB, TP4 up to 8 MiB, hidden a multiple of 256 up to 8192). In the merged tree, the new
elifcomes after that path and after_use_gluon_ar_norm. So it only gets hidden sizes that are a multiple of 32 but not of 256, hidden > 8192, and TP6/TP8. Please list which shapes and TP sizes this PR still covers, and post gfx1250 perf numbers for them against current main. If what's left isn't worth it, please close this
PR. -
Add a
self.gluon_ar is Noneguard to the new branch. If you think the current order is right, benchmark both paths withAITER_GLUON_FUSED_AR=1and post the numbers. -
Update both tests for the new dispatch order:
test_ll_quant_dispatch_guards: the mocks have noshould_lamport_ar_rmsorgluon_ar_plain, so it will raiseAttributeErroron main._ll_quant_worker: it expectsadd_rmsnorm_quantfor(12, 6144)and(341, 6144), but Lamport takes those shapes on main.
Also add a dispatch test with Gluon enabled, and add the
ci:multi-gpulabel so TP2/TP4 runs on gfx1250. That job was skipped on this PR
Summary
Fuse the residual + RMSNorm + per-token FP8 epilogue after the gfx1250
low-latency custom all-reduce, replacing two local kernel launches with one.
The LL all-reduce itself is unchanged.
The existing fused quantizer normally quantizes FP32 normalized values.
The split path first rounds the norm to the input BF16/FP16 dtype.
Add an opt-in
round_before_quant=Falseparameter toadd_rmsnorm_quantto preserve that intermediate rounding and the standalone quantizer's
zero-row scale policy. The default behavior remains unchanged.
A separate template instantiation isolates the new path from legacy
quantization kernels. The rounded instantiation keeps its conversion
runtime-selected to prevent
-ffast-mathfrom folding the narrow/widenconversion and changing split-path rounding (including signed zero).
Dispatch is limited to the existing gfx1250 CA LL fallback:
and large-message fused AR retain their existing paths.
No new environment variables, MiniMax-specific shape dispatch or ATOM changes.
Related: https://github.com/wuhuikx/LLM-Booster/issues/188
This is independent of #7080, which optimizes the large-message second-stage
FP8 amax reduction; this PR targets the LL/small-message fallback.
Validated candidate commit:
8f7115b697e984ef12ffcda4b69919ec7e62bed4.Final-revision performance
4 x gfx1250, 256 CU/device, TP4; BF16 inputs, Gemma norm, hidden 6144.
Baseline:
bbef5a6f2d3733b293c80d2cee6a8d464e88bc01.Image:
rocm/fw-bringup-mlperf:gfx1250-atom-20261023.PyTorch
2.11.0+rocm10.1.0a20260811-bkc.20260820, reported HIP7.16.26315.Separate checkouts, containers and JIT caches; GPUs checked for unrelated
processes before runs. Three runs per side, interleaved base/opt, opt/base,
base/opt. Each graph contains 16 calls, with three traced replays per rank.
For each run, sum local epilogue kernel durations / 48 calls per rank,
then take the median across four ranks; table is the median of three runs.
Trace confirms two -> one epilogue kernels per call (96 -> 48 events
over 48 traced calls). LL communication remains the same kernel. For
6144-wide BF16 rows, M341 is below the 4 MiB threshold; M342 keeps the
existing large-message path. No-quant BF16 remains a control.
These numbers are epilogue-only kernel timings, not end-to-end collective
latency or model throughput. Whole-graph event measurements were noisy and
are not used to claim end-to-end speedup. No GSM8K/model accuracy result
or whole-model throughput improvement is claimed.
Correctness and regression tests
All evidence below was rerun on the final production revision:
512 explicit unsupported-width rejection cases, no failures.
BF16/FP16, ordinary/Gemma norm, multiple seeds, random/zero/exact-cancellation/
small inputs. Includes 32/64/96/128/160 columns to distinguish the
standalone quantizer's floored/non-floored zero-row behavior.
regression: 2 pytest tests passed. Uses existing op-test file,
@benchmark,run_perftest,checkAllclose, and markdown tables withlatency, logical TFLOPS/TB/s and errors.
intermediate dtype semantics, exact residual/FP8/scales, exact cross-rank
and eager/graph agreement, mirror fallback, alignment fallback and the
4 MiB boundary. Replays captured graphs after changing inputs to zero.
QuickReduce, old-arch capability, strided input/residual, FP32, empty,
mirror, unaligned and large-message controls. This is policy coverage,
not hardware validation on gfx950.
ordinary/Gemma norm, norm/FP8/INT8 outputs and per-token/per-group modes.
performance runs matched bit-for-bit, including residual and scales.
Cross-rank agreement was independently checked in each run.
git diff --checkpassed.The unchanged scale convention is intentional: standalone per-token
quantization uses a floor for widths 32/64/128 but zero for all-zero wider
rows. The new mode reproduces this; it does not silently change that API.
Reproduction
In the described gfx1250 environment:
Raw traces, repeated timing samples and additional stress/default-comparison
drivers remain outside the repository. No docs/benchmark artifacts are added.