Repository navigation
[FlyDSL] [gfx1250] Compile mxfp8_128 GEMMs whose scale-B tile is one element - #7924
Conversation
…element Since #7655 the mx128 scale-B TDM atom is built with make_tiled_tdm_atom. A tile_n <= 128, tile_k == 128 config loads one N block x one K block of scale-B per k-tile, and a one-element tile has no contiguous run for the TDM descriptor, so the kernel fails to compile with "no common tile/global vectorization". This breaks the DeepSeek-V4 indexer wq_b (M=64, N=8192, K=1536) and a set of Kimi-K3 decode rows on gfx1250. Load a second row for that tile. The scale-B view keeps its real row count, so boundary_check zero-fills the extra row, and the kernel reads only row 0. Co-authored-by: Cursor <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
xudoyuan
left a comment
There was a problem hiding this comment.
LGTM. Waiting for a FLYDSL version update.
Summary
Fix the gfx1250 FlyDSL mxfp8_128 GEMM compile failure for configs with
tile_k == 128andtile_n <= 128, a regression from #7655:Motivation
#7655 moved the scale-B load to
make_tiled_tdm_atom. Withtile_k == 128andtile_n <= 128, each k-tile loads one N block x one K block of scale-B, a 1x1 tile.construct_tdm_gbasisfinds the contiguous run by inverting the LDS tile. A one-element tile coalesces to1:0and has no run (smemRank == 0), so the kernel does not compile. Configs where the tile spans 2 or more elements (tile_n = 256gives (2, 1),tile_k = 256gives (1, 2)) are not affected.Tuned rows on main that no longer compile:
wq_b(M=64, N=8192, K=1536,t32x128x128_mw1_nw4_nb3). DeepSeek-V4-Pro fails on it during CUDA graph capture at bs=64.t32x32x128,t16x64x128,t16x128x128, ...).Changes
When scale-B would be one element, the TDM tile loads a second row. The scale-B view keeps its real row count, so
boundary_checkzero-fills that row instead of reading pastw_scale. The kernel reads only row 0 (n_blockis always 0), and the LDS stage is 16 bytes either way. All other configs keep the sameSB_SHAPE, so their kernels and AOT cache keys are unchanged.Testing
On MI455X (
gfx1250), inrocm/fw-bringup-mlperf:gfx1250-atom-20261111with aiter main40565597(FlyDSL 0.5.0):launch_gemm_a8w8, mx128 dense:t32x128x128,t64x128x128,t32x64x128,t16x128x128,t32x32x128andt16x64x128fail before (they compile before [FlyDSL] V0.4.2 Tdm new interface refactor: make_tdm_atom -> make_tiled_tdm_atom #7655) and compile with this PR.t32x256x128,t256x256x128andt64x64x256compile on both.t32x128x128/t32x64x128/t16x128x128at (M, N, K) = (64, 8192, 1536), (48, 8192, 1536), (1, 1024, 7168), (37, 128, 1536) and (100, 3072, 1536), plus batchedt32x128x128, match a dequantized torch reference (cosine 0.999999). The weight scale changes per 128 block, so a wrong scale-B read would show.python3 -m aiter.aot.flydsl.gemm), gfx1250 rows: all 267 rows of the three DeepSeek-V4 GEMM tables pass (on main only thewq_brow fails), and the 36 Kimi-K3 rows above pass. Compared with a main build, the other 135 cache keys are unchanged; the only new key is thewq_bkernel.test_gemm_a8w8_mxfp8_bpreshuffle.py,test_flydsl_batched_gemm.py,test_batched_gemm_a8w8_mxscale_bpreshuffle.pyandtest_gemm_a8w8_bpreshuffle_pad_k.pypass.455-CI-recipe.mdserver (DP4 attention + EP4 MoE, CUDA graphs), ATOM main373a27fb, with this PR and [FlyDSL] [gfx1250] Pass arg_scale_out on every cached launch_gemm_a8w8 launch #7920: all 15 CUDA graph sizes capture. GSM8K 3-shot: flexible-extract 0.9469, strict-match 0.9477 (1319 samples).Black and Ruff (0.16.0) pass.
Documentation
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
ee16385054f09a9a32496e597333fc7c798e8fd3Behavior and intent
mxfp8_128 GEMM configs with one N block and one K block of scale-B per k-tile compile again and give correct results. Every other config is unchanged.
Validation and unverified scope
See Testing. MI250X and MI300X were not tested because the kernel is gfx1250-only. Performance of the fixed configs was not re-measured: each k-tile now also loads one more scale byte per workgroup. The batched preload path (
SB_TDM_SHAPE = (N_BLOCKS, preload_ks)) is untouched, and no tuned row haspreload_ks == 1.PR-specific question
On main,
python3 -m aiter.aot.flydsl.gemm --csv aiter/configs/model_configs/dsv4_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csvfails on the gfx1250 M=64 N=8192 K=1536 row with the error above. With this PR it passes.Changed op tests
None.