Skip to content

Add GLM-5 MXFP4 EP4 decode fused-MoE rows - #5986

Merged
yzhou103 merged 2 commits into
ROCm:mainfrom
xiaofei-zheng:feature/xiaofei/fmoe-tuned-cfg-glm53-mxfp4-ep4
Oct 8, 2026
Merged

yzhou103 merged 2 commits into
ROCm:mainfrom
xiaofei-zheng:feature/xiaofei/fmoe-tuned-cfg-glm53-mxfp4-ep4

Conversation

@xiaofei-zheng

@xiaofei-zheng xiaofei-zheng commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

GLM-5.3 Quark MXFP4 TP4/EP4 decode has no tuned fused-MoE row for the gfx950/256-CU per-rank shape (model_dim=6144, inter_dim=2048, E=65, topk=8), with SiLU, BF16 output, and per-1x32 MXFP4 activations and weights. The heuristic stage-1 kernel writes BF16 and requires another activation quantization and sort before stage 2.

Add tuned and untuned rows for padded token tiers 8/16/32/64, covering runtime M=5–64, plus dispatch tests for the FP4 stage-1 epilogue, stage-2 kernel, fuse_quant=fp4, and block_m=32. Other architectures, CU counts, M<=4, and M>64 keep their existing dispatch. Host validation covered 42 tests and 45 subtests.

On MI355X, a HIP-graph comparison against the stock heuristic path saved 4.3–6.0 us per layer at M=12/24/36. Environment: ROCm 10.0, SGLang abef3efb64, AITER base acf8fdf930, TP4/EP4.

@xiaofei-zheng
xiaofei-zheng requested review from a team and a balanced review from Copilot September 30, 2026 08:38

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 review overview

🔵 Needs a closer look

The GPU correctness and performance claims cannot be confirmed by the dispatch-only test or the available environment.

Review effort: Balanced
Findings: None

What changed in this PR

Adds tuned gfx950 dispatch configurations for GLM-5 MXFP4 EP4 decoding, selecting fused FP4 stage-1 kernels.

Changes:

  • Adds tuned and untuned rows for 8–64 token tiers.
  • Adds dispatch tests covering kernel selection and FP4 quantization metadata.
File Description
op_tests/​test_moe_glm5_fp4_ep_dispatch.py Verifies tier mapping and selected kernels.
aiter/​configs/​model_configs/​glm5_fp4_untuned_fmoe.csv Registers GLM-5 EP4 tuning shapes.
aiter/​configs/​model_configs/​glm5_fp4_tuned_fmoe.csv Adds measured gfx950 kernel selections.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@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
multigpu 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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 5986 --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.

@github-actions github-actions Bot changed the title [Config] Add GLM-5 MXFP4 EP4 decode fused-MoE rows Add GLM-5 MXFP4 EP4 decode fused-MoE rows Sep 30, 2026
Copilot AI balanced review requested due to automatic review settings September 30, 2026 09:07

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 review overview

🔵 Needs a closer look

Hardware-specific GPU correctness and performance were not independently validated in this review.

Review effort: Balanced
Findings: None

@zufayu
zufayu requested a review from yzhou103 October 1, 2026 00:34
@yzhou103
yzhou103 merged commit 72546b3 into ROCm:main Oct 8, 2026
63 checks passed
peizhang56 added a commit to peizhang56/aiter that referenced this pull request Oct 9, 2026
Tuned rows for (model_dim 4096, inter_dim 2048, expert 289, topk 9) at
QuantType.per_1x32 -- GLM-5.3-Flash served at TP1 with shared-experts fusion on,
so the shared expert is folded into the routed MoE as E=289/topk=9. Tokens
32/64/128 cover the decode range (batch x 4 draft tokens, padded by
get_padded_M to the next power of two) and 16384 is the prefill chunk.

Produced by csrc/ck_gemm_moe_2stages_codegen/gemm_moe_tune.py --mp 8
--shape_grouped (1472 candidates, all four shapes tuned, no failures).

The rows select the _fp4 stage-1 variants, which fold the fp4 quant+sort into
the GEMM (gemm_moe_tune.py:5497). Without a tuned row the heuristic fallback in
aiter/ops/flydsl/moe_kernels.py branches on inter_dim % 256 alone and picks the
UNFUSED t32x128x256_w2, so the quant+sort runs as two extra launches per MoE
layer.

Measured back to back with --run_config on an idle 8x MI355X node, both arms
confirmed from the dispatch log to run the kernels intended, E2E us:

    token   heuristic    tuned+_fp4    delta
       32      434.67        402.50    -7.4%
       64      578.49        526.76    -8.9%
      128      657.63        596.13    -9.4%
    16384     3661.80       2902.26   -20.7%

Note for anyone repeating this: --mxfp4-flydsl is the WRONG mode here. It tunes
the MXMOE port (flydsl_mxmoe_g1_a4w4_*), whose rows this model cannot use at all
-- the runtime discards them with 'MXMOE cannot apply swiglu_limit=10.0 to
activation silu', GLM-5.3-Flash being clamped SiLU. The plain FmoeTuner tunes
the flydsl_moe1/2_afp4_wfp4_bf16_* family we actually execute, which is also
what upstream's GLM-5 rows (ROCm#5986) select.
Co-Authored-By: Claude Opus 5 <[email protected]>
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.

3 participants