Repository navigation
[Triton/Gluon] [HIP] gfx1250 all-reduce + RMSNorm + per-token FP8 in one kernel - #8022
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
ef3f765 to
2935fe1
Compare
On gfx1250, fused_allreduce_rmsnorm_quant (per-token FP8) ran the Lamport one-shot AR + RMSNorm and then a separate per-token quant kernel up to 4 MiB, and custom_fused_ar_rms_quant above that. lamport_ar_rmsnorm_gfx1250 now also takes an FP8 output type: its epilogue then does the per-token quant of ar_rmsnorm_gfx1250 (amax of the rounded bf16/fp16 output, scale = amax / FP8 max, rcp, clamp, cvt_pk), so the call is one launch and the FP8 out and scales are bit for bit those of custom_fused_ar_rms_quant. In cluster mode the row amax goes through the cluster partials after a second cluster barrier. With emit_bf16 the kernel also writes the bf16/fp16 output. fused_allreduce_rmsnorm_quant takes it wherever should_lamport_ar_rms does (hidden a multiple of 256 up to 8192; TP4 up to 8 MiB, TP2 up to 16 MiB). Other calls keep their route. The kernel keeps its argument layout, with scale_out and bf16_output last, so its bf16/fp16 instantiations keep main's instructions byte for byte (only the kernarg segment grows), and so do the other kernels of the module. The FP8 instantiations use the registers of the bf16 ones. test_fused_ar_rms_lamport.py checks the FP8 out, scale and emit_bf16 output bit for bit against custom_fused_ar_rms_quant and against Lamport bf16 + the per-token quant, also in its mixed sequence, and now fails on any bit difference. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…one launch all_reduce_rmsnorm_per_token_quant runs the plain Gluon all-reduce (_all_reduce_kernel, set up on TP4 with AITER_GLUON_FUSED_AR=1) with an epilogue: residual add, RMSNorm (plain or Gemma) and optionally the per-token FP8 quant, in one launch of _all_reduce_rmsnorm_kernel. Rows go through the chunks and inboxes of the plain all-reduce, so any hidden that is a multiple of 8 up to 24576 works and plain and fused calls share the inboxes. At hidden 6144 the outputs are bit for bit those of the plain 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. _all_reduce_kernel is unchanged, to the byte of its ISA. Unlike all_reduce_rmsnorm_quant (power-of-2 hidden, one scale for each 128 values, inboxes for one hidden size), the scale is one value a row, the (tokens, 1) of fused_allreduce_rmsnorm_quant(quant_type="per_token"). CudaCommunicator, TP4, bf16 in: the op 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 gate does not look at operand addresses, so all ranks take the same kernel; an unaligned operand is copied. all_reduce_rmsnorm_quant keeps its bf16 sizes (power-of-2 hidden), and emit_bf16 stays on Lamport. Tests: the kernel cases go into test_all_reduce_rmsnorm_quant.py next to those of the other Gluon AR + RMSNorm op, with its dispatch test checking the new route; the routing runs on the CPU in tests/, which CI runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2935fe1 to
d7de084
Compare
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 |
There was a problem hiding this comment.
🟡 Changes recommended
The fused FP8 path omits the required zero-row scale floor for widths 32, 64, and 128, and the new tests do not fail when reference errors exceed the accepted threshold.
2 open issues
What changed in this PR
This PR fuses all-reduce, residual addition, RMSNorm and per-token FP8 quantization on gfx1250, reducing kernel launches in AITER’s distributed communication paths.
Changes:
- Extends HIP Lamport kernels with per-token FP8 output, row scales and optional bf16/fp16 output.
- Adds a TP4 Gluon fused operation and routes supported calls through it.
- Expands numerical, graph-replay and routing tests.
| File | Description |
|---|---|
tests/test_ar_rmsnorm_routing.py |
Adds CPU tests for dispatch limits and precedence. |
op_tests/multigpu_tests/triton_test/test_all_reduce_rmsnorm_quant.py |
Tests Gluon outputs, graph replay and public dispatch. |
op_tests/multigpu_tests/test_fused_ar_rms_lamport.py |
Extends Lamport tests to FP8 and mixed-call sequences. |
csrc/pybind/custom_all_reduce_gfx1250_pybind.cu |
Exposes the quantized Lamport binding. |
csrc/kernels/custom_all_reduce_gfx1250.cu |
Adds output validation and quantized Lamport dispatch. |
csrc/include/custom_all_reduce_gfx1250.h |
Declares the quantized Lamport entry point. |
csrc/include/custom_all_reduce_gfx1250.cuh |
Implements FP8 quantization and scale reduction in Lamport. |
aiter/ops/triton/comms/all_reduce.py |
Adds the public Gluon wrapper and capacity checks. |
aiter/ops/triton/_gluon_kernels/gfx1250/comms/all_reduce.py |
Implements fused Gluon communication and normalization. |
aiter/ops/custom_all_reduce.py |
Registers the quantized Lamport operation. |
aiter/dist/device_communicators/custom_all_reduce.py |
Allocates outputs and invokes quantized Lamport. |
aiter/dist/device_communicators/communicator_cuda.py |
Routes supported calls between Gluon, Lamport and fallbacks. |
Review effort: Balanced
…h; tests fail off the reference dynamic_per_token_scaled_quant takes the per-group kernel for hidden 32, 64 and 128: the amax is floored at kAmaxFloor (1e-10) and the scale inverted with an IEEE divide. The Gluon fused op used the wide path's steps (amax from 0, v_rcp_f32) at every width, so a zero row there got scale 0 instead of 1e-10 / 448. Use the group path's steps at those three widths; other widths compile to the same ISA as before. test_all_reduce_rmsnorm_per_token_quant now also checks, at every hidden size that is a multiple of 16, that the FP8 out and scale are the bits of the HIP per-token quant of the op's own bf16 out, and runs the edge rows (a zero row among them) at hidden 32, 64 and 128. Hidden 6152 keeps the fp32-reference check only: there the HIP per-token quant leaves the last 4 FP8 bytes of each row unwritten (hidden % 16 == 8 above 2048, also on main). test_fused_ar_rms_lamport.py fails when a candidate's error ratio against the torch reference reaches checkAllclose's tol_err_ratio (5%), not only on bit differences against car_fused. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…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)
…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.
…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]>

What it does
On gfx1250, all-reduce + residual add + RMSNorm + per-token FP8 quant becomes one kernel launch instead of two. Two kernels do it:
lamport_ar_rmsnorm_gfx1250, the default path, TP2 and TP4). The epilogue can now also do the per-token FP8 quant, with one fp32 scale per row and optionally the bf16 output (emit_bf16).fused_allreduce_rmsnorm_quant(quant_type="per_token")uses it wherevershould_lamport_ar_rmsaccepts the call: hidden a multiple of 256 up to 8192, TP4 up to 8 MiB, TP2 up to 16 MiB. Before,mainran Lamport bf16 followed by a separate quant kernel up to 4 MiB, andcustom_fused_ar_rms_quantabove that. The quant steps are those ofar_rmsnorm_gfx1250, so the FP8 output and scales matchcustom_fused_ar_rms_quantbit for bit. The new arguments go at the end of the kernel's argument list. Its bf16/fp16 instantiations therefore compile to the same instructions as onmain, and so do the module's other 407 kernels; only the kernarg segment grows.all_reduce_rmsnorm_per_token_quant(TP4 withAITER_GLUON_FUSED_AR=1). It is the plain Gluon all-reduce plus an epilogue: residual add, RMSNorm (plain or Gemma) and optionally per-token FP8. It runs as its own kernel,_all_reduce_rmsnorm_kernel, on the inboxes of the plain all-reduce. It takes any hidden size that is a multiple of 8, up to 24576. The communicator sends it calls of up to 128 rows where Lamport could take the call (Lamport is faster past that), and calls of up to 4 MiB where Lamport can't (for example hidden 6152). Its per-token FP8 uses the steps of the HIP quantdynamic_per_token_scaled_quanttakes at each width: at hidden 32/64/128 (the per-group kernel) the amax is floored at 1e-10 and the scale inverted with an IEEE divide; elsewhere amax from 0 andv_rcp_f32._all_reduce_kernelcompiles to the same ISA as onmain.all_reduce_rmsnorm_quant(Gluon, power-of-2 hidden, one scale per 128 values) keeps the bf16 calls it takes today. It is not extended: it holds a row as a[HIDDEN / 4, 4]block and packs rows into its inboxes for a single hidden size, so supporting hidden 6144 would mean replacing its layout and protocol with those of the plain all-reduce, which is what the new op is.Benefit
Measured on MI455X x4 (
rocm/fw-bringup:gfx1250-minimax-m3-20261112) in HIP graph replay: 10 calls per graph, median of 20 replays, slowest rank. The baseline is the unfused route thatmaintakes for the same call, timed in the same process withscripts/bench_ar_norm.py. Values are the median of 4 rounds interleaved with the PR head; spread ≤ 0.5 µs. µs per call, TP4, hidden 6144:mainroute (Lamport bf16 + per-token quant)mainroute (Lamport)The Gluon columns need
AITER_GLUON_FUSED_AR=1. The Lamport FP8 kernel is the default.mainusescustom_fused_ar_rms_quant: hidden 7168 M=512 64.1 → 30.5 µs, hidden 8192 M=512 65.8 → 34.0 µs, hidden 4096 M=1024 45.9 → 33.0 µs.main's instructions, and its time matchesmainwithin noise for every size of the op test. The PR's first version passed the peer pointers as scalar kernel arguments, which was 10–20% slower thanmainat TP2 from 256 rows of hidden ≥ 7168 (for example 512×8192 took 20.65 µs vs 17.15 µs). That version was not faster on FP8 either, so this branch keepsmain's argument layout.Testing
MI455X x4, same image;
main, the PR head and this branch were each run on the same GPUs in one session.op_tests/multigpu_tests/test_fused_ar_rms_lamport.py -t 2 4, run twice on each tree:rccl+norm);custom_fused_ar_rms(_quant), including FP8 out, scale and theemit_bf16output, and to Lamport bf16 + the per-token quant;mainpasses its bf16-only version (51 calls, 0 bits).op_tests/multigpu_tests/triton_test/test_all_reduce_rmsnorm_quant.py(TP4): 3 passed, under pytest and as a script.test_all_reduce_rmsnorm_per_token_quantchecks the Gluon output at hidden 6144 bit for bit against the Gluon all-reduce +rmsnorm2d_fwd_with_add+ the HIP per-token quant.main.triton_test/test_all_reduce.py(plain Gluon all-reduce): passes onmainand on this branch.test_fused_ar_rms.py(pytest): 12 passed;test_fused_ar_gemma_rmsnorm_caseerrors at setup (it is a script-mode function with atp_sizeargument, not a pytest test).test_ag_lamport.pypasses.test_ar_add_lamport.pygives the same result onmainand on this branch: every bit-difference column is identical, and no Lamport call has a differing bit. Its TP4 mixed sequence reports 1217950 differing bits (52 calls) on both trees. They come from the one call past the Lamport cap, which goes to RCCL and does not sum in rank order; the RCCL column differs the same way. The test does not fail on this.tests/test_ar_rmsnorm_routing.py(CPU): 30 passed.main(ranks 0–3);main.communicator_cuda.pythatmainalready has).Not covered
Dependencies
None. Based on
main. Supersedes #7396 (closed), which was stacked on #7082. Independent of #7082 and #7445, and merges cleanly with #7445.PR Self-Review
Reviewed revision
1aef2c8
Behavior and intent
lamport_ar_rmsnorm_gfx1250, default, TP2/TP4): epilogue can now do per-token FP8 quant (one fp32 scale per row, optional bf16 output viaemit_bf16).fused_allreduce_rmsnorm_quant(quant_type="per_token")uses it wherevershould_lamport_ar_rmsaccepts the call (hidden multiple of 256 up to 8192; TP4 up to 8 MiB, TP2 up to 16 MiB).mainran Lamport bf16 plus a separate quant up to 4 MiB andcustom_fused_ar_rms_quantabove that. FP8 outputs and scales matchcustom_fused_ar_rms_quantbit for bit.all_reduce_rmsnorm_per_token_quant(TP4,AITER_GLUON_FUSED_AR=1): plain Gluon all-reduce plus a residual/RMSNorm/optional per-token FP8 epilogue, any hidden multiple of 8 up to 24576; used up to 128 rows where Lamport could take the call, and up to 4 MiB where it can't.main's route to 7.83-17.02 us with Lamport fused (description table, HIP graph replay, MI455X x4)._all_reduce_kernelcompile to the same instructions asmain.Validation and unverified scope
rocm/fw-bringup:gfx1250-minimax-m3-20261112:op_tests/multigpu_tests/test_fused_ar_rms_lamport.py -t 2 4twice: every output bitwise equal tocustom_fused_ar_rms(_quant)and to Lamport bf16 + per-token quant; mixed bf16/FP8 sequence (70 calls per TP, unaligned operands, graph replay) has 0 differing bits.op_tests/multigpu_tests/triton_test/test_all_reduce_rmsnorm_quant.py(TP4): 3 passed under pytest and as a script.triton_test/test_all_reduce.py,test_fused_ar_rms.py(12 passed),test_ag_lamport.pypass;tests/test_ar_rmsnorm_routing.py(CPU) 30 passed; CPU ISA checks as above.PR-specific question
Can the new routing send a per-token FP8 call to a kernel that cannot take it, or change results for bf16 callers?
should_lamport_ar_rmsalready accepts the call; Gluon only at TP4 withAITER_GLUON_FUSED_AR=1, hidden a multiple of 8 up to 24576, within the row/byte caps above. Everything else keeps the existing route.tests/test_ar_rmsnorm_routing.pyand the dispatch test check which op the public entry points take.main's instructions and timing within noise;all_reduce_rmsnorm_quantkeeps the bf16 calls it takes today.test_ar_add_lamport.pyat TP4 reports a bit difference for the one call past the Lamport cap, which goes to RCCL (non-rank-order sum).mainreports the same numbers, so this PR does not cause it.dynamic_per_token_scaled_quantuses there: the amax is floored at 1e-10 and the reciprocal is an IEEE divide, so a zero row gets scale 1e-10/448 instead of 0.Changed op tests
op_tests/multigpu_tests/test_fused_ar_rms_lamport.pyemit_bf16output, bit for bit againstcustom_fused_ar_rms(_quant)and Lamport bf16 + per-token quant; a mixed bf16/FP8 shape sequence on one inbox, eager and in graph replay.emit_bf16;mainpasses only its bf16-only version.quantdimension instead of a new file.op_tests/multigpu_tests/triton_test/test_all_reduce_rmsnorm_quant.pytest_all_reduce_rmsnorm_per_token_quant(hidden 6144 bitwise vs Gluon all-reduce +rmsnorm2d_fwd_with_add+ HIP per-token quant; hidden 2048/6152/16384 vs fp32 reference within 1 bf16 ulp / 1 FP8 code; FP8 bits vs the HIP per-token quant of its own bf16 out at hidden multiples of 16; edge rows incl. hidden 32/64/128, call-counter wrap, partial chunks, graph replay) and a dispatch test that the public ops take the new op.all_reduce_rmsnorm_per_token_quantdoes not exist.all_reduce_rmsnorm_quant(power-of-2 hidden, per-128 scales), not per-token FP8 or non-power-of-2 hidden.