Skip to content

[Release v0.1.22] Cherry-pick MXFP4 MoE OOB fix, MoE sorting and routing fixes, fp8 MQA logits split-k and DSv4 tunings (#5573, #5295, #5558, #5603, #5627, #5485) - #5638

Merged
vgokhale merged 6 commits into
release/v0.1.22from
hotfix/v0.1.22-post1
Sep 17, 2026

Conversation

@vgokhale

@vgokhale vgokhale commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Cherry-picks six already-merged main PRs onto release/v0.1.22 for the v0.1.22.post1 post release.

PR main commit Backport commit What
#5485 9252f4672 155534984 Extend the DeepSeek-V4 a8w8 blockscale GEMM tunings for gfx950 (tuning CSV only)
#5573 22d2c7c91 6b23ba866 Pad the MXFP4 A4W4 MoE sort extent to a block_size multiple (fixes a HIP illegal memory access)
#5295 972c8e1fd 7d68b0edb Skip invalid expert IDs in MoE sorting
#5558 3fdfca11e dd83a9d17 Fix MoE routing kernel compile failure
#5603 a84bd368c a96461997 Add split-k support for fp8 MQA logits on gfx950
#5627 f5ed7dc54 a41214712 Follow-up to #5603: drop chunking when summation folding is unavailable (fixes Triton 3.6 compile)

Original PRs:

To be published as v0.1.22.post1 once merged (tag on the merge commit, release automation builds the wheel set).

LiuYinfeng01 and others added 6 commits September 17, 2026 10:07
…50 (#5485)

* Add the missing DeepSeek-V4 a8w8 blockscale GEMM shapes for gfx950

The file already covers four of the six (N, K) families this model drives, but
only at a coarse M ladder, and carries no entry at all for the two vocabulary
projections:

  N       K     before  added  after
  7168    7168      61    594    655
  6144    7168      15     39     54
  7168    3072      15     39     54
  65536   1536      15     39     54
  129280  7168       0     16     16
  16160   7168       0      7      7

Pure addition: the 310 existing rows are byte-identical, no key is duplicated,
and every added row has errRatio 0.0. Tuned with aiter's own tuner at the
default ERR_RATIO on gfx950 with cu_num=256, matching the rest of the file. M
values follow the ladder the file already uses, restricted to the range each
family reaches at runtime.

Without these rows the entry point reports "not found tuned config" for every
distinct (M, N, K) DeepSeek-V4 issues; in one 3600-second AgentX run on MI355X
that fires 14066 times, each falling back to a kernel chosen without knowledge
of the tile.

Per-shape, 40 shapes sampled across the M range of all six families, measured
against the current table where all 40 fall back: median 2.79x, mean 2.94x,
max 5.86x, 50860us -> 11700us in aggregate; the gain grows with M. One shape,
M=64 N=7168 K=3072, is 0.94x, within run-to-run spread at 12us.

In a captured prefill trace the blockscale-family GEMM time per step per rank
falls from 500.1ms to 244.8ms, with the untuned ck::kernel_gemm_xdl_cshuffle_v3
fallback going from 171 calls at 2059us to 46 at 555us.

End to end on DeepSeek-V4-Pro, MI355X x8, TP1/DP8, FP8 KV, MTP-3, concurrency
64, full 3600-second window with everything else byte-identical: 27,003,552 ->
30,319,229 tokens/$ (+12.3%) and 7.055 -> 8.654 P90 interactivity (+22.7%).

* Retune four N=65536 K=1536 rows onto the ck_tile aqrm kernels

At M = 4, 128, 256 and 512 the best pick moves off the ck kernels. Timed here
against the rows they replace, both kernels back to back in one process on the
same tensors with the arms interleaved, medians over 7 repeats of 50 iterations
after 20 warmup calls, on MI355X gfx950 cu_num=256:

  M    current   proposed  speedup
  512   78.01us   61.75us    1.26x
  128   25.17us   21.11us    1.19x
    4   17.15us   16.22us    1.06x
  256   42.07us   40.50us    1.04x

Tuning also produced a different pick for 15 further shapes already in the file.
Re-timing them the same way put every one within 1% of the row already there, so
they are left untouched: 13 resolve to the identical ck_tile tile config
192x256x128_4x2x1_16x16x128_intrawave_0x1x0 and differ only in a trailing
variant index, meaning the spread between the two tuning runs was noise rather
than a kernel difference. No shape regressed.

---------

Co-authored-by: LiuYinfeng01 <[email protected]>
(cherry picked from commit 9252f46)
…le (#5573)

* fix(fused_moe): pad MXFP4 A4W4 MoE sort extent to a block_size multiple

The flydsl MXFP4 A4W4 atomic MoE gemm2 kernel hard-faults with a HIP
"illegal memory access" under load. Root cause is a broken block-alignment
invariant between the sort stage and the gemm kernel, not a bug in the
arithmetic:

  * gemm2s atomic epilog runs the NON-persistent grid and issues
    _issue_all_a_loads() unconditionally for every grid block (incl. the
    trailing padding block) BEFORE the `if bx_i32 < bound` guard, relying on
    the A buffer descriptor to clamp. The descriptor is sized to
    max_m_blocks*BM rows (max_m_blocks = ceil(max_sorted/BM)).
  * The A buffer (inter_sorted_quant) is allocated with exactly max_sorted
    rows. When max_sorted is not a multiple of BM the descriptor over-reads
    ceil(max_sorted/BM)*BM - max_sorted rows and faults on an unmapped page.

_adaptive_moe_sort always rounds max_sorted up to a BM multiple, so the
unconditional load is safe there. PR #4526 added _aux_uses_opus(), which
diverts the A4W4 atomic path to the Opus sort whose
max_num_tokens_padded = topk_ids.numel() + num_experts*block_size - topk
is NOT a block multiple, breaking the invariant.

Fix: round max_num_tokens_padded up to max_num_m_blocks*block_size in both
Opus/flydsl sort sizing sites, matching what _adaptive_moe_sort maintains.
max_num_m_blocks is unchanged; only the row extent is enlarged.

Validated on Kimi-K2.7-Code-MXFP4 (-tp 4): full gsm8k sweep 1319/1319 clean
(0 illegal-memory-access), accuracy 0.9484 flexible / 0.9477 strict.

Adds op_tests/flydsl_tests/test_mxfp4_a4w4_moe_oob.py, a standalone,
model-free repro with three tests:
  * test_moe_sorting_opus_row_extent_block_aligned - drives the production
    sort (output_aux=AUX_SORT_OPUS) and asserts the sorted extent is a
    block multiple (deterministic; fails pre-fix, passes post-fix).
  * test_mxfp4_gemm2_descriptor_fits_allocation - the same invariant as pure
    arithmetic, naming the exact 21 rows over-read at the K2.7 fault shape.
  * test_mxfp4_a4w4_gemm2_illegal_access - runs the real production kernel
    flydsl_mxfp4_gemm2(atomic=True) at the fault shape with the A buffer
    against a VMM guard page, reproducing the actual HIP illegal memory
    access in a subprocess (SIGABRT pre-fix, clean exit post-fix).

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* test(moe): integrate MXFP4 OOB regression

Run the allocation invariant from the top-level MoE test so standard Aiter CI collects it. Keep the VMM guard-page check behind gfx950, CuPy, and HIP VMM capability checks, and retain a focused CLI entry for local reproduction.

* test(moe): reuse sorting coverage for OOB regression

Enforce the block-aligned allocation contract in the existing MoE sorting reference and output comparisons. Add a focused AUX_SORT_OPUS case across supported block sizes, replacing the bespoke VMM and subprocess machinery in test_moe_2stage.

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: fsx950223 <[email protected]>
(cherry picked from commit 22d2c7c)
* [MOE] Skip invalid expert IDs in sorting

Treat padded routing IDs as unrouted before expert-indexed accesses to prevent out-of-bounds writes in Opus and FlyDSL sorting.

* [FlyDSL] Simplify MoE sorting validity predicates

(cherry picked from commit 972c8e1)
* fix compiler pass error

Signed-off-by: Micah Williamson <[email protected]>
Co-authored-by: Cursor <[email protected]>

* clean up

Signed-off-by: Micah Williamson <[email protected]>

* Add compile regression test for _combined_routing[_fused]

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

* Revert "Add compile regression test for _combined_routing[_fused]"

This reverts commit d78bdfe.

Signed-off-by: Micah Williamson <[email protected]>

---------

Signed-off-by: Micah Williamson <[email protected]>
Co-authored-by: Cursor <[email protected]>
(cherry picked from commit 3fdfca1)
* [Triton/Gluon] [GFX950] Split the KV walk in fp8_mqa_logits

* tune splitk

* 2d splitk grid

* remove constexpr splitk to remove compilations

* minor changes

* apply black

* expand fp8_mqa_logits test coverage

* fix 1250 path

(cherry picked from commit a84bd36)
@vgokhale
vgokhale merged commit b4d9154 into release/v0.1.22 Sep 17, 2026
3 checks passed
@vgokhale
vgokhale deleted the hotfix/v0.1.22-post1 branch September 17, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants