Skip to content

[FlyDSL] [gfx1250] Compile mxfp8_128 GEMMs whose scale-B tile is one element - #7924

Merged
coderfeli merged 1 commit into
mainfrom
xiaobingsuper/flydsl-gfx1250-mx128-one-element-scale-tile
Nov 13, 2026
Merged

coderfeli merged 1 commit into
mainfrom
xiaobingsuper/flydsl-gfx1250-mx128-one-element-scale-tile

Conversation

@XiaobingSuper

Copy link
Copy Markdown
Contributor

Summary

Fix the gfx1250 FlyDSL mxfp8_128 GEMM compile failure for configs with tile_k == 128 and tile_n <= 128, a regression from #7655:

fly_rocdl.make_tiled_tdm_load_atom: no common tile/global vectorization — the LDS tile and the global
tile do not share a contiguous innermost run. Does the tiler select out the major global mode?

Motivation

#7655 moved the scale-B load to make_tiled_tdm_atom. With tile_k == 128 and tile_n <= 128, each k-tile loads one N block x one K block of scale-B, a 1x1 tile. construct_tdm_gbasis finds the contiguous run by inverting the LDS tile. A one-element tile coalesces to 1:0 and has no run (smemRank == 0), so the kernel does not compile. Configs where the tile spans 2 or more elements (tile_n = 256 gives (2, 1), tile_k = 256 gives (1, 2)) are not affected.

Tuned rows on main that no longer compile:

  • the DeepSeek-V4 indexer 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.
  • 36 Kimi-K3 gfx1250 rows (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_check zero-fills that row instead of reading past w_scale. The kernel reads only row 0 (n_block is always 0), and the LDS stage is 16 bytes either way. All other configs keep the same SB_SHAPE, so their kernels and AOT cache keys are unchanged.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

On MI455X (gfx1250), in rocm/fw-bringup-mlperf:gfx1250-atom-20261111 with aiter main 40565597 (FlyDSL 0.5.0):

  • Compile-only launch_gemm_a8w8, mx128 dense: t32x128x128, t64x128x128, t32x64x128, t16x128x128, t32x32x128 and t16x64x128 fail 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, t256x256x128 and t64x64x256 compile on both.
  • Numerics: dense t32x128x128 / t32x64x128 / t16x128x128 at (M, N, K) = (64, 8192, 1536), (48, 8192, 1536), (1, 1024, 7168), (37, 128, 1536) and (100, 3072, 1536), plus batched t32x128x128, match a dequantized torch reference (cosine 0.999999). The weight scale changes per 128 block, so a wrong scale-B read would show.
  • FlyDSL AOT (python3 -m aiter.aot.flydsl.gemm), gfx1250 rows: all 267 rows of the three DeepSeek-V4 GEMM tables pass (on main only the wq_b row 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 the wq_b kernel.
  • test_gemm_a8w8_mxfp8_bpreshuffle.py, test_flydsl_batched_gemm.py, test_batched_gemm_a8w8_mxscale_bpreshuffle.py and test_gemm_a8w8_bpreshuffle_pad_k.py pass.
  • DeepSeek-V4-Pro, 455-CI-recipe.md server (DP4 attention + EP4 MoE, CUDA graphs), ATOM main 373a27fb, 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

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed: no API change.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None.

PR Self-Review

Reviewed revision

ee16385054f09a9a32496e597333fc7c798e8fd3

Behavior 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 has preload_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.csv fails on the gfx1250 M=64 N=8192 K=1536 row with the error above. With this PR it passes.

Changed op tests

None.

…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]>
@XiaobingSuper
XiaobingSuper requested review from a team and a balanced review from Copilot November 13, 2026 08:10

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@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 7924 --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.

@xudoyuan xudoyuan 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.

LGTM. Waiting for a FLYDSL version update.

@coderfeli
coderfeli merged commit eda91f3 into main Nov 13, 2026
@coderfeli
coderfeli deleted the xiaobingsuper/flydsl-gfx1250-mx128-one-element-scale-tile branch November 13, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants