Skip to content

[FlyDSL] [MoE] Fit the gfx1250 grouped GEMM k-tile to K, and refuse one that does not divide it - #6706

Closed
gbyu-amd wants to merge 1 commit into
mainfrom
gyu/grouped-moe-fit-tile-k
Closed

gbyu-amd wants to merge 1 commit into
mainfrom
gyu/grouped-moe-fit-tile-k

Conversation

@gbyu-amd

@gbyu-amd gbyu-amd commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The gfx1250 TDM grouped GEMM behind _grouped_a8w4_tdm_moe runs K // tile_k k-tiles and has no tail, so a tile_k that does not divide K silently drops the rest of K.

Every tuned grouped row divides its K. A shape without a tuned row takes the defaults, tile_k = 256 for both stages, and those do not divide a tensor-parallel expert slice: Kimi-K3 at TP8 has inter_dim = 3072 / 8 = 384, so stage 2 sums only 256 of its 384 K. Nothing raises; the MoE output is just wrong.

Fix

  • _grouped_a8w4_tdm_moe narrows each stage's tile to the widest of tile_k, 512, 256 and 128 (never wider than the requested one) that divides that stage's K, and logs when it changes it. Tuned rows already divide their K, so they are unchanged.
  • flydsl_grouped_gemm_a8w4_masked raises ValueError for a tile_k that does not divide K, instead of dropping the remainder.

Validation

  • Grouped MoE against the fp32 reference (a4w4, Situv2, 896 experts, top-16, model_dim 3584, inter_dim 384): logits_diff 0.195 and rel_l2 0.571 with the default tile_k2 = 256; 3.6e-6 and 0.0027 with 128, the same as at inter_dim 512 or 3072.
  • Kimi-K3 served on two MI455X nodes (4 GPUs each) with TP8 + DCP8 attention and MoE TP8, through feat(tp): run one tensor-parallel group across nodes ATOM#2647: GSM8K 5-shot strict-match 0.8923 before, 0.9621 ± 0.0053 after. MoE EP8, which has no TP expert slice, scores 0.9575 on the same setup.
  • black and ruff (0.16.0) are clean.
  • Validated on dee019f. Neither file has changed on main since, and the commit cherry-picks onto main (033e8bd) without conflicts.

Notes

…e that does not divide it

The TDM grouped GEMM runs K // tile_k k-tiles and has no tail, so a tile that
does not divide K silently drops the rest of it. Every tuned grouped row
divides its K, but the defaults a shape without a row takes (tile_k = 256 for
both stages) do not for a tensor-parallel expert slice: Kimi-K3 at TP8 has
inter_dim = 3072 / 8 = 384, so stage 2 summed 256 of its 384 K. On aiter's own
grouped check (a4w4, Situv2, 896 experts, top-16, model_dim 3584, inter_dim
384) that is logits_diff 0.195 and rel_l2 0.571 against the fp32 reference;
with tile_k2 = 128 it is 3.6e-6 and 0.0027, as for inter_dim 512 or 3072.
Served, the model lost 7 points of GSM8K (0.8923 against 0.9575).

_grouped_a8w4_tdm_moe now narrows each stage's tile to the widest of 512, 256
and 128 that divides its K, and flydsl_grouped_gemm_a8w4_masked raises for a
tile that does not.

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

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
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 gfx1201 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 6706 --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.

@gbyu-amd

gbyu-amd commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

This PR is just a WA. Close it now since main has fixed the issue.

@gbyu-amd gbyu-amd closed this Nov 4, 2026
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.

1 participant