Repository navigation
[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
Conversation
…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)
(cherry picked from commit f5ed7dc)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picks six already-merged
mainPRs ontorelease/v0.1.22for thev0.1.22.post1post release.maincommit9252f467215553498422d2c7c916b23ba866972c8e1fd7d68b0edb3fdfca11edd83a9d17a84bd368ca96461997f5ed7dc54a41214712Original PRs:
To be published as
v0.1.22.post1once merged (tag on the merge commit, release automation builds the wheel set).