Skip to content

[Triton/Gluon] [HIP] [Perf] gfx1250: wave32 register top-k for MoE routing - #7733

Merged
valarLip merged 21 commits into
mainfrom
perf/gfx1250-reg-topk-mw
Dec 1, 2026
Merged

valarLip merged 21 commits into
mainfrom
perf/gfx1250-reg-topk-mw

Conversation

@lirui927

@lirui927 lirui927 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

topk_reg_kernel ran only at wave64, so on gfx1250 most top-k calls without a group filter took the LDS kernel, and biased_grouped_topk used a Triton kernel at E = 512, 768, 896 and 1024. This PR runs topk_reg_kernel at wave32 and adds topk_reg_mw_kernel, a biased sigmoid top-k with one workgroup per row. The Kimi-K3 router (E=896, topk 16) on MI455X goes from 7.23 to 1.46 us per call at 1 token and from 54.9 to 10.3 us at 8192 tokens. gfx942 and gfx950 compile to the same instructions as main.

Changes

  • topk_reg_kernel runs at wave32 for no group filter, E % 4 == 0, ceil(E / 32) in {4, 6, 8, 16, 32} and 4 <= topk <= 16, with two candidate slots per lane. At wave32 the instantiations only wave64 launches (EPL 2, 3 and 14) compile to empty kernels.
  • topk_reg_mw_kernel (wave32): E = 128 x {4, 6, 7, 8}, topk <= 17, BF16 logits with a row pitch that is a multiple of 4, BF16 or FP32 bias, at any pointer alignment (gfx1250 vector loads take unaligned addresses). A row that misses this gate falls through to topk_reg_kernel or LDS, except that BF16 logits with an FP32 bias have no LDS path: such a row that fails only the pitch term goes to topk_reg_kernel at E=512/1024 with 4 <= topk <= 16, and otherwise (E=768/896, or topk < 4 or 17) fails the mixed-dtype AITER_CHECK in LAUNCH_KERNEL, as on main.
  • Both wave32 paths are gated to gfx1250 and gfx1250-strict by arch (topk_reg_w32_arch_ok), the last term of each gate, so wave64 never queries it and other calls query it only after the cheaper terms pass; RDNA GPUs keep main's kernels.
  • biased_grouped_topk on gfx1250 sends the one-group rows that fit the new kernel to biased_grouped_topk_hip. _can_use_gfx1250_exact_sigmoid_topk reads each tensor property once and ends with the kernel's own shape/dtype test, exposed as the memoised topk_reg_mw_supports binding, after the row-pitch term and equal weights/ids row strides (the HIP op writes both with the row stride of topk_ids); it reads no data_ptr(). biased_grouped_topk is an opaque custom op, so torch.compile never traces this gate: a compiled call runs it on the real tensors and picks the same kernel as an eager one. E=900, pitches that are not a multiple of 4 and unequal weights/ids row strides keep the Triton kernel. Calls with num_expert_group == topk_group > 1 go to the HIP op as on main and on gfx1250 now also reach the register kernels, whose gate is topk_grp == num_expert_group; with every group selected, the group filter drops no expert.
  • Tests: test_moeTopkSoftmax.py compares the new paths' random and tied rows bit for bit with the LDS kernel, including logits and bias one element past an aligned base and FP16-logit, FP32-bias rows at the wave32 EPLs 6, 16 and 32, and checks one-finite, all-NaN and all-zero rows for their exact expected weights and for valid, distinct ids (plus the winning id of one-finite rows). The HERD-width test in test_topk_gating.py and the biased-sigmoid benchmark in test_moe_topk_gating.py call the Triton kernel directly, since biased_grouped_topk now sends their rows to the HIP kernel; the test also checks that it does. New tests check that unaligned logits and bias take the HIP kernel with the bits of an aligned copy, that a compiled call of biased_grouped_topk returns the eager call's bits, and that E=512 with unequal output row strides and contiguous E=900 stay on the Triton kernel with correct results. The benchmark runs only on gfx1250, since the Triton kernel keeps the wave32 tie order.

Tested on MI455X at 6d3e239 (before the alignment term was dropped): test_moeTopkSoftmax.py, test_topk_gating.py and the biased-sigmoid section of test_moe_topk_gating.py pass. At 95ff9c0 on MI455X: test_moeTopkSoftmax.py passes (incl. 3 unaligned-input cases bit for bit against the LDS kernel), test_topk_gating.py 48 passed (unaligned-base and compiled-call tests included), and the biased-sigmoid benchmark passes for E 512-1024, topk 4/8/16, 1/64/8192 tokens. At b197607 (review cleanup: shared helpers, dead compile code removed): gfx942 and gfx950 device code is identical to the previous head; on gfx1250 only the two wave reductions in topk_reg_mw_kernel's fallback change (same results, 8 more VALU ops per fallback pick). On MI455X after a clean rebuild of module_moe_asm: test_moeTopkSoftmax.py passes (425 checks), test_topk_gating.py 48 passed, and the biased-sigmoid section of test_moe_topk_gating.py passes (log posted in the PR conversation). Later commits change comments and merge main. At e7019b4 the Python gate reads each tensor property once (_gfx1250_reg_mw_fits folded into _can_use_gfx1250_exact_sigmoid_topk), the C++ gates test the arch query last, and topk_reg_mw_kernel drops a pivot/count test that never decides (only its eight instances change on gfx1250; gfx942 and gfx950 device code is unchanged). A CPU probe of the dispatch (762,048 inputs x 4 mocked C++ queries x gfx1250, gfx1250-strict, gfx950 and gfx1201) gives the same route as a753954 and 993d5f8 for every input; the host cost of the gate, measured on CPU with the kernels stubbed, is +0.15 us over main for contiguous E=900 and +0.03 to +0.04 us for the pitch and stride cases (993d5f8: +0.82 and +0.18 to +0.44 us). At e7019b4 on MI455X after a clean module_moe_asm rebuild: test_moeTopkSoftmax.py (421 checks), test_topk_gating.py (50 passed, new route test included) and the biased-sigmoid section pass.

Known limits:

  • Rows with more than 64 scores tied at the pivot, such as all-equal rows, take topk_reg_kernel's fallback. With all-zero logits a launch is 5 to 22 us slower than main's LDS kernel (E = 128 to 1024); the multi-wave kernel stays faster than main on such rows.
  • Rows with fewer valid scores than topk (a -inf bias or NaN logits): the HIP kernels fill the missing slots with unused ids and zero weights (the ids differ by kernel); the Triton kernel, which keeps E=900, pitches that are not a multiple of 4 and unequal output row strides, repeats one id and gives it that expert's sigmoid (NaN for NaN logits).

Performance

MI455X (gfx1250), BF16, renormalized; time per call in a CUDA graph of 200 calls, median of 7 replays.

Hardware Workload/configuration Before After Change
MI455X Kimi-K3 router (E=896, topk 16), 1 token 7.23 us (Triton) 1.46 us -80%
MI455X Kimi-K3 router, 8192 tokens 54.94 us (Triton) 10.34 us -81%
MI455X grouped_topk softmax, E=512, topk 8, 1 token 7.84 us (LDS) 3.17 us -60%
MI455X biased_grouped_topk_hip, E=192, topk 8, 8192 tokens 9.26 us (LDS) 6.59 us -29%

Unaligned logits/bias (offset view, pitch % 4 == 0), MI455X, one HIP graph of 200 calls, median of 7 replays, 3 interleaved rounds, 48 shapes (E 512/768/896/1024, topk 8/16, 1/64/8192 tokens, BF16/FP32 bias):

ratio median range
HIP unaligned / Triton unaligned 0.33 0.21-0.51
HIP unaligned / HIP aligned 1.02 0.99-1.08
HIP aligned, 95ff9c0 / 6d3e239 1.00 0.97-1.07

E=896, topk 16, 8192 tokens: HIP unaligned 10.9 us vs Triton 51.1 us. All HIP variants are bitwise equal to each other.

Across 60 register-kernel shapes (E = 128 to 1024, 1 to 8192 tokens) the change is -1% to -60% with identical outputs. Compiling topk_softmax_kernels_group.cu for gfx1250 takes 117 s instead of 162 s on main.

PR Self-Review

Reviewed revision

5344e7f

Behavior and intent

  • topk_reg_kernel now also runs at wave32 (two candidate slots per lane), so on gfx1250 most top-k calls without a group filter no longer fall back to the LDS kernel.
  • New topk_reg_mw_kernel (wave32): biased sigmoid top-k with one workgroup per row for E = 512/768/896/1024, topk <= 17, BF16 logits, BF16 or FP32 bias.
  • biased_grouped_topk on gfx1250 sends rows that fit the new kernel to biased_grouped_topk_hip instead of the Triton kernel.
  • Why: before, gfx1250 took the LDS or Triton kernel; Kimi-K3 router (E=896, topk 16) on MI455X goes from 7.23 to 1.46 us at 1 token and 54.94 to 10.34 us at 8192 tokens vs main's Triton path. gfx942/gfx950 compile to the same instructions as main.

Validation and unverified scope

  • MI455X (at 95ff9c0): op_tests/test_moeTopkSoftmax.py, op_tests/triton_tests/moe/moe_routing/test_topk_gating.py and the biased-sigmoid section of op_tests/test_moe_topk_gating.py pass; random and tied rows of the new paths are compared bit for bit with the LDS kernel, and degenerate rows (one finite, all NaN, all zero) for their exact expected weights and valid, distinct ids (plus the one-finite winner).
  • At b197607: device asm diff for gfx942/gfx950/gfx1250, black/ruff, and an MI455X rerun of the three tests above after a clean module_moe_asm rebuild (all pass; log posted in the PR conversation). Commits after b197607 change comments, merge main, fold the multi-wave test into _can_use_gfx1250_exact_sigmoid_topk, reorder pure boolean gate terms (same route for every input in a CPU probe against a753954 and 993d5f8), and drop a never-deciding test in topk_reg_mw_kernel (gfx1250 asm of its eight instances changes; gfx942/gfx950 asm unchanged). At e7019b4 on MI455X after a clean rebuild the three tests pass, and each of the three mutations (equal-stride term, memoised query, EPL 6/16/32) fails its test.
  • Perf: 60 register-kernel shapes (E 128-1024, 1-8192 tokens) are 1-60% faster with identical outputs.
  • 6a8a527 rewords one comment in csrc/kernels/topk_softmax_kernels_group.cu on top of e7019b4 (git diff e7019b49 6a8a5272 is that comment only); nothing was rebuilt or re-run for it.
  • Head 5344e7f merges main 4960107 into aa3a0de. Main's [HIP] [Perf] MoE routing top-k: readlane/DPP instead of ds_bpermute #7338 (readlane/DPP top-k) conflicted in csrc/kernels/topk_softmax_kernels_group.cu and op_tests/test_moeTopkSoftmax.py. emit_legacy_ordered_topk is main's template <bool UNROLLED> with this PR's slot split: the one-slot arm (wave64) takes main's unrolled rank tiers, the two-slot arm (wave32) is unchanged, the renorm tail is main's. In the test, main's padding loop replaces ref_experts (it gives the same 260 for both cases) and forty_way_tie takes seed id 8 next to main's thirty_two_way_tie (7), so its six rows draw another 40 hot experts than the ones run on MI455X. CPU only: module_moe_asm builds for gfx942, gfx950 and gfx1250; device asm per kernel of its five sources: gfx942 and gfx950 are identical to main 4960107 for all 1440 kernels main has (the 8 topk_reg_mw_kernel instances are the only additions); on gfx1250, against aa3a0de, 1248 of 1448 kernels are identical, the 180 topk_reg_kernel instances at EPL 4, 6 and 8 take main's ballot compaction, readlane pivot and unrolled renorm sum (5 to 28 fewer instructions and 4 to 9 more VGPRs each; rank code unchanged), and 20 EPL-32 softmax instances keep the same instructions with two blocks placed differently. The stable test's own logic passes on CPU with the two HIP ops modelled in torch (54 cases; all 41 padded references take the LDS kernel at both wave sizes); black and ruff are clean. MI455X, one idle GPU, image rocm/fw-bringup:gfx1250-minimax-m3-20261112, module_moe_asm rebuilt from this tree: python3 op_tests/test_moeTopkSoftmax.py exits 0 (54 stable rows, err 0); python3 -m pytest -q op_tests/triton_tests/moe/moe_routing/test_topk_gating.py: 50 passed; python3 op_tests/test_moe_topk_gating.py --section biased-sigmoid --num-experts 512,768,896,900,1024 --topk 4,8,16 -d bf16 --num-tokens 1,64,8192 exits 0. Timing A/B of topk_reg_kernel at E = 128, 192 and 256 (54 shapes, aa3a0de and this head alternating, two rounds): ids and weight bits equal in every shape; this head / aa3a0de median 1.017 and 0.972 in the two rounds (range 0.93 to 1.03), against 1.015 (up to 1.06) between the two aa3a0de runs, so no difference beyond run-to-run noise. Unverified: the absolute E = 128 to 256 register-kernel timings of this description are aa3a0de's and were not re-measured.
  • aa3a0de merges main afce047 into a1277ed (main fixed the test_kda_gating.py import error that failed Triton shard 5 here, [Triton/Gluon] Fix the fast_launch import in kda_gating #8713; five standard shards of the a1277ed run stopped in their test step after 15 minutes with no log kept): no conflicts, and main changed none of this PR's files in between. Nothing was rebuilt or re-run on a GPU for it.
  • a1277ed merges main e6d2d31 into 6a8a527 (under Triton 3.9 the old base fails op_tests/test_gemm_a4w4.py in CI): no conflicts. Since the previous merge, main changed neither the kernel source nor csrc/include/moe_op.h; in aiter/ops/topk.py it changed only the top_k_per_row_decode dispatch ([FlyDSL] [JIT] Adaptive decode Top-K kernel, dispatched by one measured gate #5677), not the gate this PR edits. black and ruff are clean; nothing was rebuilt or re-run on a GPU for the merge.
  • Unverified: RDNA is gated off both new paths and not run.
  • Known regressions/differences: rows with > 64 scores tied at the pivot (e.g. all-zero logits) take the fallback, 5-22 us slower than main's LDS kernel; rows with fewer valid scores than topk fill missing slots differently on the HIP and Triton kernels.

PR-specific question

Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching it?

  • topk_reg_kernel at wave32: no group filter, E % 4 == 0, ceil(E / 32) in {4, 6, 8, 16, 32}, 4 <= topk <= 16. At wave32, EPL 2, 3 and 14 (launched only at wave64) compile to empty kernels.
  • topk_reg_mw_kernel: wave32, E in {512, 768, 896, 1024}, topk <= 17, BF16 logits, BF16 or FP32 bias.
  • Python routing (the last term of _can_use_gfx1250_exact_sigmoid_topk, after its gfx1250 runtime check): HIP when the row stride is a multiple of 4, the weights/ids row strides are equal and topk_reg_mw_supports (memoised per device, checked last) accepts E, topk and the dtypes; every stride, shape, dtype and the device is read once. No pointer-alignment term: the kernel's loads take any alignment. E=900, other pitches and unequal output row strides keep the Triton kernel. biased_grouped_topk is an opaque custom op, so compiled and eager calls run this gate on the same tensors and take the same kernel.
  • Invariant: the shape/dtype contract has one source, topk_reg_mw_args_ok in C++, used by both the HIP entry and topk_reg_mw_supports. Python adds the pitch, which the HIP entry checks too, and equal weights/ids row strides, since the HIP op writes both with the row stride of topk_ids. The HIP entry also requires topk_grp == num_expert_group; the Python gate is consulted only for one-group calls, where it holds. HIP op calls with num_expert_group == topk_group > 1 also reach the register kernels on gfx1250; with every group selected, the group filter drops no expert.
  • Arch boundary: both wave32 paths require wave32 and gfx1250 (topk_reg_w32_arch_ok, per device, the last term of each gate); RDNA wave32 GPUs take main's kernels, and wave64 calls never query the arch. A BF16-logit row with an FP32 bias that misses the register gates aborts on the mixed-dtype check, as on main.

Changed op tests

  • op_tests/test_moeTopkSoftmax.py
    • Covers: wave32 topk_reg_kernel (40-way ties, two slots per lane; FP16 logits with FP32 bias at EPL 6, 16 and 32, which only the register path takes) and topk_reg_mw_kernel (E 512-1024, topk 1-17, Kimi-K3 FP32 bias, strided and unaligned logits and bias, tied rows) bit for bit against the LDS kernel; one-finite, all-NaN and all-zero rows against their exact expected weights, with ids checked valid and distinct (and the winner of one-finite rows).
    • Before this PR: on gfx1250 these shapes never reach a register kernel, and FP32 bias with BF16 logits aborts on the wave32 HIP path.
    • Not redundant: existing stable cases cover wave64 register shapes and the LDS kernel only.
  • op_tests/test_moe_topk_gating.py
    • Covers: the gfx1250 Triton-vs-HIP biased-sigmoid benchmark now calls the public Triton entry exact_sigmoid_biased_topk directly and is skipped off gfx1250.
    • Before this PR: unchanged behavior; after it, biased_grouped_topk would route these rows to HIP, so the benchmark would compare HIP with HIP.
    • Not redundant: it keeps the existing comparison meaningful; no new test.
  • op_tests/triton_tests/moe/moe_routing/test_topk_gating.py
    • Covers: Triton kernel at HERD widths with BF16/FP32 bias, checked against biased_grouped_topk_hip (now including FP32 bias); that biased_grouped_topk routes rows with a pitch of whole quads to the HIP kernel, unaligned bases included (same bits as an aligned copy, same ids as torch and Triton), while other pitches stay on Triton; that a torch.compiled call of biased_grouped_topk (fullgraph=True, static and dynamic shapes) returns the eager call's bits, and that E=512 with unequal weights/ids row strides and contiguous E=900 stay on the Triton kernel (a stub in place of the HIP op fails the test) with the reference's results. The HERD-width, unaligned-base and compiled-call tests start each public call from outputs filled with -7.
    • Before this PR: the FP32-bias HIP comparison and the routing assertions fail (no wave32 HIP path for FP32 bias, no multi-wave route).
    • Not redundant: the only test of the Python dispatch between the Triton and HIP sigmoid top-k.

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7733 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@lirui927 lirui927 changed the title [HIP] [Perf] gfx1250: wave32 register top-k for biased sigmoid routing [HIP] [Perf] gfx1250: wave32 register top-k for MoE routing Nov 12, 2026
@lirui927
lirui927 marked this pull request as ready for review November 12, 2026 08:30
@lirui927
lirui927 requested a review from a team November 12, 2026 08:30
@github-actions github-actions Bot changed the title [HIP] [Perf] gfx1250: wave32 register top-k for MoE routing [Triton/Gluon] [HIP] [Perf] gfx1250: wave32 register top-k for MoE routing Nov 12, 2026
@aiter-bot

aiter-bot commented Nov 12, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 5344e7fd0d66 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

- `topk_reg_kernel` now also runs at wave32 (two candidate slots per lane), so on gfx1250 most top-k calls without a group filter no longer fall back to the LDS kernel.
- New `topk_reg_mw_kernel` (wave32): biased sigmoid top-k with one workgroup per row for E = 512/768/896/1024, topk <= 17, BF16 logits, BF16 or FP32 bias.
- `biased_grouped_topk` on gfx1250 sends rows that fit the new kernel to `biased_grouped_topk_hip` instead of the Triton kernel.
- Why: before, gfx1250 took the LDS or Triton kernel; Kimi-K3 router (E=896, topk 16) on MI455X goes from 7.23 to 1.46 us at 1 token and 54.94 to 10.34 us at 8192 tokens vs main's Triton path. gfx942/gfx950 compile to the same instructions as main.

Validation and unverified scope

- MI455X (at 95ff9c0b): `op_tests/test_moeTopkSoftmax.py`, `op_tests/triton_tests/moe/moe_routing/test_topk_gating.py` and the biased-sigmoid section of `op_tests/test_moe_topk_gating.py` pass; random and tied rows of the new paths are compared bit for bit with the LDS kernel, and degenerate rows (one finite, all NaN, all zero) for their exact expected weights and valid, distinct ids (plus the one-finite winner).
- At b1976079: device asm diff for gfx942/gfx950/gfx1250, black/ruff, and an MI455X rerun of the three tests above after a clean `module_moe_asm` rebuild (all pass; log posted in the PR conversation). Commits after b1976079 change comments, merge main, fold the multi-wave test into `_can_use_gfx1250_exact_sigmoid_topk`, reorder pure boolean gate terms (same route for every input in a CPU probe against a7539549 and 993d5f85), and drop a never-deciding test in `topk_reg_mw_kernel` (gfx1250 asm of its eight instances changes; gfx942/gfx950 asm unchanged). At e7019b49 on MI455X after a clean rebuild the three tests pass, and each of the three mutations (equal-stride term, memoised query, EPL 6/16/32) fails its test.
- Perf: 60 register-kernel shapes (E 128-1024, 1-8192 tokens) are 1-60% faster with identical outputs.
- 6a8a5272 rewords one comment in `csrc/kernels/topk_softmax_kernels_group.cu` on top of e7019b49 (`git diff e7019b49 6a8a5272` is that comment only); nothing was rebuilt or re-run for it.
- Head 5344e7fd merges main 4960107e into aa3a0de0. Main's #7338 (readlane/DPP top-k) conflicted in `csrc/kernels/topk_softmax_kernels_group.cu` and `op_tests/test_moeTopkSoftmax.py`. `emit_legacy_ordered_topk` is main's `template <bool UNROLLED>` with this PR's slot split: the one-slot arm (wave64) takes main's unrolled rank tiers, the two-slot arm (wave32) is unchanged, the renorm tail is main's. In the test, main's padding loop replaces `ref_experts` (it gives the same 260 for both cases) and `forty_way_tie` takes seed id 8 next to main's `thirty_two_way_tie` (7), so its six rows draw another 40 hot experts than the ones run on MI455X. CPU only: `module_moe_asm` builds for gfx942, gfx950 and gfx1250; device asm per kernel of its five sources: gfx942 and gfx950 are identical to main 4960107e for all 1440 kernels main has (the 8 `topk_reg_mw_kernel` instances are the only additions); on gfx1250, against aa3a0de0, 1248 of 1448 kernels are identical, the 180 `topk_reg_kernel` instances at EPL 4, 6 and 8 take main's ballot compaction, readlane pivot and unrolled renorm sum (5 to 28 fewer instructions and 4 to 9 more VGPRs each; rank code unchanged), and 20 EPL-32 softmax instances keep the same instructions with two blocks placed differently. The stable test's own logic passes on CPU with the two HIP ops modelled in torch (54 cases; all 41 padded references take the LDS kernel at both wave sizes); black and ruff are clean. MI455X, one idle GPU, image `rocm/fw-bringup:gfx1250-minimax-m3-20261112`, `module_moe_asm` rebuilt from this tree: `python3 op_tests/test_moeTopkSoftmax.py` exits 0 (54 stable rows, err 0); `python3 -m pytest -q op_tests/triton_tests/moe/moe_routing/test_topk_gating.py`: 50 passed; `python3 op_tests/test_moe_topk_gating.py --section biased-sigmoid --num-experts 512,768,896,900,1024 --topk 4,8,16 -d bf16 --num-tokens 1,64,8192` exits 0. Timing A/B of `topk_reg_kernel` at E = 128, 192 and 256 (54 shapes, aa3a0de0 and this head alternating, two rounds): ids and weight bits equal in every shape; this head / aa3a0de0 median 1.017 and 0.972 in the two rounds (range 0.93 to 1.03), against 1.015 (up to 1.06) between the two aa3a0de0 runs, so no difference beyond run-to-run noise. Unverified: the absolute E = 128 to 256 register-kernel timings of this description are aa3a0de0's and were not re-measured.
- aa3a0de0 merges main afce0474 into a1277eda (main fixed the `test_kda_gating.py` import error that failed Triton shard 5 here, #8713; five standard shards of the a1277eda run stopped in their test step after 15 mi

[truncated in readiness report; see the PR description for the full answer]

PR-specific question

Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching it?
- `topk_reg_kernel` at wave32: no group filter, E % 4 == 0, ceil(E / 32) in {4, 6, 8, 16, 32}, 4 <= topk <= 16. At wave32, EPL 2, 3 and 14 (launched only at wave64) compile to empty kernels.
- `topk_reg_mw_kernel`: wave32, E in {512, 768, 896, 1024}, topk <= 17, BF16 logits, BF16 or FP32 bias.
- Python routing (the last term of `_can_use_gfx1250_exact_sigmoid_topk`, after its gfx1250 runtime check): HIP when the row stride is a multiple of 4, the weights/ids row strides are equal and `topk_reg_mw_supports` (memoised per device, checked last) accepts E, topk and the dtypes; every stride, shape, dtype and the device is read once. No pointer-alignment term: the kernel's loads take any alignment. E=900, other pitches and unequal output row strides keep the Triton kernel. `biased_grouped_topk` is an opaque custom op, so compiled and eager calls run this gate on the same tensors and take the same kernel.
- Invariant: the shape/dtype contract has one source, `topk_reg_mw_args_ok` in C++, used by both the HIP entry and `topk_reg_mw_supports`. Python adds the pitch, which the HIP entry checks too, and equal weights/ids row strides, since the HIP op writes both with the row stride of `topk_ids`. The HIP entry also requires `topk_grp == num_expert_group`; the Python gate is consulted only for one-group calls, where it holds. HIP op calls with `num_expert_group == topk_group > 1` also reach the register kernels on gfx1250; with every group selected, the group filter drops no expert.
- Arch boundary: both wave32 paths require wave32 and gfx1250 (`topk_reg_w32_arch_ok`, per device, the last term of each gate); RDNA wave32 GPUs take main's kernels, and wave64 calls never query the arch. A BF16-logit row with an FP32 bias that misses the register gates aborts on the mixed-dtype check, as on main.

Changed op tests

- `op_tests/test_moeTopkSoftmax.py`
  - Covers: wave32 `topk_reg_kernel` (40-way ties, two slots per lane; FP16 logits with FP32 bias at EPL 6, 16 and 32, which only the register path takes) and `topk_reg_mw_kernel` (E 512-1024, topk 1-17, Kimi-K3 FP32 bias, strided and unaligned logits and bias, tied rows) bit for bit against the LDS kernel; one-finite, all-NaN and all-zero rows against their exact expected weights, with ids checked valid and distinct (and the winner of one-finite rows).
  - Before this PR: on gfx1250 these shapes never reach a register kernel, and FP32 bias with BF16 logits aborts on the wave32 HIP path.
  - Not redundant: existing stable cases cover wave64 register shapes and the LDS kernel only.
- `op_tests/test_moe_topk_gating.py`
  - Covers: the gfx1250 Triton-vs-HIP biased-sigmoid benchmark now calls the public Triton entry `exact_sigmoid_biased_topk` directly and is skipped off gfx1250.
  - Before this PR: unchanged behavior; after it, `biased_grouped_topk` would route these rows to HIP, so the benchmark would compare HIP with HIP.
  - Not redundant: it keeps the existing comparison meaningful; no new test.
- `op_tests/triton_tests/moe/moe_routing/test_topk_gating.py`
  - Covers: Triton kernel at HERD widths with BF16/FP32 bias, checked against `biased_grouped_topk_hip` (now including FP32 bias); that `biased_grouped_topk` routes rows with a pitch of whole quads to the HIP kernel, unaligned bases included (same bits as an aligned copy, same ids as torch and Triton), while other pitches stay on Triton; that a `torch.compile`d call of `biased_grouped_topk` (`fullgraph=True`, static and dynamic shapes) returns the eager call's bits, and that E=512 with unequal weights/ids row strides and contiguous E=900 stay on the Triton kernel (a stub in place of the HIP op fails the test) with the reference's results. The HERD-width, unaligned-base and compiled-call tests start each public call from outputs filled with -7.
  - Before this PR: the FP32-bias HIP comparison and the routing assertions fail (no wave32 HIP path for FP32 bias, no multi-wave route).
  - Not redundant: the only test of the Python dispatch between the Triton and HIP sigmoid top-k.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new dispatch can break Dynamo compilation and regress overflow-row performance, while the benchmark can produce false tie-order failures on gfx942/gfx950.

3 open issues
What changed in this PR

This PR accelerates MoE top-k routing on gfx1250 with wave32 HIP register kernels and redirects eligible biased-sigmoid calls from Triton to HIP.

Changes:

  • Extends the single-wave register path to wave32 and adds a multi-wave biased-sigmoid kernel.
  • Adds dispatch checks for supported shapes, alignment, and output strides.
  • Expands correctness tests and updates benchmarks to preserve direct Triton comparisons.
File Description
op_tests/​triton_tests/​moe/​moe_routing/​test_topk_gating.py Checks Triton results and public dispatch against HIP.
op_tests/​test_moeTopkSoftmax.py Adds tie, stride, mixed-bias, and multi-wave test cases.
op_tests/​test_moe_topk_gating.py Benchmarks the Triton specialization directly against HIP.
csrc/​kernels/​topk_softmax_kernels_group.cu Implements wave32 register paths and their launch gates.
aiter/​ops/​topk.py Routes eligible gfx1250 inputs to the HIP multi-wave kernel.

Review effort: Balanced

Comment thread aiter/ops/topk.py Resolved
Comment thread op_tests/test_moe_topk_gating.py Resolved
lirui927 and others added 8 commits November 16, 2026 16:22
topk_reg_kernel was gated to wave64, so on gfx1250 routing without a
group filter took the LDS kernel, and biased_grouped_topk sent its
E=512..1024 sigmoid shapes to the Triton kernel: about 7.2 us per call
for the Kimi-K3 router at decode.

- topk_reg_kernel runs at wave32. Lanes stage two candidates each, so
  up to 64 still take the fast path; wave64 keeps its single-slot code.
  The wave32 EPL list reuses wave64 instantiations only.
- topk_reg_mw_kernel: biased sigmoid top-k at wave32 with a workgroup of
  E / 128 waves per row, for E = 512, 768, 896 and 1024, topk <= 16,
  BF16 logits and a BF16 or FP32 bias. Same ids and weight bits as the
  row-per-wave kernels.
- biased_grouped_topk sends the rows that fit the multi-wave kernel to
  biased_grouped_topk_hip instead of the Triton kernel.

Kimi-K3 router on MI455X: 7.24 -> 1.45 us per call at one token and
54.96 -> 10.43 us at 8192 tokens. Device code for gfx942 and gfx950 is
unchanged.

Co-authored-by: Claude Opus 5.5 <[email protected]>
HERD routing with K = 16 asks biased_grouped_topk for the top 17. The
multi-wave kernel's renormalization read a fixed 16 lanes, its only
bound at 16; the fallback's filler search holds for topk <= 32. The sum
now reads kTopKRegMwMaxTopK = 17 lanes, so topk 17 on gfx1250 takes the
kernel instead of the Triton one, and the op tests cover it. Each
multi-wave instantiation gains one readlane and one add; device code for
gfx942 and gfx950 is unchanged.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Follow-ups from review of the wave32 register top-k:

- Wave32 builds compile the topk_reg_kernel EPLs only the wave64 dispatch
  launches (2, 3 and 14) to empty kernels. Device-only compile of
  topk_softmax_kernels_group.cu: gfx1250 117 s instead of 172 s (162 s on
  main), gfx1100 114 s and gfx1201 111 s instead of 162 s. Every kernel
  that runs compiles to the same instructions as before; gfx942 and
  gfx950 still compile to main's instructions.
- topk_reg_mw_kernel: static_assert the 16-bit logits its sigmoid
  depends on instead of keeping an FP32 branch nothing launches; one
  lambda ranks and pushes the two-slot candidates (same instructions).
- static_assert that kTopKRegMwMaxTopK leaves lane 31 past topk: the
  two-slot ranking parks ranks past the wave there, and the fallback
  draws its fillers from ids 0..31.
- The Python and C++ gates of the multi-wave kernel point at each other.
  A row the Python gate admits and the C++ gate rejects aborts in the LDS
  kernel on an FP32 bias at E = 768 and 896.
- LAUNCHER_TOPK_REG drops a wave-size check that always held.
- kTopKRegCandCap's comment quotes the shapes that reach wave32
  topk_reg_kernel (E=896 takes the multi-wave kernel): at topk 16 one
  slot per lane would overflow on up to ~0.16% of random rows, each
  adding 25-45 us to its launch on MI455X.
- op tests: 40 tied candidates at E=128 (biased) and E=256 (softmax, and
  biased with an FP32 bias), which wave32 topk_reg_kernel stages two per
  lane. The multi-wave kernel keeps one case per wave count, the two-slot
  rank, the degenerate rows and Kimi-K3's inputs; its separate tables
  fold into the existing ones.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Cursor <[email protected]>
…directly

biased_grouped_topk now sends aligned BF16 rows of E = 512, 768, 896 and
1024 to the HIP multi-wave kernel, so test_exact_sigmoid_topk_herd_widths
no longer reached the Triton kernel: its K+1 widths (5, 9 and 17), which
it pads to a power of two with masked stores, went untested, and the
ids == hip_ids check compared the HIP kernel with itself. Unaligned rows
and E=900 still take the Triton kernel.

The test now calls the Triton kernel through _gfx1250_exact_sigmoid_topk
and checks it against biased_grouped_topk_hip for both bias dtypes. The
HIP kernel takes an FP32 bias at these shapes now, so the early return
for one goes. test_exact_sigmoid_topk_matches_torch asserts that its
unaligned rows miss the multi-wave kernel, so a wider gate cannot take
its Triton coverage away unnoticed.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Cursor <[email protected]>
- The kernel is not limited to decode batches: at E = 512 and 1024 it
  beats topk_reg_kernel from 1 to 8192 tokens on MI455X.
- An FP32 bias is read with a 16-byte load, not an 8-byte one.
- ds_permute wraps its targets mod 32, which is why the two-slot path
  clamps ranks past the wave to lane 31; the wrap does not send them there.

Comment-only: the preprocessed source is unchanged.
Co-authored-by: Cursor <[email protected]>
- topk_reg_mw_kernel: its groups only set the pivot and are not
  topk_reg_kernel's lanes; a pivot at or below the -inf key means fewer
  than topk finite group maxima, not fewer than topk finite scores.
- Both gate cross-references: a row the Python gate admits and the C++
  gate rejects falls through to topk_reg_kernel at E = 512 and 1024 with
  topk <= 16, else to the LDS kernel, which aborts on an FP32 bias.
- test_moeTopkSoftmax.py: the multi-wave kernel at topk 1, and its
  fallback taking one of 880 tied experts. References padded to 260
  experts check E=128 and E=252 (masked last round) against the LDS
  kernel at either wave size.
- test_topk_gating.py: biased_grouped_topk gives the HIP results on the
  HERD-width rows; Triton and HIP weights agree to 1e-6.
- test_moe_topk_gating.py: the biased-sigmoid benchmark times the Triton
  kernel itself, which biased_grouped_topk now skips for aligned rows.

The kernel source change is comment-only: the preprocessed source is
unchanged.

Co-authored-by: Cursor <[email protected]>
… only

The Triton kernel keeps the gfx1250 wave32 tie order, so on wave64 GPUs
tied scores could fail the ID check against biased_grouped_topk_hip.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…kernel

_gfx1250_reg_mw_fits reads data_ptr(), which Dynamo cannot trace: it added
a graph break, and an error under fullgraph=True, for every call it was
asked about. Under torch.compile it now returns False before reaching it,
so compiled calls take the Triton kernel, as on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lirui927
lirui927 force-pushed the perf/gfx1250-reg-topk-mw branch from 5ca479f to fb63a13 Compare November 16, 2026 16:23

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (3)

  1. Gate both new wave32 paths to gfx1250, or run them on RDNA. csrc/kernels/topk_softmax_kernels_group.cu: LAUNCHER_TOPK_REG and the topk_reg_mw_kernel gate in biased_grouped_topk() check get_warp_size_func() == 32, not the arch. So grouped_topk and biased_grouped_topk_hip on gfx1100/gfx1201 now run kernels that were only compiled there, never run. Either add an arch check, or post a test_moeTopkSoftmax.py run on an RDNA GPU (the ci:windows R9700 runner is gfx1201).
  2. Take the gate from one source instead of a hand mirror. The _gfx1250_reg_mw_fits docstring in aiter/ops/topk.py says "keep the two in step" with the C++ gate. _GFX1250_REG_MW_EXPERTS/_GFX1250_REG_MW_MAX_TOPK copy mw_waves ∈ {4,6,7,8}/kTopKRegMwMaxTopK, and the topk <= 17 term can never fail because the caller already requires topk ∈ _GFX1250_SIGMOID_TOPKS. Expose the shape/dtype contract as one memoised C++ query, as topk_sampled_supports does, and keep only the pointer-alignment terms in Python.
  3. Run the new gfx1250 path in CI once. test_topk_gating.py is skipif not gfx1250, the MI35X jobs cannot reach topk_reg_mw_kernel, and the gfx1250 job needs the ci:gfx1250-ffm-triton label. Add the label and link the green run.

Non-blocking:

  • On the Triton test changes: Triton is still tested through the public entry for unaligned rows and E=900 (test_exact_sigmoid_topk_matches_torch). Calling the kernel directly in the HERD-width test is fine. No test covers the torch.compile branch, though. Under compile, traced calls keep Triton and eager calls go to HIP. The weights then differ by ULPs (the test allows 1e-6 Triton vs HIP), and rows with fewer finite scores than topk fill differently. Please document this in _gfx1250_reg_mw_fits and add a compiled-call test.
  • op_tests/test_moe_topk_gating.py: import the public exact_sigmoid_biased_topk from aiter.ops.triton.moe.moe_routing.topk_gating instead of the private _gfx1250_exact_sigmoid_topk. Use get_gfx_runtime() in ("gfx1250", "gfx1250-strict") as topk.py does, not startswith.
  • Comments: step 4 of the topk_reg_mw_kernel header should also mention the !fast rows (pivot at -inf or n_cand < topk). Drop the measured numbers ("~0.16%", "25-45 us", "4096 rows"), or point to the script that produced them.
  • emit_legacy_ordered_topk's two-slot branch (warp_rank_desc_slots) and wave32_rank_desc_dpp2 both rank 64 keys on wave32. Consider sharing one of them.

Reviewed at fb63a13. Merges cleanly into current main, including #7922, which changes a different op (topk_gating). Has a one-line import conflict with #7846 in test_moe_topk_gating.py. The Copilot data_ptr and gfx942 benchmark items are fixed; the all-tie fallback cost is a documented tradeoff.

lirui927 and others added 2 commits November 17, 2026 15:16
…e gate

Both wave32 register paths (topk_reg_kernel at wave32 and
topk_reg_mw_kernel) now require gfx1250, checked per device through
get_device_gfx, instead of a wave size of 32: RDNA GPUs compile them but
have never run them, so they keep main's kernels.

The shape and dtype contract of topk_reg_mw_kernel lives in
topk_reg_mw_args_ok, which the HIP entry uses and Python reaches through
the new topk_reg_mw_supports binding, memoised per device. The Python
mirror constants are gone; _gfx1250_reg_mw_fits keeps only the pitch and
alignment terms and documents the torch.compile split, which a new test
covers. test_moe_topk_gating.py uses the public Triton entry and an exact
arch check; comments drop unsourced measurements and name the fallback
rows of topk_reg_mw_kernel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e path

topk_reg_mw_kernel now reads its four logits and four bias values per lane
through load_quad, a memcpy into the vector: well-defined at any alignment,
and gfx1250 (unaligned-access mode) still issues it as one global_load_b64 or
_b128. The HIP entry drops its data_ptr() alignment check and keeps only the
pitch term.

_gfx1250_reg_mw_fits no longer reads data_ptr() and no longer sends traced
calls to Triton. topk_reg_mw_supports enters a traced graph as a constant
(torch.compiler.assume_constant_result), with E and topk made Python ints
first so dynamic shapes trace too; otherwise Dynamo traces into the op, whose
fake gives no answer. Compiled and eager calls now take the same kernel.

Tests: unaligned logits and bias take the HIP kernel with the bits of an
aligned copy and match torch and Triton; the compiled-call test checks the
gate traces with fullgraph (static and dynamic) and that compiled and eager
calls agree bit for bit; test_moeTopkSoftmax adds three unaligned cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lirui927

Copy link
Copy Markdown
Contributor Author

Thanks. Addressed in 6d3e239 and 95ff9c0:

  1. Gate to gfx1250. Both new wave32 paths now check the arch, not the wave size. topk_reg_w32_arch_ok() (gfx1250 only, per device through get_device_gfx) gates the wave32 branch of LAUNCHER_TOPK_REG and is part of the topk_reg_mw_kernel contract. On gfx1100/gfx1201, grouped_topk and biased_grouped_topk_hip take main's kernels again. We have no RDNA GPU, so we gated rather than ran them.
  2. One source for the gate. The shape and dtype contract is now topk_reg_mw_args_ok in C++. The HIP entry uses it, and Python reaches it through the new topk_reg_mw_supports(num_experts, topk, gating_dtype, bias_dtype, device_id=-1) binding, memoised per device as topk_sampled_supports is. _GFX1250_REG_MW_EXPERTS, _GFX1250_REG_MW_MAX_TOPK and the topk <= 17 term are gone. _gfx1250_reg_mw_fits keeps only the row-pitch term, plus the equal output row strides, which the HIP op's ABI needs on every path.
  3. CI on gfx1250. This needs the ci:gfx1250-ffm-triton label. I will link the green run here once it has run.

Non-blocking:

  • torch.compile. There is no compile/eager split any more (95ff9c0). _gfx1250_reg_mw_fits no longer reads data_ptr(): topk_reg_mw_kernel reads the logits and bias at any alignment (load_quad, which gfx1250 still issues as one global_load_b64/_b128), and the HIP entry dropped its alignment check, so only the row-pitch term is left. The topk_reg_mw_supports answer enters a traced graph as a constant through torch.compiler.assume_constant_result; without it Dynamo traces into the op, whose fake returns no answer, and every compiled call would go to Triton. So a traced call takes the same kernel as an eager one. test_exact_sigmoid_topk_compiled_call now checks that _gfx1250_reg_mw_fits traces with fullgraph=True (static and dynamic shapes) and that a compiled call returns the eager call's bits, for aligned and unaligned inputs. Unaligned views (one element past an aligned base, pitch % 4 == 0) now take the HIP kernel too; test_exact_sigmoid_topk_unaligned_base checks them bit for bit against an aligned copy and against torch and Triton.
  • test_moe_topk_gating.py. It now imports the public exact_sigmoid_biased_topk and checks get_gfx_runtime() == "gfx1250".
  • Comments. Step 4 of the topk_reg_mw_kernel header now names the !fast rows: pivot at -inf, or fewer than topk records. I dropped "~0.16%", "25-45 us" and "4096 rows".
  • Sharing the 64-key wave32 ranking. I left warp_rank_desc_slots and wave32_rank_desc_dpp2 separate in this PR. Swapping one for the other changes topk_reg_kernel's wave32 code, which needs a GPU run for both correctness and perf. I can do it as a follow-up.

Checked on CPU:

  • module_moe_asm builds for gfx942, gfx950 and gfx1250.
  • On gfx942 and gfx950, all 793 kernels that main's topk_softmax_kernels_group.cu emits are instruction- and descriptor-identical to main. The only additions are the 8 topk_reg_mw_kernel instantiations, which are empty there.
  • On gfx1250, 6d3e239 left device code identical to fb63a13; 95ff9c0 changes only the 8 topk_reg_mw_kernel instantiations (same global loads, scheduling and register-allocation drift of -26 to +15 instructions per kernel).
  • black and ruff are clean.

On MI455X at 95ff9c0: test_moeTopkSoftmax.py passes (incl. unaligned inputs, bit for bit vs the LDS kernel); test_topk_gating.py 48 passed (unaligned base, compiled call); the biased-sigmoid benchmark passes. Unaligned inputs on HIP vs Triton over 48 shapes: median 0.33x the Triton time (0.21-0.51x); HIP unaligned vs aligned 1.02x; aligned vs 6d3e239 1.00x.

@lirui927 lirui927 added the ci:gfx1250-ffm-triton Run gfx1250 FFM tests label Nov 17, 2026
@lirui927
lirui927 requested a review from valarLip November 20, 2026 02:20
@lirui927

lirui927 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

MI455X (gfx1250) at b197607, after a clean rebuild of module_moe_asm:

  • python3 op_tests/test_moeTopkSoftmax.py: exit 0; every ref-vs-aiter check passed (425 checks, none failed).
  • python3 -m pytest -q op_tests/triton_tests/moe/moe_routing/test_topk_gating.py: 48 passed. This includes the -7 refill in the HERD-width and compiled-call tests, and the fullgraph static and dynamic compiled calls of the public op.
  • op_tests/test_moe_topk_gating.py, biased-sigmoid section: exit 0, "All topk_gating benchmarks passed!"

So the wave_reduce fallback change from item 2 is covered on hardware too.

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (2)

No bugs found at b197607: kernel numerics, wave64 default path and the Python/C++ gates all check out. Two text fixes are left, and both are needed before merge.

  1. Fix four comments that give the wrong reason or scope (Nit):
    • csrc/kernels/topk_softmax_kernels_group.cu:1183-1185: the hi/lo split fma does not give "the same float". t differs by 1 ulp for some bf16 inputs, and 0 gives -0 vs +0. Only the sigmoid bits match, for every bf16/fp16 input. Say "the same sigmoid bits", as 1635371 did.
    • aiter/ops/topk.py:142 ("Every row is then aligned as the first one is") and .cu:2720 ("The pitch must be whole quads"): since 95ff9c0, load_quad reads at any alignment and the base address is not checked, so stride(0) % 4 == 0 gives no alignment. State the real reason: it is the validated range, and it keeps other pitches on Triton, which test_exact_sigmoid_topk_matches_torch relies on (pitch E+17). Keep the term.
    • .cu:50-52: only biased_grouped_topk rows (one group, BF16 logits, topk <= 17) take topk_reg_mw_kernel. grouped_topk at E=768/896 goes to LDS on wave32, because EPL 24/28 are not in the W32 list.
    • op_tests/test_moeTopkSoftmax.py:1113: "(E + 4 would take topk_reg_kernel)" is false for E=128 at wave32 (EPL 5 goes to LDS).
  2. Correct the PR body, and the squash text where it says the same (Nit):
    • "checks one-finite, all-NaN and all-zero rows against their exact expected ids and weights" (body lines 11, 55, 71): test_grouped_topk_stable (:501-537) checks exact weights, but for ids it only checks that they are valid and distinct and what the winner is. Say that.
    • Drop "The MI455X rerun is pending" (lines 13, 56); your b197607 MI455X log is posted.

Also please resolve the open Copilot thread on .cu:2447 (all-tie rows go to the fallback). That tradeoff was accepted earlier and is listed under Known limits; reply saying so before resolving. Branch rules block merge on open threads.

Pre-existing, not required here:

  • Every HIP top-k kernel writes both outputs with topk_ids.stride(0), so direct biased_grouped_topk_hip calls with unequal row strides misplace the weights, as on main.
  • test_topk_gating.py:14 skips on gfx1250-strict.

CI: the only failure, Standard shard 0 tests/test_ar_rmsnorm_routing (should_fly_allreduce_rmsnorm), comes from main; main fixed it in #8313. Merging main clears it.


Reviewed at b197607 (deep; two independent passes, 4+3 hunters incl. ecc:review-pr, 4 verifiers, C2). Already fixed: dead compile machinery removed, public op compiled with fullgraph; dev_max_/dev_min_<uint32_t>, wave_reduce and sigmoid_neg_log2e reused (fallback max probed lane by lane on gfx12 DPP/permlanex16, sigmoid bits checked over all bf16/fp16); -7 refills; moe_op.h text; wave64 skips topk_reg_mw_args_ok (3 wave-size lookups vs 4 on main). The pitch and E=768/896 comments were already wrong at 1635371; I missed them in earlier rounds.

lirui927 and others added 2 commits November 20, 2026 06:22
- sigmoid_neg_log2e: the hi/lo split fma gives the same sigmoid bits as the
  f64 product for every bf16/fp16 input, not the same float (t can differ by
  1 ulp, and 0 gives -0 vs +0).
- Row pitch of whole quads for topk_reg_mw_kernel: load_quad reads at any
  alignment, so the term gives no alignment. It is the validated range, and
  it keeps other pitches on Triton, which
  test_exact_sigmoid_topk_matches_torch relies on (pitch E + 17).
- Wave32 EPL list: only biased_grouped_topk rows with one group, BF16 logits
  and topk <= 17 at E=768/896 take topk_reg_mw_kernel; grouped_topk at those
  sizes takes the LDS kernel at wave32.
- ref260 test note: E + 4 would take topk_reg_kernel at wave64, but not for
  E=128 at wave32 (EPL 5 takes LDS).

Testing: test_grouped_topk_stable checks one-finite, all-NaN and all-zero
rows for exact weights; for ids it checks that they are valid and distinct
and, for one-finite rows, the winner. MI455X at b197607:
test_moeTopkSoftmax.py passes, test_topk_gating.py 48 passed, and the
biased-sigmoid section of test_moe_topk_gating.py passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lirui927

Copy link
Copy Markdown
Contributor Author

Thanks @valarLip. Fixed in c0c7586; a753954 merges current main (incl. #8313 for tests/test_ar_rmsnorm_routing). Code is unchanged from b197607 apart from the merge: the PR's own diff is comments only.

  1. Comments:
    • csrc/kernels/topk_softmax_kernels_group.cu:1184-1187: now says the split fma gives "the same sigmoid bits", not the same float.
    • aiter/ops/topk.py:142-143 and .cu:2722-2724: the whole-quad pitch term is kept, with the real reason: it is the validated range, and it keeps other pitches on Triton, which test_exact_sigmoid_topk_matches_torch relies on (pitch E + 17). No alignment claim.
    • .cu:50-56: only biased_grouped_topk rows with one group, BF16 logits and topk <= 17 at E=768/896 take topk_reg_mw_kernel; the rest, grouped_topk among them, take LDS at wave32.
    • op_tests/test_moeTopkSoftmax.py:1113-1115: E + 4 would take topk_reg_kernel at wave64, not for E=128 at wave32.
  2. PR body (lines 11, 55, 71) and the commit message: degenerate rows are checked for exact weights, and for ids only that they are valid and distinct, plus the winner of one-finite rows. "The MI455X rerun is pending" is gone (lines 13, 56); the body points to the posted b197607 MI455X log. Reviewed revision updated to a753954.

I replied on the Copilot .cu:2447 thread (accepted tradeoff, under Known limits) and resolved it.

@lirui927
lirui927 requested a review from valarLip November 20, 2026 06:23

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (3)

I found no correctness bugs at a753954. The gfx942/gfx950 routes and their host cost are unchanged from main, and the merge of main touches none of the PR files. What is left: one small host-cost fix on gfx1250, and text fixes. Two of the text fixes correct wording I suggested last round. Sorry for that.

  1. Check the cheap terms of _gfx1250_reg_mw_fits before the memoised query (Important; any default-path slowdown counts as Important here). aiter/ops/topk.py:135-147. On gfx1250, 1/1 calls that stay on Triton as on main (E=900, a pitch that is not a multiple of 4, unequal weights/ids row strides) now pay +0.8 to 2.3 us of host time per call. I measured it with concurrent pinned-core pairs and base/base and head/head controls. Fix: evaluate gating_output.stride(0) % 4 == 0 and topk_weights.stride(0) == topk_ids.stride(0) before _reg_mw_supports_cached(...). Every route stays the same, and the pitch and stride cases go back to main's cost.
  2. Make the comments match the dispatch code (Nit):
    • csrc/kernels/topk_softmax_kernels_group.cu:51-53: the gate at :2729-2731 is topk_grp == num_expert_group, not "one group". 8/8 and 4/4 calls at E=768 BF16 also take topk_reg_mw_kernel, through both the HIP op and the Python op. The pitch term was also dropped. Suggested: "Only biased_grouped_topk rows without a group filter (topk_grp == num_expert_group), BF16 logits, a pitch of whole quads and topk <= 17 at E=768 and 896 take topk_reg_mw_kernel; the rest, grouped_topk among them, take LDS at wave32."
    • .cu:2722-2724: this C++ entry never reaches Triton. A pitch that fails the check falls through to topk_reg_kernel (E=512/1024, topk 4..16) or LDS. Suggested: "The pitch must be whole quads, the validated range; other pitches fall through to topk_reg_kernel or LDS below. biased_grouped_topk applies the same term, so rows the Triton kernel takes stay on it (test_exact_sigmoid_topk_matches_torch relies on that, pitch E + 17)."
    • .cu:1116-1117: topk_reg_kernel also runs at wave32 now, so "the wave64 launcher gate enforces topk <= 32" should say "topk <= wave size / 2 (32 at wave64, 16 at wave32)". The fallback-trigger line at .cu:1086 lists only one of its three triggers.
    • op_tests/test_moeTopkSoftmax.py:1038, :1108 and :1120 say "wave32" (or "multi-wave kernel"), but these hold only on gfx1250. On RDNA wave32 these BF16-logit/FP32-bias cases reach the mixed-bias AITER_CHECK in LDS (.cu:2384). Say "gfx1250".
  3. Correct the PR body and the squash text (Nit):
    • "Outputs are refilled with -7 before each public call": test_exact_sigmoid_topk_matches_torch writes into torch.empty_strided outputs (test_topk_gating.py:120-141). Name the HERD-width, unaligned-base and compiled-call tests instead.
    • "Wave64 instantiations compile to empty kernels at wave32": only EPL 2, 3 and 14 do (.cu:861), as your Changes bullet says.
    • "Python takes this path only with one group" is true only for _gfx1250_reg_mw_fits. Calls with num_expert_group == topk_group > 1 go to the HIP op and now take the register kernels on gfx1250, with the same result because every group is selected. Say so.
    • Squash text: c0c7586's "0 gives -0 vs +0" is wrong (my wording). ±0 give the same bits on both paths; only t differs, by 1 ulp, for 114 tiny bf16 inputs. Also, b197607's "only E=900 and other pitches take the Triton kernel" misses unequal output row strides (topk.py:146). Use the body's Changes section as the squash message.

Optional: warp_rank_desc_slots (.cu:364) and wave32_rank_desc_dpp (.cu:1262) give the same live ranks. Either use the DPP one in emit_legacy_ordered_topk, or add one line on why the readlane form stays.

CI: 46 pass, 0 fail. All review threads are resolved.


Reviewed at a753954 (deep; two independent passes, A: 2 hunters + 2 verifiers + C2, B: 4 hunters + ecc reviewers + 8 verifiers + C2). Already fixed: "same sigmoid bits" (.cu:1186), the ref260 E+4 note, "exact expected ids" and "rerun pending" in the body, the Copilot .cu thread. Missed earlier: .cu:1086/1116, the test "wave32" notes and the gate cost come from older commits; I did not raise them before.

…ents

_gfx1250_reg_mw_fits checks the row pitch and the equal output row
strides before _reg_mw_supports_cached, so calls with a pitch that is
not a multiple of 4 or unequal output strides skip the query. Pure
boolean terms, so the route is the same for every input.

Comments now match the dispatch code: the topk_reg_mw_kernel gate is
topk_grp == num_expert_group plus the pitch term; a failing pitch in the
C++ entry falls through to topk_reg_kernel or LDS, never Triton; the
topk_reg_kernel launcher bounds topk by wave size / 2; its fallback
note lists all three triggers; the test notes that hold only on gfx1250
say so; and emit_legacy_ordered_topk says why it keeps the readlane
rank.

Squash text (the PR description's Changes section):

- `topk_reg_kernel` runs at wave32 for no group filter, E % 4 == 0,
  ceil(E / 32) in {4, 6, 8, 16, 32} and 4 <= topk <= 16, with two
  candidate slots per lane. At wave32 the instantiations only wave64
  launches (EPL 2, 3 and 14) compile to empty kernels.
- `topk_reg_mw_kernel` (wave32): E = 128 x {4, 6, 7, 8}, topk <= 17,
  BF16 logits with a row pitch that is a multiple of 4, BF16 or FP32
  bias, at any pointer alignment (gfx1250 vector loads take unaligned
  addresses).
- Both wave32 paths are gated to gfx1250 and gfx1250-strict by arch
  (`topk_reg_w32_arch_ok`, checked after the wave size, so wave64 never
  queries it); RDNA GPUs keep main's kernels.
- `biased_grouped_topk` on gfx1250 sends the one-group rows that fit the
  new kernel to `biased_grouped_topk_hip`. The shape/dtype test is the
  kernel's own, exposed as the memoised `topk_reg_mw_supports` binding;
  Python adds the row-pitch term and equal weights/ids row strides (the
  HIP op writes both with the row stride of `topk_ids`), checks those
  two before the memoised query, and reads no `data_ptr()`.
  `biased_grouped_topk` is an opaque custom op, so `torch.compile` never
  traces this gate: a compiled call runs it on the real tensors and
  picks the same kernel as an eager one. E=900, pitches that are not a
  multiple of 4 and unequal weights/ids row strides keep the Triton
  kernel. Calls with `num_expert_group == topk_group > 1` go to the HIP
  op as on main and on gfx1250 now also reach the register kernels,
  whose gate is `topk_grp == num_expert_group`; with every group
  selected, the group filter drops no expert.
- Tests: `test_moeTopkSoftmax.py` compares the new paths' random and
  tied rows bit for bit with the LDS kernel, including logits and bias
  one element past an aligned base, and checks one-finite, all-NaN and
  all-zero rows for their exact expected weights and for valid, distinct
  ids (plus the winning id of one-finite rows). The HERD-width test in
  `test_topk_gating.py` and the biased-sigmoid benchmark in
  `test_moe_topk_gating.py` call the Triton kernel directly, since
  `biased_grouped_topk` now sends their rows to the HIP kernel; the test
  also checks that it does. New tests check that unaligned logits and
  bias take the HIP kernel with the bits of an aligned copy, and that a
  compiled call of `biased_grouped_topk` returns the eager call's bits.
  The benchmark runs only on gfx1250, since the Triton kernel keeps the
  wave32 tie order.

Corrections to earlier commit messages of this branch, which the squash
keeps:
- c0c7586: +0 and -0 do not differ: both paths give t = -0 for +0
  and t = +0 for -0. t differs only for 114 bf16 inputs with
  |x| <= 4.1e-36, by 1 ulp, and for no fp16 input (IEEE emulation on
  CPU).
- b197607: E=900, pitches that are not a multiple of 4 and unequal
  weights/ids row strides take the Triton kernel, not only E=900 and
  other pitches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lirui927

Copy link
Copy Markdown
Contributor Author

@valarLip thanks. Addressed at 993d5f8:

1. Cheap terms first (aiter/ops/topk.py:136-148): _gfx1250_reg_mw_fits now checks gating_output.stride(0) % 4 == 0 and topk_weights.stride(0) == topk_ids.stride(0) before _reg_mw_supports_cached(...).

  • Routes: I ran an exhaustive CPU probe of the biased_grouped_topk dispatch at a753954 and at 993d5f8. It covers 870,912 inputs: E 128-1024 incl. 900, topk 1-32, gating and bias dtypes, pitch E+{0,1,2,3,4,17}, both output strides, rows 0/1/3, groups 1/1, 8/8 and 8/4, gfx1250 and gfx950. The C++ query was mocked four ways: topk_reg_mw_args_ok, always true, always false and a hash. Both revisions take the same route for every input. The memoised query runs 480 times instead of 4,320.
  • Host cost: the dispatch body ran on CPU tensors with the kernels stubbed, the same way for every revision. One pinned core, 15 interleaved rounds x 20k calls, medians. The A/A pairs (main/main, a75/a75, new/new) agree within 10 ns and every IQR is at most 21 ns. Extra ns per call over main:
case route a753954 993d5f8
E=896, pitch 897 Triton +549 +177
E=900, pitch 902 Triton +377 +177
E=896, weights stride 9 / ids 8 Triton +818 +448
E=896, contiguous HIP multi-wave +820 +815
E=900, contiguous Triton +380 +797

The trade-off is in the last row. Contiguous E=900 passes both stride terms, so it now reads them before the query. On this harness that costs 0.42 us more than at a753954. I see no way to skip the query for it without copying the C++ shape rule into Python. Putting only the pitch term first (pitch, query, strides) would cost contiguous E=900 +170 ns instead of +417 ns, but would leave the unequal-strides case at a753954's cost. I kept your order. Tell me if you prefer the other one.

2. Comments

  • topk_softmax_kernels_group.cu:51-54: your wording, plus "on gfx1250 only": gate topk_grp == num_expert_group, pitch of whole quads.
  • .cu:2726-2731: your wording. A failing pitch falls through to topk_reg_kernel or LDS, never Triton.
  • .cu:1120-1122: "topk <= wave size / 2 (32 at wave64, 16 at wave32)".
  • .cu:1089-1090: lists all three fallback triggers: pivot -inf, fewer than topk candidates reach it, or more than kTopKRegCandCap do.
  • .cu:444-445: one line on why emit_legacy_ordered_topk keeps warp_rank_desc_slots. It also runs at wave64, and it stops at n_cand, so the common n_cand <= WARP_SIZE case takes one warp_rank_desc. Switching would change wave32 codegen, so I left the code as is.
  • op_tests/test_moeTopkSoftmax.py:1038,1089,1091,1108,1120: these now say "gfx1250". I also changed 1089 and 1091, which made the same wave32 claim.

3. PR body and squash text

  • The -7 refill now names the HERD-width, unaligned-base and compiled-call tests.
  • The empty wave64 instantiations are now only EPL 2, 3 and 14.
  • The one-group remark is now limited to _gfx1250_reg_mw_fits. The body also says that HIP calls with num_expert_group == topk_group > 1 reach the register kernels on gfx1250.
  • The Triton list now includes unequal output row strides.
  • The new commit message carries the body's Changes section as squash text, with corrections for c0c7586 and b197607.
    • ±0: both paths give the same t (-0 for +0, +0 for -0).
    • Only t differs, by 1 ulp, for 114 bf16 inputs with |x| <= 4.1e-36, and for no fp16 input. I checked this exhaustively on CPU with IEEE emulation.

.cu changes are comments only. black and ruff are clean. I did not rerun on GPU at 993d5f8 because all four MI455X were busy.

@lirui927
lirui927 requested a review from valarLip November 20, 2026 13:02

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (5)

No correctness bugs at 993d5f8: routes match a753954 on every input, and gfx942/gfx950 cost and device code equal main. Item 1 is a slowdown that my r53 ask caused. Sorry for that.

  1. Fold the multi-wave test into _can_use_gfx1250_exact_sigmoid_topk so no stride is read twice (Important; default-path cost). aiter/ops/topk.py:119-149, :494-507. On gfx1250, contiguous E=900 calls keep main's Triton route but now cost about +1.7 µs per call over main (+0.8 µs over a753954). Unequal output strides cost +1.5 µs. Cause: _gfx1250_reg_mw_fits re-reads stride(0), .device, shapes and dtypes that _can_use has just read. Three independent paired-core runs agree; the controls are within ±0.2 µs. Fix: keep the strides, device and bias dtype that _can_use already reads in locals. After its gfx1250 check, end with return not (pitch % 4 == 0 and w_pitch == id_pitch and _reg_mw_supports_cached(experts, topk, torch.bfloat16, bias_dtype, device.index)), and delete _gfx1250_reg_mw_fits. The query stays the only shape source. This leaves E=900 at about +0.25 µs (the lru lookup) and the pitch and stride cases at +0.1 µs. gfx950 is unchanged. Routes are identical over 3M inputs. Update the tests that call _gfx1250_reg_mw_fits or assert _can_use (test_topk_gating.py:133,140,219,237,289,290,323).
  2. Put the arch query after the cheap terms in the C++ gates (Important). csrc/kernels/topk_softmax_kernels_group.cu:2438-2443: (reg_lanes == 64 || topk_reg_w32_arch_ok()) runs before E % 4, the EPL bound and the topk range. On RDNA, each grouped_topk/biased_grouped_topk_hip call without a group filter now pays a get_device_gfx() (hipGetDevice + mutex + map) that main skipped, and the answer is always false. gfx1250 calls that stay on LDS pay it too. Move it to the last term. At :2735-2737, test stride_gating % 4 == 0 before topk_reg_mw_args_ok. Every route stays the same, and wave64 is unaffected.
  3. Fix the comments (Nit):
    • .cu:444-445: this branch is kSlots == 2 and builds only at wave32. Suggested: "Not wave32_rank_desc_dpp: that ranks all 32 * kSlots slots, while this stops at n_cand, so the common n_cand <= WARP_SIZE row takes one warp_rank_desc."
    • .cu:2726-2732 and :51-55 (my r53 wording): a row that misses the gate with BF16 logits and an FP32 bias does not reach LDS. At E=768/896, or E=512/1024 with topk < 4 or 17, it fails the mixed-dtype AITER_CHECK (:2389), as on main. :51-55 also leaves out the bias-dtype term. Say both.
    • topk_reg_mw_kernel :1453: pivot > kNegInfKey && n_cand >= topk never decides. NaN keys are at least -inf, so n_cand >= topk always holds, and a -inf pivot gives n_cand == E > 64. Drop both terms and the header text :1180-1181. :1089-1092: "fewer than topk candidates" cannot happen in topk_reg_kernel either (the -inf pivot term there is live).
  4. Add the missing test cases (Nit). Removing the equal-stride term or the memoised query from the gate fails no test. Neither does deleting EPL 6/16/32 from AITER_TOPK_REG_LAUNCH_EPLS_W32. Add:
    • E=512 BF16, pitch 512, weights stride != ids stride: Triton route, correct weights.
    • E=900 contiguous through biased_grouped_topk: Triton route.
    • wave32 topk_reg_kernel rows at E=192, 512 and 1024 (e.g. grouped_topk softmax).
  5. Update the squash text (Nit): the head commit says a failing pitch "falls through to topk_reg_kernel or LDS"; add the FP32-bias abort. Also add the gate and test changes above.

CI: 41 pass, 1 pending (MI35X shard 6), 0 fail. All review threads are resolved.


Reviewed at 993d5f8 (deep; two independent passes. A: 3 hunters + ecc:review-pr + 3 verifiers + C2. B: 3 hunters + 2 verifiers + route/timing run). Already fixed: stride terms first, .cu:51/1089/1116/2722 text, test "gfx1250" notes, body and squash corrections (±0 claim checked exactly). Missed earlier: items 2-4 cover code unchanged since b197607 or older; I did not raise them before.

…eap terms first

_can_use_gfx1250_exact_sigmoid_topk now ends with the multi-wave test,
so biased_grouped_topk reads each stride, shape, dtype and the device
once: it keeps the row pitch, both output row strides, the bias dtype
and the device in locals and, after the gfx1250 check, returns False
when the pitch is whole quads, the output row strides are equal and the
memoised topk_reg_mw_supports accepts the row. _gfx1250_reg_mw_fits is
gone. Routes match a753954 and 993d5f8 for every input of a CPU probe
(762,048 inputs x 4 mocked queries x 4 archs).

In the C++ gates the arch query runs last: LAUNCHER_TOPK_REG tests
topk_reg_w32_arch_ok() after E % 4, the EPL bound and the topk range,
and the topk_reg_mw_kernel gate tests stride_gating % 4 before
topk_reg_mw_args_ok. Same routes; host code only.

topk_reg_mw_kernel drops `pivot > kNegInfKey && n_cand >= topk`, which
never decides: every key is at least float_order_key(-inf) (NaN is
keyed as -inf), the topk-th group maximum is reached by at least topk
keys, and a -inf pivot is reached by all E >= 512 keys, which already
takes the fallback. Only the eight topk_reg_mw_kernel instances change
on gfx1250 (14 fewer instructions each); gfx942 and gfx950 device code
is unchanged.

Comments: emit_legacy_ordered_topk's two-slot branch builds only at
wave32 and says why it is not wave32_rank_desc_dpp; topk_reg_kernel's
fallback has two triggers, not three; the EPL list note and the
topk_reg_mw_kernel gate note add the bias dtype and the FP32-bias abort.

Tests: test_exact_sigmoid_topk_triton_route checks that E=512 with
unequal weights/ids row strides and contiguous E=900 stay on the Triton
kernel with the reference's ids and weights; it fails if the equal-stride
term or the memoised query is dropped from the gate. test_moeTopkSoftmax
adds FP16-logit, FP32-bias rows at E=192, 512 and 1024, which only the
register path takes, so dropping EPL 6, 16 or 32 from
AITER_TOPK_REG_LAUNCH_EPLS_W32 aborts them on gfx1250. The other route
assertions use _can_use_gfx1250_exact_sigmoid_topk.

Squash text (the PR description's Changes section):

- `topk_reg_kernel` runs at wave32 for no group filter, E % 4 == 0,
  ceil(E / 32) in {4, 6, 8, 16, 32} and 4 <= topk <= 16, with two
  candidate slots per lane. At wave32 the instantiations only wave64
  launches (EPL 2, 3 and 14) compile to empty kernels.
- `topk_reg_mw_kernel` (wave32): E = 128 x {4, 6, 7, 8}, topk <= 17,
  BF16 logits with a row pitch that is a multiple of 4, BF16 or FP32
  bias, at any pointer alignment (gfx1250 vector loads take unaligned
  addresses). A row that misses this gate falls through to
  `topk_reg_kernel` or LDS, except that BF16 logits with an FP32 bias
  have no LDS path: at E=768/896, or E=512/1024 with topk < 4 or 17,
  such a row fails the mixed-dtype `AITER_CHECK`, as on main.
- Both wave32 paths are gated to gfx1250 and gfx1250-strict by arch
  (`topk_reg_w32_arch_ok`), the last term of each gate, so wave64 never
  queries it and other calls query it only after the cheaper terms
  pass; RDNA GPUs keep main's kernels.
- `biased_grouped_topk` on gfx1250 sends the one-group rows that fit the
  new kernel to `biased_grouped_topk_hip`. `_can_use_gfx1250_exact_sigmoid_topk`
  reads each tensor property once and ends with the kernel's own
  shape/dtype test, exposed as the memoised `topk_reg_mw_supports`
  binding, after the row-pitch term and equal weights/ids row strides
  (the HIP op writes both with the row stride of `topk_ids`); it reads
  no `data_ptr()`. `biased_grouped_topk` is an opaque custom op, so
  `torch.compile` never traces this gate: a compiled call runs it on the
  real tensors and picks the same kernel as an eager one. E=900, pitches
  that are not a multiple of 4 and unequal weights/ids row strides keep
  the Triton kernel. Calls with `num_expert_group == topk_group > 1` go
  to the HIP op as on main and on gfx1250 now also reach the register
  kernels, whose gate is `topk_grp == num_expert_group`; with every
  group selected, the group filter drops no expert.
- Tests: `test_moeTopkSoftmax.py` compares the new paths' random and
  tied rows bit for bit with the LDS kernel, including logits and bias
  one element past an aligned base and FP16-logit, FP32-bias rows at the
  wave32 EPLs 6, 16 and 32, and checks one-finite, all-NaN and all-zero
  rows for their exact expected weights and for valid, distinct ids
  (plus the winning id of one-finite rows). The HERD-width test in
  `test_topk_gating.py` and the biased-sigmoid benchmark in
  `test_moe_topk_gating.py` call the Triton kernel directly, since
  `biased_grouped_topk` now sends their rows to the HIP kernel; the test
  also checks that it does. New tests check that unaligned logits and
  bias take the HIP kernel with the bits of an aligned copy, that a
  compiled call of `biased_grouped_topk` returns the eager call's bits,
  and that E=512 with unequal output row strides and contiguous E=900
  stay on the Triton kernel with correct results. The benchmark runs
  only on gfx1250, since the Triton kernel keeps the wave32 tie order.

Corrections to earlier commit messages of this branch, which the squash
keeps:
- c0c7586: +0 and -0 do not differ: both paths give t = -0 for +0
  and t = +0 for -0. t differs only for 114 bf16 inputs with
  |x| <= 4.1e-36, by 1 ulp, and for no fp16 input (IEEE emulation on
  CPU).
- b197607: E=900, pitches that are not a multiple of 4 and unequal
  weights/ids row strides take the Triton kernel, not only E=900 and
  other pitches.
- 993d5f8: a row that fails the pitch term falls through to
  topk_reg_kernel or LDS, except that BF16 logits with an FP32 bias have
  no LDS path and fail the mixed-dtype AITER_CHECK (E=768/896, or
  E=512/1024 with topk < 4 or 17), as on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lirui927

Copy link
Copy Markdown
Contributor Author

Thanks for the review. All five items are addressed in e7019b4 (one commit on top of 993d5f8).

1. Multi-wave test folded into _can_use_gfx1250_exact_sigmoid_topk (aiter/ops/topk.py:40-106, call site :482-492)

  • The function reads the row pitch, both output row strides, the bias dtype and the device once, into locals, and uses them in its own contract terms. After the gfx1250 check it ends with return not (pitch % 4 == 0 and w_pitch == id_pitch and _reg_mw_supports_cached(experts, topk, torch.bfloat16, bias_dtype, device.index)) (:99-104). _gfx1250_reg_mw_fits is deleted, and biased_grouped_topk calls the one function.

  • Semantics check: the old _gfx1250_reg_mw_fits passed gating_output.shape[1], topk_ids.shape[1], gating_output.dtype, correction_bias.dtype and gating_output.device.index. At that point these equal experts, topk, torch.bfloat16 (because input_ok requires it), bias_dtype and device.index. So your expression keeps every route and every cache key unchanged. The docstring now says what the function decides: the call takes the Triton kernel.

  • Route probe (CPU, the dispatch code of each revision loaded with the kernels and the C++ query stubbed). Inputs: E {128, 256, 512, 768, 896, 900, 1024} x topk {1, 4, 5, 8, 9, 16, 17, 32} x logits/bias dtype {bf16, fp32, fp16}² x pitch pad {0, 1, 2, 3, 4, 8, 17} x weights pad {0, 1, 4, 8} x ids pad {0, 1, 4} x rows {0, 1, 3} x groups {(1,1), (8,8), (8,4)} x bias stride {1, 2}. That is 762,048 inputs per (arch, query); archs gfx1250, gfx1250-strict, gfx950 and gfx1201; C++ query mocked 4 ways (real contract, always true, always false, hash). Result: 0 route differences between a753954, 993d5f8 and e7019b4 over 12.2M decisions. Distinct C++ queries on gfx1250: 60 for each revision; none off gfx1250.

  • Host-cost A/B. Same harness, kernels stubbed, CPU tensors, 20k calls x 15 interleaved rounds, median ns per call. Pinned to one otherwise idle core (core 40); main/main2 and new/new2 are A/A pairs, within ±8 ns:

    case route a753954 − main 993d5f8 − main e7019b4 − main
    E=900 contiguous Triton +376 +824 +148
    E=900, pitch 902 Triton +374 +178 +42
    E=896, pitch 897 Triton +530 +177 +40
    E=896, weights stride 9 / ids 8 Triton +787 +428 +43
    E=512, weights stride 9 / ids 8 Triton +788 +440 +33
    E=896 contiguous (reg-mw) HIP (main: Triton) +785 +776 +137

    Three more runs ran concurrently on cores 8, 72 and 136, which are noisier. E=900 contiguous came out at +155 to +259 ns over main, and the pitch and stride cases at +48 to +101 ns. So E=900 is within your ≈+0.25 µs target and the pitch/stride cases are within ≈+0.1 µs. These are harness numbers with CPU tensors, so the absolute values differ from a real-tensor measurement; the ordering matches yours.

  • Tests (op_tests/triton_tests/moe/moe_routing/test_topk_gating.py):

    • :134 asserts _can_use(...) (pitch E + 17 stays on Triton) and replaces the old :133/:140 pair.
    • :214 (HERD widths), :311 (unaligned base) and :346 (compiled call) now assert not _can_use(...), i.e. the HIP route. The _gfx1250_reg_mw_fits asserts at old :237/:290/:323 are gone.

2. Arch query last in the C++ gates (csrc/kernels/topk_softmax_kernels_group.cu)

  • LAUNCHER_TOPK_REG (:2442-2448): (reg_lanes == 64 || topk_reg_w32_arch_ok()) is now the last term, after E % 4, the EPL bound and the topk range. The gate's doc bullet moved with it (:2435-2436).
  • topk_reg_mw_kernel gate (:2743-2744): stride_gating % 4 == 0 now comes before topk_reg_mw_args_ok.
  • Both functions are host-side: the macro expands inside the host launchers, and topk_reg_w32_arch_ok/topk_reg_mw_args_ok are static host functions that call get_device_gfx(). All reordered terms are side-effect-free booleans, so every route stays the same and wave64 still never queries the arch.
  • Build: module_moe_asm builds for gfx1250 on CPU with aiter's JIT (core.build_module, 135 s, no new warnings).
  • Device asm (--cuda-device-only -S, the module's JIT flags), 993d5f8 vs e7019b4: gfx942 and gfx950 are identical in all 801 functions. On gfx1250 only the eight topk_reg_mw_kernel instances differ, from item 3's code change; the gate reorder changes no device code.

3. Comments

  • .cu:446-448: uses your wording ("Not wave32_rank_desc_dpp: that ranks all 32 * kSlots slots, while this stops at n_cand, …"). It is accurate: kTopKRegCandCap is 64, so kSlots == 2 only at wave32.

  • .cu:2732-2736 and :51-56: both now say that a gate-missing row with BF16 logits and an FP32 bias does not reach LDS. At E=768/896, or E=512/1024 with topk < 4 or 17, it fails the mixed-dtype AITER_CHECK (:2393-2394), as on main. :51-56 also adds the bias-dtype term ("a BF16 or FP32 bias").

  • topk_reg_mw_kernel :1453 (now :1456-1472): I checked your reasoning in the code before dropping the terms:

    • Every key is float_order_key(s == s ? s : -INFINITY) (:1390), so no key is below kNegInfKey.
    • The pivot is the topk-th of the 32 group maxima, and each of those topk groups holds a key ≥ pivot. s_ncand counts every hit, uncapped, so n_cand >= topk always holds.
    • A pivot equal to kNegInfKey is reached by all E ≥ 512 keys, and E ≥ 512 > kTopKRegCandCap, so such a row already takes the fallback.

    So fast is dropped. The branches are now n_cand <= W / n_cand <= kTopKRegCandCap / fallback. The header text (:1183-1186) and the kNegInfKey note (:1348, still used by the fallback at :1522) are updated. Device code changes: each of the eight gfx1250 instances has 14 fewer instructions. On MI455X at e7019b4, after a clean module_moe_asm rebuild, test_moeTopkSoftmax.py (421 checks) and test_topk_gating.py (50 passed) pass, so the eight instances still match bit for bit.

  • .cu:1092-1094 (topk_reg_kernel): the fallback text now gives two triggers: a -inf pivot (fewer than topk lanes hold a score above -inf), or more than kTopKRegCandCap candidates. Lane maxima use fmaxf from -inf, so they are never NaN. Any pivot above -inf is reached by the topk lanes whose maximum is at least the pivot, so "fewer than topk candidates" cannot happen. The code keeps its n_cand >= topk term; only the text changed.

4. Missing tests

  • test_exact_sigmoid_topk_triton_route (test_topk_gating.py:241-267) has two cases. The first is E=512 BF16, pitch 512, weights row stride 9 and ids row stride 8. The second is E=900 contiguous through biased_grouped_topk. In both, biased_grouped_topk_hip is monkeypatched to raise, so the test checks the route at the public entry, and the results must match _torch_reference (ids exact, weights to 2e-5).
  • Wave32 topk_reg_kernel rows at E=192, 512 and 1024 (test_moeTopkSoftmax.py:1106-1117): these are FP16-logit, FP32-bias rows in fp32_bias_cases, bit for bit against the LDS reference. I did not use grouped_topk softmax rows. With EPL 6/16/32 deleted, such rows fall back to LDS and give the same bits, so no output check can catch the deletion. A bias of another dtype is taken only by the register path, and without the EPL the row hits the mixed-dtype AITER_CHECK. The logits are FP16 because BF16 logits at E=512/1024 with a whole-quad pitch go to topk_reg_mw_kernel first. On wave64 (MI CI), these rows take the wave64 register path (EPL 3/8/16).
  • Mutation checks:
    • CPU: the route assertions of every test in test_topk_gating.py, evaluated on the stubbed dispatch. All 30 cases hold on e7019b4. Dropping w_pitch == id_pitch fails exactly triton_route[512-9], and dropping the memoised query fails exactly triton_route[900-8].
    • On MI455X, under pytest, each of the two Python mutations fails test_exact_sigmoid_topk_triton_route with "took the HIP kernel".
    • On MI455X, with EPL 6/16/32 removed from AITER_TOPK_REG_LAUNCH_EPLS_W32 and the module rebuilt, the FP16/FP32-bias call aborts with "Mixed bias dtype requires the register top-k path" (.cu:2804). On e7019b4 the same driver passes at E=192, 512 and 1024.

5. Squash text: in the e7019b4 message, the Changes section now covers:

  • the FP32-bias abort for gate-missing rows;
  • the arch query as the last gate term;
  • the folded Python gate;
  • the new route test and FP16 rows.

A correction to 993d5f8's message ("falls through to topk_reg_kernel or LDS") is added to the list the squash keeps. The PR description's Changes section is updated to match.

Validation: black and ruff are clean, the JIT build for gfx1250 passes, and the asm diff is as above.
MI455X at e7019b4, after a clean module_moe_asm rebuild:

  • op_tests/test_moeTopkSoftmax.py: exit 0, 421 ref-vs-aiter checks passed, none failed.
  • op_tests/triton_tests/moe/moe_routing/test_topk_gating.py: 50 passed. The new route, HERD-width, unaligned-base and compiled-call tests give 44 passed.
  • The biased-sigmoid section of op_tests/test_moe_topk_gating.py (E 512-1024 and 900, topk 4/8/16, 1/64/8192 tokens): "All topk_gating benchmarks passed!"
  • All three mutation runs fail as described above.

@lirui927
lirui927 requested a review from valarLip November 23, 2026 06:58
@lirui927

Copy link
Copy Markdown
Contributor Author

@valarLip could you take another look when you have a moment? All five items from your review at 993d5f8 are addressed in e7019b4; the item-by-item reply and the MI455X results are in my comment above. CI is green at e7019b4 (45 passed, 0 failed), every review thread is resolved, and the branch has no conflicts with main. The PR is only waiting for your re-review.

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (1)

All five items from my 993d5f8 review are fixed at e7019b4, and I found no bugs in the delta. The gate fold keeps every route unchanged: the old _mw_fits passed gating_output.dtype, which input_ok already pins to BF16. Removing fast from topk_reg_mw_kernel also changes nothing: every row has n_cand >= topk, and a -inf pivot gives n_cand = E > 64, so such a row already took the fallback. The new route test does reach biased_grouped_topk_hip through the custom-op wrapper, and the FP16/FP32-bias rows fail when EPL 6/16/32 are dropped. One text fix is left. The wrong wording came from me.

  1. Scope the FP32-bias abort sentence to rows that fail only the pitch term (Nit; my r55 wording was incomplete).
    • Where: csrc/kernels/topk_softmax_kernels_group.cu:2733-2736, the matching bullet in the PR description / squash Changes list, and the same sentence in the PR body.
    • Problem: the comment reads "A row that misses this gate with BF16 logits and an FP32 bias never reaches LDS: at E=768/896, or E=512/1024 with topk < 4 or 17, it fails …". Read as a full list, it leaves out two kinds of rows that also hit the mixed-dtype AITER_CHECK:
      • group-filtered rows (topk_grp != num_expert_group) at E=512/1024, at any topk;
      • E=512/1024 rows with topk > 17.
    • The list is exact only for rows that fail the pitch term alone, which is how your 993d5f8 correction note already scopes it.
    • Suggested wording: "A BF16-logit, FP32-bias row that fails only the pitch term goes to topk_reg_kernel at E=512/1024 with 4 <= topk <= 16; otherwise (E=768/896, or topk < 4 or 17) it fails the mixed-dtype AITER_CHECK in LAUNCH_KERNEL, as on main."
    • :51-56 is correct as written; leave it.

CI: all required checks pass at e7019b4. All 3 review threads are resolved. The branch merges cleanly with current main, and the three main commits since the branch point touch these files without interacting with this PR.


Reviewed at e7019b4 (deep, delta re-review; two independent passes: A orchestrator delta + route/kernel trace, B independent hunter). Already fixed: gate folded into _can_use_gfx1250_exact_sigmoid_topk with locals, _gfx1250_reg_mw_fits deleted, arch query last in LAUNCHER_TOPK_REG, pitch before topk_reg_mw_args_ok, .cu:446/1092/1184/1348 text, dead fast term dropped, Triton-route test (E=512 unequal strides, E=900), FP16/FP32-bias rows at E=192/512/1024, squash corrections.

…the pitch term

A BF16-logit, FP32-bias row that fails only the pitch term reaches topk_reg_kernel at E=512/1024 with 4 <= topk <= 16; the mixed-dtype AITER_CHECK is hit otherwise. Comment only.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@lirui927

Copy link
Copy Markdown
Contributor Author

Fixed in 6a8a527 (comment only). The sentence at csrc/kernels/topk_softmax_kernels_group.cu:2733-2737 now reads as you suggested: a BF16-logit, FP32-bias row that fails only the pitch term goes to topk_reg_kernel at E=512/1024 with 4 <= topk <= 16, and otherwise (E=768/896, or topk < 4 or 17) fails the mixed-dtype AITER_CHECK in LAUNCH_KERNEL, as on main. The matching bullet in the Changes list of the description says the same; it is the only place in the description that had the old wording. :51-56 is untouched.

Nothing was rebuilt for this commit: git diff e7019b49 6a8a5272 is that comment.

@lirui927
lirui927 requested a review from valarLip November 25, 2026 06:33
@lirui927

Copy link
Copy Markdown
Contributor Author

@valarLip could you take another look? Your review of 2026-11-24 found no bugs at e7019b4 and left one text fix.

  • The FP32-bias abort sentence is scoped to rows that fail only the pitch term, with your wording, in 6a8a527 (csrc/kernels/topk_softmax_kernels_group.cu:2733-2737) and in the description. git diff e7019b49 6a8a5272 is that comment only.
  • Since then the branch only took main in twice (a1277ed, aa3a0de): no conflicts, and main changed neither the kernel source nor csrc/include/moe_op.h; in aiter/ops/topk.py it changed only the top_k_per_row_decode dispatch, not the gate this PR edits.
  • All three review threads are resolved.

…pk-mw

Conflicts with #7338 (readlane/DPP top-k) in two files:

- csrc/kernels/topk_softmax_kernels_group.cu: both sides' helpers stay
  (warp_rank_desc_slots; warp_rank_desc_upto, lane_serial_sum).
  emit_legacy_ordered_topk is main's template <bool UNROLLED> with this
  branch's slot split: the one-slot arm (wave64) takes main's unrolled
  rank tiers, the two-slot arm (wave32) is unchanged, and the renorm
  tail is main's. main's ballot compaction and readlane pivot merge
  without conflict and now also run at wave32 for EPL 4, 6 and 8.
- op_tests/test_moeTopkSoftmax.py: thirty_two_way_tie keeps pattern id
  7, forty_way_tie takes 8 (the id only seeds the rows). main's padding
  loop gives 260 for the two ref260 cases, so ref_experts goes and the
  cases move into stable_cases.

Device code of module_moe_asm: gfx942 and gfx950 match main for every
kernel main has; on gfx1250 only topk_reg_kernel EPL 4, 6 and 8 change
against aa3a0de. Not run on a GPU.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@lirui927

Copy link
Copy Markdown
Contributor Author

Merged main 4960107 (5344e7f) to resolve the conflict with #7338, which rewrote parts of topk_reg_kernel and emit_legacy_ordered_topk.

  • csrc/kernels/topk_softmax_kernels_group.cu: emit_legacy_ordered_topk is main's template <bool UNROLLED> with this PR's kSlots split. The one-slot arm (wave64) is main's code including the unrolled rank tiers; the two-slot arm (wave32) and warp_rank_desc_slots are as at aa3a0de; the renorm tail is main's. Every kernel line comes from one of the two parents. The tiers are left out of the two-slot arm on purpose: they would be valid there for n_cand <= 16, but that arm's rank already stops at n_cand, so I would rather add them with MI455X numbers in a separate commit.
  • Main's ballot compaction, readlane pivot and unrolled renorm sum merged without conflict and now also apply to the wave32 instances at EPL 4, 6 and 8. Slot order does not matter to the emit (it ranks by a unique key), slots stay below kTopKRegCandCap, and at wave32 the ballot's high half is zero.
  • op_tests/test_moeTopkSoftmax.py: all cases of both sides run (54 stable calls: 47 + main's 7). Main's padding loop yields the same 260-wide reference as ref_experts=260 did, so that parameter is gone and its two cases sit in stable_cases. Both sides had used pattern id 7; thirty_two_way_tie keeps it and forty_way_tie takes 8, which only changes which 40 experts are tied in its six rows.

Checked on CPU: module_moe_asm builds for gfx942, gfx950 and gfx1250. Per-kernel device asm on gfx942 and gfx950 is identical to main for all 1440 kernels main has. On gfx1250, against aa3a0de, the 180 topk_reg_kernel instances at EPL 4, 6 and 8 change (main's compaction and renorm sum; 5 to 28 fewer instructions, 4 to 9 more VGPRs), 20 EPL-32 softmax instances have the same instructions with two blocks placed differently, and the other 1248 kernels are identical.

On MI455X (one idle GPU, module rebuilt from this tree): test_moeTopkSoftmax.py exits 0 with all 54 stable rows at err 0, test_topk_gating.py gives 50 passed, and the biased-sigmoid section of test_moe_topk_gating.py (E 512 to 1024, topk 4/8/16, 1/64/8192 tokens) exits 0. A timing A/B of topk_reg_kernel at E = 128, 192 and 256 against aa3a0de (54 shapes, alternating, two rounds) gives the same ids and weight bits in every shape and a median ratio of 1.017 and 0.972, inside the spread between two runs of aa3a0de itself (1.015, up to 1.06): main's compaction is neither faster nor slower at wave32 beyond noise.

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM

Thanks. The one item from my e7019b4 review is fixed, and the merge with main's #7338 is resolved correctly. I found no bugs in the delta.

Prior asks

  • The FP32-bias abort sentence is now scoped to rows that fail only the pitch term. Fixed in the suggested wording at csrc/kernels/topk_softmax_kernels_group.cu:2805-2808 and in the Changes bullet of the description. :51-56 is untouched. All earlier asks were confirmed fixed at e7019b4, and the delta does not touch them.

Merge with #7338

  • emit_legacy_ordered_topk (.cu:430-521):
    • At wave64, kTopKRegCandCap / WARP_SIZE == 1, so only the kSlots == 1 arm builds. That arm is main's code line for line: the unrolled warp_rank_desc_upto<8/16> tiers, the barrier and the store. live/ci/key are now declared inside the arm.
    • cand_idx sits at the same offset as on main (kTopKRegCandCap = 64 = main's WARP_SIZE).
    • So gfx942/gfx950 behave exactly as on main.
  • At wave32, topk_reg_kernel now uses main's ballot compaction and readlane pivot for EPL 4/6/8 as well. That is correct there:
    • The emit ranks by a unique (score, tie rank) key, so slot order does not matter.
    • Positions are written only after n_cand <= 64.
    • The pivot lane topk - 1 is at most 15 (topk <= reg_lanes / 2).
    • The -inf tails of a masked last round (E=252) never pass v >= pivot.
    • lane_serial_sum<8> adds +0.0f for lanes >= topk, so the renorm bits match the serial loop.
  • Test:
    • Main's padding loop gives 260 for both former ref_experts=260 cases. Every padded reference (260, 516, 772, 900, 1028) misses the wave64 and wave32 EPL lists and the multi-wave sizes, so it takes LDS at both wave sizes, as the new comment says.
    • Over E = 4..2048 (step 4), only E=764 would pad to a multi-wave width (768), and no case uses it.
    • forty_way_tie moving to id 8 only changes the seed.

Root cause vs patch

Root problem: topk_reg_kernel assumed wave64, so gfx1250 routing fell back to LDS or Triton. The PR makes the register kernel wave-size generic (two candidate slots per lane at wave32). It adds one multi-wave kernel whose shape contract has a single source, topk_reg_mw_args_ok, which Python queries through topk_reg_mw_supports. The gfx1250 gate is the last term and limits the new paths to the validated arch; the wave64 kernels are untouched. Verdict: root fix.

Merge note: squash with the description's Changes section, not the commit list. Some commit messages are stale at head, e.g. "Not run on a GPU" in 5344e7f: MI455X was run afterwards (54 stable rows err 0, test_topk_gating.py 50 passed).

CI: 44 pass, 25 skipped, 0 fail at 5344e7f. All 3 review threads are resolved. The PR merges cleanly into current main.


Reviewed at 5344e7f (re-review after e7019b4, passes A+B, both LGTM independently; true delta = old replayed onto merge base 4960107 -> head: 6a8a527 comment fix + merge of #7338). Already fixed: all prior asks incl. the FP32-bias abort scope.

@lirui927
lirui927 requested a review from valarLip December 1, 2026 06:41

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 5344e7f. Squash with the PR body's Changes section (the commit list has a stale "Not run on a GPU").

@valarLip
valarLip merged commit 66e361f into main Dec 1, 2026
74 of 75 checks passed
@valarLip
valarLip deleted the perf/gfx1250-reg-topk-mw branch December 1, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants