Repository navigation
[HIP] fea: gfx1250 Lamport AR + RMSNorm: split sends, preloaded arguments, faster reductions - #8559
Conversation
…ents, faster reductions Speed up lamport_ar_rmsnorm_gfx1250 (bf16/fp16 and per-token FP8 out). Same bits as before, the bits of ar_rmsnorm_gfx1250. Kernel: - A row block now owns PACKS packs a thread (1, 2, 4 or 8), and a split mode sends the packs from sender blocks ahead of the row blocks (one pack a thread of a row block); the senders also re-arm. Senders and row blocks count rounds apart: the round counters are now [2][slot/32] (tx, rx), and the one-shot, two-shot and all-gather kernels write both. - LDS-only block barrier for the row reduction (__syncthreads also waits for the remote stores' acks), DPP / permlanex16 wave sums folded into v_add_f32_dpp, one barrier for the row sum. - FP8 amax as unsigned bits (never negative nor NaN): integer DPP max and one ds_max_u32 a wave; the second barrier hands one LDS word around. - Kernel arguments ordered so that up to 4 GPUs every argument the sends and the epilogue read sits in the 30 preloaded dwords; gemma_norm in bit 8 of rank; no gridDim / blockDim reads. - Row mode waits for one non-preloaded kernel argument after its sends: the peers' data arrives sooner (TP4 6144x1 10.4 -> 7.6 us). - Remote stores, polls and re-arms as buffer ops with th:TH_*_BYPASS scope:SCOPE_SYS, as the Gluon all-reduce. - The cluster path is gone (slower than split at every shape). Host: LamportArRms::run picks split for rows of more than 1024 values while TP4 has at most 64 rows (TP2 at most 32K packs), row mode otherwise, with the fewest packs a thread that keep the block at most 256 threads (128 from 257 rows, 64 from 513). Signed-off-by: TennyWang1223 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
|
@aiter-bot review |
|
aiter-bot — queued behind 3 review(s); expect to start in about 66 min. The box reviews one PR at a time. |
Full results: every measured shapeSetup: 4x gfx1250 (256 CU), ROCm 10.1, IPC transport, bf16 input. Each time is one call, in us: a CUDA graph of 10 calls, median of 20 replays, slowest rank, median of 3 rounds. Before (main 3845cd6) and after (this PR 3b15a63) ran 3 times each, alternately; a cell is the median of the 3 runs (run-to-run spread of a shape: median 2%, at most 8%). FP8 out is the fused AR + RMSNorm + per-token FP8 quant. Gluon: Speedup = baseline time / this PR time - 1 (main or Gluon as the baseline). Positive: this PR is faster; +25% means the baseline takes 1.25x the time of this PR. "-" in the Gluon columns: Gluon does not take the shape (above its 4 MiB limit). At TP4 the Lamport cap is 8 MiB, so the larger shapes (e.g. hidden above 4096 at M = 1024) are not measured; at TP2 (16 MiB cap) all are. TP4, bf16 outSpeedup vs main: median +25%, range +1% to +38% over 62 shapes. Speedup vs Gluon: median +19%, range +2% to +45% over 57 shapes.
TP4, FP8 outSpeedup vs main: median +33%, range +6% to +48% over 62 shapes. Speedup vs Gluon: median +19%, range +1% to +46% over 57 shapes.
TP2, bf16 outSpeedup vs main: median +30%, range +5% to +48% over 66 shapes.
TP2, FP8 outSpeedup vs main: median +39%, range +8% to +58% over 66 shapes.
|
aiter-bot
left a comment
There was a problem hiding this comment.
ROCm/aiter PR #8559 — [HIP] fea: gfx1250 Lamport AR + RMSNorm: split sends, preloaded arguments, faster reductions
Review (advisory):
Validation (deterministic): NOT RUN — required, but the PR ships no test target (the changed path is run-time code: the default fused_allreduce_rmsnorm route at TP2/TP4 on gfx1250); auto-validation was also disabled
Perf (advisory): NOT RUN — no perf target: the PR and the repo ship no benchmark entry point for this path, so the author's own before/after tables (a custom harness) are the only timing
Size: 749 lines / 1 files
Design (advisory): split-mode sends with separate tx/rx round counters (sender blocks send and re-arm, row blocks only poll and reduce) replacing the one-counter block-a-row protocol; workgroup-cluster path removed
Human: recommend lirui review the split-mode protocol change in this PR (tx/rx counters, sender-side re-arm, interleaving with the one-shot/two-shot/all-gather kernels) — it must stay bit-exact with the ar_rmsnorm_gfx1250 kernel he authored in #8022
📝 [verified] The red required checks are baseline, not this PR: C++ Interface Tests (MI300X and MI350X-DPX) fail PagedAttentionTest.BasicTest / .MatchesCpuReference identically on the unrelated PR kaiyang-1/mqa_topk_bf16 in the same window, Standard Tests shard 1 fails mla_decode-absorb on MI35X where this kernel is not in the path (plus CK-submodule and wheel-artifact infra noise), and main's own Aiter Test run in the same window fails its wheel build. Reviewer should ask for a re-run only if these persist on an unrelated clean PR.
📝 [verified] At TP6/TP8 the rewritten kernel runs a configuration the author lists as unverified: the split dispatch in csrc/include/custom_all_reduce_gfx1250.cuh takes its world_size >= 4 arm there, p4..p7 sit past the 30 preloaded SGPR dwords (scalar loads on the send path, per the kernel's own comment) and scratch grows to 7 peer packs a thread; the default Lamport cap is 0 at TP6/TP8, so the path is opt-in via AITER_CUSTOM_AR_LAMPORT_RMS_MAX_SIZE. Reviewer should ask whether run() should throw at world_size > 4 until TP6/TP8 are measured.
1 finding(s) posted inline, on the lines they are about:
csrc/include/custom_all_reduce_gfx1250.cuh:1509— The row-mode speedup trick lamport_kernarg_wait (csrc/include/custom_all_reduce_gfx1250.cuh:1509) reads a…
|
@TennyWang1223 Please take a look at the aiter-bot review. It has been over 12 hours without a follow-up commit or explanation. Please address the feedback or leave a brief update on how you plan to proceed. |
lamport_kernarg_wait reads offset 128 of the kernel arguments, which must stay past the 30 preloaded dwords and inside the argument list. Comment only: mark it ATTENTION/TODO so a later argument change that silently loses the gain is easy to trace. No code change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Replies to the aiter-bot review:
|
Conflicts with #8559 (gfx1250 Lamport AR + RMSNorm split sends): - lamport_ar_2shot_gfx1250 keeps this branch's kernel. #8559 made the round counters [2][slot / 32] (tx, rx) and has every Lamport kernel advance both, as a split lamport_ar_rmsnorm_gfx1250 reads the rx counters; both branches of this kernel now do (advance_round). - LamportArRms keeps num_cus, which #8559 dropped with the cluster path: run_2shot's split layout (a block a CU) reads it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t first where it runs Since #8559 the Lamport one-shot AR + RMSNorm is the fastest of the three gfx1250 TP4 kernels wherever it can take the call: 4x MI455X, CUDA graphs, arms interleaved in one process, hidden 1024 / 2048 / 4096 / 8192, 1 row to the 8 MiB cap. The Gluon power-of-2 kernel took 1.01-4.6x its time (also at 1024 / 2048, which the first commit kept on it) and the Gluon per-token kernel 0.96-1.27x up to 128 rows, bf16 and per-token FP8 out alike. fused_allreduce_rmsnorm now takes Lamport before both Gluon kernels, and _use_gluon_ar_norm declines what Lamport can take, so the per-token FP8 route (fused_allreduce_rmsnorm_quant) takes Lamport first too. The Gluon kernels keep the calls Lamport cannot take: hidden outside its range (not a multiple of 256, or past 8192, e.g. 16384 for the power-of-2 kernel) or past its size cap. _GLUON_AR_MAX_HIDDEN_WITH_LAMPORT and _GLUON_AR_NORM_MAX_TOKENS go. Bits: at the calls that move to Lamport the output has Lamport's bits (another reduction order than either Gluon kernel). The dispatch op test now checks the route of each call (Lamport at power-of-2 hidden 2048 from 1 row to 8 MiB and at 7168 / 4096 per-token, the power-of-2 kernel at 16384, the Gluon per-token kernel at 6152) and its values against the reference of the kernel that took it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t runs Re-measured on ROCm#8559's Lamport kernel (this branch's base), the Lamport MXFP8 kernel is as fast as the Gluon MXFP8 kernel or faster at every shape where both run: 4x MI455X, TP4, bf16, CUDA graphs, arms interleaved in one process, hidden 1024-8192 (10 sizes) x 1-256 rows, the Gluon kernel never more than 3% faster. The rule that gave Gluon up to 128 rows while no wave of its program idles (norm_waves_busy) lost up to 21% (1.9 us) against the faster of the two; Lamport first loses nothing. The 4 MiB bound over the Gluon power-of-2 route at hidden up to 1024 (_GLUON_POW2_LAMPORT_MXFP8_MAX_BYTES) also goes: at 1024 x 3072 / 4096 rows (6 / 8 MiB) the Lamport MXFP8 kernel takes 0.89-0.90x the time of fused_allreduce_rmsnorm + per_1x32_mx_quant_hip (it was 1.03-1.04x on the previous kernel). fused_allreduce_rmsnorm_mxfp8_quant now takes Lamport wherever should_lamport_ar_rms holds, else the Gluon MXFP8 kernel where _use_gluon_ar_norm takes the call (now main's gate unchanged), else fused_allreduce_rmsnorm and the quant. norm_waves_busy goes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* [Triton/Gluon] [Perf] Fuse gfx1250 AR RMSNorm native MXFP8
tensor_model_parallel_fused_allreduce_rmsnorm_quant(quant_type="mxfp8")
(and tensor_model_parallel_fused_allreduce_rmsnorm_mxfp8_quant) returns E4M3
values with row-major group-32 E8M0 scales. On gfx1250, where the per-token
Gluon AR + RMSNorm kernel takes the call (up to 128 rows where the Lamport
one-shot applies), it runs that kernel with an MXFP8 epilogue (QUANT=2);
otherwise fused_allreduce_rmsnorm followed by per_1x32_mx_quant_hip, the same
bytes. The op is registered with mutates_args=[] (it writes no argument;
Inductor cannot remove an auto_functionalized_v2 that returns E8M0).
- the Gluon kernel keeps its QUANT parameter (2 = MXFP8), so the per-token
path is untouched;
- one quant_type alias ("mxfp8"); group_size is not required, as for mxfp4;
the option check (no emit_bf16) is in GroupCoordinator only;
- the calls are traced under AITER_AR_ROUTE_TRACE as the other fused routes;
- test_fused_allreduce_rmsnorm_dispatch checks the bytes against
fused_allreduce_rmsnorm + per_1x32_mx_quant_hip at hidden 2880 / 7168 /
6144, on the Gluon kernel and past it.
Hidden 6144 bf16, TP4, Gemma norm, CUDA graphs, 4x MI455X, us per call
(cap at 128 rows vs. one-shot everywhere up to 4 MiB):
rows 128 192 256 320 384 512
before 14.6 25.8 26.1 28.5 26.7 29.1
after 14.7 18.3 19.5 25.9 26.3 29.3
Co-authored-by: Cursor <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* [HIP] [Perf] gfx1250 AR + RMSNorm: MXFP8 out of the Lamport one-shot in one kernel
fused_allreduce_rmsnorm_mxfp8_quant ran the Lamport one-shot AR + RMSNorm and
then per_1x32_mx_quant_hip wherever the Gluon kernel did not take the call.
lamport_ar_rmsnorm_gfx1250 now also has an MXFP8 epilogue (template flag MX,
off by default), the steps and helpers of per_1x32_mx_quant_hip on gfx1250: a
group of 32 is pack k of 4 neighbouring lanes (two lamport_xor_lane steps),
the amax starts at kAmaxFloor, the scale is fp_f32_to_e8m0_scale<RoundUp>
capped at 2^127 and v_cvt_scalef32_pk8_fp8_{bf16,f16} converts; one row-major
E8M0 byte a group. It runs in every launch layout of the kernel (split sends,
1-8 packs a thread) and shares the sum of squares of the bf16 / fp16
instantiation (the kernel is uncontracted), so the bytes are those of
lamport_fused_ar_rms and the quant.
fused_allreduce_rmsnorm_quant_lamport takes it when scale_out is E8M0 (no new
pybind symbol); CustomAllreduce.lamport_fused_ar_rms_mxfp8 wraps it, and the
MXFP8 route takes it wherever should_lamport_ar_rms holds and the Gluon kernel
does not. Where both can run, the Gluon kernel keeps up to 128 rows only while
no wave of its program idles (norm_waves_busy: cdiv(hidden, 768) a power of
two); elsewhere the Lamport kernel was as fast or faster (TP4, 10 hidden sizes
from 1024 to 8192, 1-256 rows: mean 0.8% from the faster of the two). Where
fused_allreduce_rmsnorm takes the Gluon power-of-2 kernel (the Gluon all-reduce
on), the Lamport MXFP8 kernel takes the call up to 4 MiB
(_GLUON_POW2_LAMPORT_MXFP8_MAX_BYTES): at hidden 1024 from 6 MiB that kernel and
the quant were faster.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* [Perf] gfx1250 MXFP8 AR + RMSNorm: the 4 MiB bound over the Gluon power-of-2 route only up to hidden 1024
At hidden 2048 / 4096 / 8192 the Lamport MXFP8 kernel is faster than the
Gluon power-of-2 AR + RMSNorm and the quant up to the 8 MiB cap (0.64-0.94x
at 6 and 8 MiB); only hidden 1024 was slower from 6 MiB. Keep main's route
above 4 MiB for power-of-2 hidden up to 1024 only.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* [Perf] gfx1250 MXFP8 AR + RMSNorm: the Lamport one-shot first where it runs
Re-measured on #8559's Lamport kernel (this branch's base), the Lamport
MXFP8 kernel is as fast as the Gluon MXFP8 kernel or faster at every shape
where both run: 4x MI455X, TP4, bf16, CUDA graphs, arms interleaved in one
process, hidden 1024-8192 (10 sizes) x 1-256 rows, the Gluon kernel never
more than 3% faster. The rule that gave Gluon up to 128 rows while no wave
of its program idles (norm_waves_busy) lost up to 21% (1.9 us) against the
faster of the two; Lamport first loses nothing.
The 4 MiB bound over the Gluon power-of-2 route at hidden up to 1024
(_GLUON_POW2_LAMPORT_MXFP8_MAX_BYTES) also goes: at 1024 x 3072 / 4096 rows
(6 / 8 MiB) the Lamport MXFP8 kernel takes 0.89-0.90x the time of
fused_allreduce_rmsnorm + per_1x32_mx_quant_hip (it was 1.03-1.04x on the
previous kernel).
fused_allreduce_rmsnorm_mxfp8_quant now takes Lamport wherever
should_lamport_ar_rms holds, else the Gluon MXFP8 kernel where
_use_gluon_ar_norm takes the call (now main's gate unchanged), else
fused_allreduce_rmsnorm and the quant. norm_waves_busy goes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* [API] gfx1250 fused AR + RMSNorm quant: quant_type + quant_dtype pick the epilogue
quant_type names the quant block (per_Token / per_1x128 / per_1x32) and the new
quant_dtype the element type: per_1x32 with fp8 is MXFP8, with fp4x2 (the default, as
before) MXFP4. MXFP8 is the first group quant routed through
fused_allreduce_rmsnorm_group_quant, with its spec in aiter/dist/ar_rms_group_quant.py:
one torch.compile op, one route (Lamport, then Gluon, then the split path) and one
Lamport wrapper, all keyed by the group quant, so another group size (1x128) is a table
entry and the kernels that have its epilogue. The "mxfp8" name stays an alias;
tensor_model_parallel_fused_allreduce_rmsnorm_mxfp8_quant goes. Kernels and bytes
unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* [Refactor] fused AR + RMSNorm quant epilogues defined in aiter/dist/ar_rms_quant.py
The (quant_type, quant_dtype) pair table, the name aliases, the default element types,
the canonicalization and the group-quant specs move into one module, so an epilogue is
defined in one place: communication_op keeps the public API and imports it; the
torch.compile op, the route and the Lamport wrapper read the specs from it.
ar_rms_group_quant.py goes. No behavior change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* [HIP] [Refactor] gfx1250 Lamport AR + RMSNorm: one LamportRmsQuant epilogue enum, not bool mx
The FP8 epilogue of lamport_ar_rmsnorm_gfx1250 was a bool template parameter (MX:
per-token or MXFP8) and a bool argument of the entry: a third epilogue (FP8 1x128)
would take another flag and conditions like QUANT && !MX && !G128. LamportRmsQuant
names the epilogue instead (kPerToken, kMxfp8): one template parameter, a switch in
the dispatch (-Wswitch flags a missing case), a static_assert in the kernel for an
enumerator without its branch, and lamport_rms_quant_of reads it from the scale's
layout in one place. Same kernels: every instantiation's ISA and kernel descriptor
are identical to before.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* [Refactor] one Lamport AR + RMSNorm quant wrapper for per-token FP8 and group quants
lamport_fused_ar_rms_group_quant folds into lamport_fused_ar_rms_quant: quant=None is the
per-token FP8 quant as before (same call, same outputs, emit_bf16), a group quant spec
lays out its outputs from the spec. Both call the same C++ entry, which picks the
epilogue by the scale's layout (LamportRmsQuant); emit_bf16 stays per-token only.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Speed up
lamport_ar_rmsnorm_gfx1250, the gfx1250 Lamport one-shot all-reduce + residual add + RMSNorm (bf16/fp16 out, and per-token FP8 out in the same kernel). It is the default route offused_allreduce_rmsnorm(_quant)at TP2/TP4 up to the Lamport cap. The output keeps the same bits (those ofar_rmsnorm_gfx1250).On 4x gfx1250, against main (median over 6 hidden sizes x 11 row counts): TP4 1.25x faster with bf16 out and 1.33x with FP8 out, TP2 1.30x and 1.39x. No measured shape is slower.
The fused AR + RMSNorm + per-token FP8 quant gains the most. Its cost over the bf16 out of the same shape drops by about 70%: at TP4 from a median 0.89 us (1.09x the bf16 time) to 0.25 us (1.03x). The default path is now also faster than the opt-in Gluon
all_reduce_rmsnorm_per_token_quant(#8022) at every measured TP4 shape, bf16 and FP8 out (median 0.84x of its time). On main it was slower than the Gluon kernel at 40 of 57 shapes with bf16 out and 46 of 57 with FP8 out.Only
csrc/include/custom_all_reduce_gfx1250.cuhchanges. The Python routing is unchanged, the Gluon paths included.Motivation
On main, the kernel has one block a row, or one workgroup cluster a row while the rows leave CUs idle. Measured costs:
__syncthreads()also waits for the acks of the wave's remote stores, about one more fabric trip.scale_outandbf16_outputas non-preloaded kernel arguments after the poll. At TP4 the FP8 out costs a median 0.89 us more than the bf16 out.LamportPeers), so the arguments after it are scalar loads; the epilogue (gemma_norm,scale_out,bf16_output) waits for them after the poll.Changes
csrc/include/custom_all_reduce_gfx1250.cuh:[2][slot / 32](tx, rx). The one-shot, two-shot and all-gather kernels write both, so all Lamport ops still interleave.PACKSpacks (1, 2, 4 or 8). After its sends, a row block waits for one non-preloaded kernel argument before it polls. Measured: the peers' data arrives sooner (TP4 6144x1 in row mode 10.4 -> 7.6 us). As_sleepof any length does not give this gain, and the mechanism is not proven (the load seems to return after the sends left).bound_ctrl, folded intov_add_f32_dpp; the adds keep the order ofblock_allreduce_f32. One barrier: every wave adds the partials itself.fmaxfdrops NaNs), so its bits order as unsigned integers. Each thread takes the max of its packs, then an integer DPP max over the wave (v_max_u32_dpp), then oneds_max_u32a wave into an LDS word zeroed before the sum barrier. After the second barrier every thread reads that one word: no second wave reduction and no memory round trip.scale_outandbf16_outputare preloaded arguments. The scale,rcp, clamp andcvt_pk_fp8steps are those ofar_rmsnorm_gfx1250, so the FP8 out and its scale keep their bits.p0..p3(one pointer a peer),scale_out,bf16_output,eps,send_packs;gemma_normis bit 8 ofrank;p4..p7come last. NogridDim/blockDimreads (they are hidden kernel arguments).th:TH_*_BYPASS scope:SCOPE_SYS, as the Gluon all-reduce. Offsets are from the inbox slot, so they fit 32 bits at any cap.LamportArRms::run): split for rows of more than 1024 values while TP4 has at most 64 rows (TP2: at most 32K packs, rows x hidden / 8). Row mode otherwise, with the fewest packs a thread that keep the block at most 256 threads (128 from 257 rows, 64 from 513). Over TP2/TP4, hidden 1024-8192, M 1-2048, bf16 and FP8 out, this choice is 0.1% (TP4) / 1.4% (TP2) slower on average than the best of six fixed configurations at each shape.cluster_partialsand its allocation.Performance (if applicable)
Setup: 4x gfx1250 (256 CU), ROCm 10.1, IPC transport, bf16 input.
CustomAllreduce.lamport_fused_ar_rms(_quant)in a CUDA graph of 10 calls, median of 20 replays, slowest rank, median of 3 rounds. Before (main 3845cd6) and after (this PR) ran 3 times each, alternately; the tables give the median of the 3 runs (run-to-run spread of a shape: median 2%, at most 8%). Gluon:all_reduce_rmsnorm_per_token_quant(#8022,AITER_GLUON_FUSED_AR=1) in the same process, where it takes the shape.Over 6 hidden sizes (2048-8192) x 11 row counts (1-1024):
FP8 out against bf16 out of the same shape (the cost of the fused per-token quant), median (range):
Selected shapes (us):
Full results
Every measured shape, from the same runs. "-": the shape is above the Lamport cap (8 MiB at TP4), or Gluon does not take it.
TP4, bf16 out: main us → this PR us (speedup); median 1.25x, 1.01-1.38x over 62 shapes
TP4, per-token FP8 out: main us → this PR us (speedup); median 1.33x, 1.06-1.48x over 62 shapes
TP4, bf16 out: this PR us / Gluon us (ratio, below 1 is faster); median 0.84, worst 0.984; main was slower than Gluon at 40 of 57
TP4, per-token FP8 out: this PR us / Gluon us (ratio, below 1 is faster); median 0.84, worst 0.992; main was slower than Gluon at 46 of 57
TP2, bf16 out: main us → this PR us (speedup); median 1.30x, 1.05-1.48x over 66 shapes
TP2, per-token FP8 out: main us → this PR us (speedup); median 1.39x, 1.08-1.58x over 66 shapes
Testing
Tested on 4x gfx1250 (see "Validation and unverified scope").
Documentation
The change is internal to the kernel and its launcher; the comments in the code describe the modes.
Dependencies
Breaking Changes
None. Same outputs and bits, same API, same routing. Device memory: the round counter allocation doubles (the rx counters, 4 bytes a group of 32 packs, 64 KiB at the TP4 cap) and the
cluster_partialsallocation (8 bytes a group) is gone; the inbox is unchanged.PR Self-Review
Reviewed revision
5cded34
Behavior and intent
Only speed changes. The kernel keeps the arithmetic of
ar_rmsnorm_gfx1250step by step (rank-order fp32 sum rounded to T, fp32 residual add, the same square-sum order, the same per-token FP8 steps), so out, residual_out, the FP8 out and its scale keep their bits. The Python routing is unchanged: the default path takes this kernel where it did before, andAITER_GLUON_FUSED_AR=1keeps its Gluon routes (their numerics differ from this kernel's).Validation and unverified scope
4x gfx1250, ROCm 10.1, bf16 unless stated:
op_tests/multigpu_tests/test_fused_ar_rms_lamport.py, TP2/TP4, bf16 and fp16, bf16 and FP8 out: hidden 1024-8192 and M around every mode switch (64/65, 256/300, 512/600), and the default set: 0 bit differences againstar_rmsnorm_gfx1250; the mixed sequence (shapes, bf16/FP8, NaN, unaligned operands, graph) 0 bit differences.gemma_norm=Truechecked separately againstcustom_fused_ar_rms(_quant): 0.gfx1250_poc/test_gfx1250_lamport_allreduce.py(route by size and by M, mixed sequence of one-shot, two-shot, AR + add, AR + RMSNorm, all-gather),test_ar_add_lamport.py,test_ag_lamport.py,gfx1250_poc/test_gfx1250_allgather.py,test_custom_ar_fused_interleave.py --tp 4: pass, 0 bit differences.test_custom_allreduce.py --regressionTP4 and TP2,test_custom_allreduce_rank_order.py,test_custom_allreduce_size_env.py,test_fused_ar_rms.py -t 4and-t 2,tests/test_ar_rmsnorm_routing.py,triton_test/test_all_reduce_rmsnorm_quant.py(the Gluon paths withAITER_GLUON_FUSED_AR=1): pass.What remains unverified: TP6/TP8 (this machine has 4 GPUs; the Lamport cap is 0 there by default, so these sizes do not take the kernel unless
AITER_CUSTOM_AR_LAMPORT_RMS_MAX_SIZEsets a cap), fp16 performance (fp16 correctness is tested), and other gfx1250 SKUs.PR-specific question
Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching it?
The changed path is
lamport_ar_rmsnorm_gfx1250and its launcherLamportArRms::run(plus the rx counter write at the end of the other Lamport kernels). The kernel is reached only throughCustomAllreduce.lamport_fused_ar_rms(_quant), which the routing calls only whenshould_lamport_ar_rmsholds. This PR does not change that gate:_init_lamport_ar_rmsset up the inbox and the size cap; elsewhere_lamport_max_bytesstays 0 and the gate is false.Inside,
run()checks hidden and the cap again and throws if they fail, so no unsupported input launches the kernel. The mode (split or row) and the packs a thread depend only on rows, hidden and world size, so every rank launches the same grid. Both modes compute the same bits, checked bit for bit againstar_rmsnorm_gfx1250on both sides of every mode switch.Changed op tests
None.
🤖 Generated with Claude Code