Skip to content

[HIP] [GLM-5.3-Flash] MXFP4 fused-MoE tuned configs for MI355X - #6435

Merged
zufayu merged 4 commits into
ROCm:mainfrom
amd-sriram:rocm/glm53flash-fmoe-tuned
Oct 26, 2026
Merged

zufayu merged 4 commits into
ROCm:mainfrom
amd-sriram:rocm/glm53flash-fmoe-tuned

Conversation

@amd-sriram

@amd-sriram amd-sriram commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

GLM-5.3-Flash MXFP4 on MI355X had no tuned fused-MoE config: every lookup fell back to the FlyDSL heuristic (no tuned FlyDSL config).

  • model_configs/glm53flash_fp4_tuned_fmoe.csv: 149 rows, tokens 1 to 16384.
    • Expert-parallel layouts, default-mode kernels (flydsl_moe1 + flydsl_moe2_layout): experts 73/145/37 with topk 10 (fused shared expert, TP4/TP2/TP8) and 72 with topk 8 (TP4 unfused).
    • No-EP layouts, MXFP4 port kernels (flydsl_mxmoe_g1 + flydsl_moe2_layout): 288/289 experts, inter_dim 1024/512/256 (TP2/TP4/TP8).
  • Adds the six no-EP Flash shapes to MXFP4_MOE_SUPPORTED_SHAPES and gen_instances.py::SHAPES; without them the port rows are discarded (generated MXFP4 auxiliary kernels do not cover ...).

Port rows are not added for the EP layouts: they are refused under expert parallelism (the MXMOE output_aux sort drops expert_mask).

Test Result

Tuned with gemm_moe_tune.py --compare --update_improved --min_improvement_pct 2 on 8x MI355X; every row improved the production fused_moe op by at least 2% over the heuristic. The token=16384 rows were tuned the same way on the current head.

End-to-end, vLLM serving amd/GLM-5.3-Flash-Quark-MXFP4, 8k/1k and 60k/600 at concurrency 4 to 64, GSM8K 5-shot full set:

layout output throughput (geomean) GSM8K
TP4 no-EP, tuned vs untuned +4.5% 0.920 -> 0.918
TP8 no-EP, tuned vs untuned +3.8% 0.912 -> 0.908
TP4 EP (unfused, topk 8), tuned vs untuned +1.4% 0.920 -> 0.923

@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: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 6435 --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.

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.

🟢 Approval recommended

The configuration table is structurally valid and the runtime and generated-kernel shape lists remain synchronized.

0 open findings

What changed in this PR

Adds MI355X tuning coverage for GLM-5.3-Flash MXFP4 fused MoE.

Changes:

  • Adds 153 tuned FlyDSL configurations.
  • Enables six no-EP auxiliary-kernel shapes.
  • Synchronizes runtime and code-generation shape allow-lists.
File Description
gen_instances.py Generates auxiliary kernels for new shapes.
moe_mxfp4_aux.py Enables runtime dispatch for those shapes.
glm53flash_fp4_tuned_fmoe.csv Adds MI355X tuned configurations.

🧠 Review effort: Balanced


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

Copilot AI balanced review requested due to automatic review settings October 12, 2026 14:21

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.

🔵 Needs a closer look

The large hardware-specific tuning table and generated-kernel coverage require final MI355X validation by a human reviewer.

0 open findings

🧠 Review effort: Balanced

@zufayu
zufayu self-requested a review October 13, 2026 01:40
@zufayu zufayu self-assigned this Oct 13, 2026

@damien-lejeune damien-lejeune 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.

I've reviewed the changes and could not find anything to improve, given the scope provided in the description.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 17:39

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.

🔵 Needs a closer look

The MI355X correctness and performance evidence for the new kernel selections needs human verification.

0 open findings

🧠 Review effort: Balanced

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.

🔵 Needs a closer look

Human review should confirm MI355X correctness and performance evidence for the newly selected configurations.

0 open findings

🧠 Review effort: Balanced

damien-lejeune
damien-lejeune previously approved these changes Oct 15, 2026
Copilot AI balanced review requested due to automatic review settings October 15, 2026 09:20

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.

🔵 Needs a closer look

Human review should confirm the reported MI355X correctness and performance evidence for the newly enabled dispatch combinations.

0 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 19, 2026 10:28
They were extended to TP1 from the TP2/4/8 expert-parallel layouts without
a run, and vLLM never requests that shape: at TP1 it does not fuse the
shared expert.
Copilot AI balanced review requested due to automatic review settings October 22, 2026 04:14
@amd-sriram
amd-sriram force-pushed the rocm/glm53flash-fmoe-tuned branch from 08afe85 to 99a3cc0 Compare October 22, 2026 04:14

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.

🔵 Needs a closer look

The reported MI355X results support the changes, but correctness and performance of the newly selected GPU paths were not independently confirmed during review.

No open issues 🎉

Review effort: Balanced

@zufayu

zufayu commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Thanks for the GLM-5.3-Flash tuning. Before I can sign off on the performance change, please attach the complete --compare --update_improved report for the current head (99a3cc0), including the exact command, MI355X/software environment, and per-shape pre/post production fused_moe E2E latency for the 139 new rows.

In particular, please show how many rows were admitted as threshold_met versus no_baseline. --min_improvement_pct 2 does not by itself guarantee a measured >=2% gain for no_baseline rows, and the CI Tuned Op Bench labels these new keys NEW, so its green result is not an old-path-vs-new-path performance comparison. Please also link the raw vLLM throughput and GSM8K runs (commands/config and outputs) behind the PR summary, including the small GSM8K changes (0.920 -> 0.918 and 0.912 -> 0.908). This should let us confirm both the selected path and the absence of a meaningful regression without adding a new op-test script.

One row per layout. Without them, batches above 8192 tokens (16K prefill
chunks) fell back to the heuristic FlyDSL kernels. Tuned on this head with
--compare --update_improved --min_improvement_pct 2; every row beat the
heuristic through fused_moe by 7.6% to 37.3%.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 15:39
@amd-sriram

amd-sriram commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

One gap: the four GLM-5.3-Flash keys have rows for tokens 1–8192, but none at 16384.

@Raiden-Makoto Added token=16384 rows for all 10 layouts in d1c93c7. On your four shapes, ours and yours are within 1% (same GPUs, 4 runs each, swapped), so I kept one tuning run for all of them.

@amd-sriram

Copy link
Copy Markdown
Contributor Author

Before I can sign off on the performance change, please attach the complete --compare --update_improved report for the current head (99a3cc0), including the exact command, MI355X/software environment, and per-shape pre/post production fused_moe E2E latency for the 139 new rows.

@zufayu Raw data is in this gist: https://gist.github.com/amd-sriram/28e8cb47589db3f95fb916c0734a29dc

How the 139 rows were admitted

AITER fbbd9f6a
GPUs 8x MI355X (gfx950, 256 CUs)
Command gemm_moe_tune.py --compare --update_improved --min_improvement_pct 2 --mp 8 --warmup 5 --iters 101
threshold_met 139
no_baseline 0

Every tuner log ends with new: 0. Per-row pre/post fused_moe latency is in tuning_admission_fbbd9f6a.csv.

Re-check on 99a3cc0

The tuning was on an older AITER, so I re-ran all 139 shapes on this head with --run_config: default heuristic vs this table, 2 runs each on separate GPUs. All 139 pass the accuracy check and are faster:

layout experts / topk inter_dim rows min median max
TP2 no-EP 288 / 8 1024 14 10.7% 13.6% 42.8%
TP2 no-EP, fused shared expert 289 / 9 1024 14 7.7% 12.7% 38.4%
TP4 no-EP 288 / 8 512 14 12.2% 18.8% 44.8%
TP4 no-EP, fused shared expert 289 / 9 512 14 10.9% 19.8% 43.4%
TP8 no-EP 288 / 8 256 14 14.7% 24.8% 47.9%
TP8 no-EP, fused shared expert 289 / 9 256 14 12.7% 25.4% 46.4%
TP2 EP, fused 145 / 10 2048 14 4.5% 9.3% 27.3%
TP4 EP, fused 73 / 10 2048 14 1.5% 8.2% 28.5%
TP4 EP 72 / 8 2048 14 2.4% 8.0% 29.4%
TP8 EP, fused 37 / 10 2048 13 5.2% 8.3% 29.4%

Per-shape numbers are in head_99a3cc0_fused_moe_compare.csv.

End to end (vLLM, GLM-5.3-Flash MXFP4)

layout output throughput (geomean) GSM8K untuned GSM8K tuned
TP4 no-EP +4.5% 0.9204 ± 0.0075 0.9181 ± 0.0076
TP8 no-EP +3.8% 0.9121 ± 0.0078 0.9083 ± 0.0080
TP4 EP +1.4% 0.9196 ± 0.0075 0.9234 ± 0.0073

GSM8K is 5-shot on the full set; all three changes are within one standard error. Serve, bench and eval commands, bench JSONs and eval logs are in the gist.

I also added token=16384 rows in d1c93c7, tuned on this head; their compare reports are in the gist too.

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.

🔵 Needs a closer look

Production GPU kernel selection changes require human confirmation of the reported MI355X correctness and performance evidence.

No open issues 🎉

Review effort: Balanced

@zufayu
zufayu merged commit 8965764 into ROCm:main Oct 26, 2026
63 checks passed
ZLkanyo009 added a commit that referenced this pull request Oct 26, 2026
Resolve the MXFP4 MoE aux shape list conflicts in aiter/ops/moe_mxfp4_aux.py
and csrc/kernels/mxfp4_moe/moe_aux/codegen/gen_instances.py by keeping the
union: main's Qwen3.8 TP=8 (513, 8192, 256, 11) from #6468 and the
GLM-5.3-Flash TP=2/4/8 shapes from #6435, plus this PR's Qwen3.8-Flash-Next
TP=1 (513, 2560, 768, 11).

Co-authored-by: Cursor <[email protected]>
amd-sriram added a commit to amd-sriram/vllm that referenced this pull request Oct 26, 2026
… MI355X

AITER has tuned fused-MoE configs for the GLM-5.3-Flash fused
shared-expert shape (289 experts, top-k 9) at the TP2 per-rank
intermediate size 1024: block FP8 in ROCm/aiter#6077 and MXFP4 in
ROCm/aiter#6435. Add TP2 to the gate's TP set, so
VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS applies at TP2 too; TP1
stays refused.

Signed-off-by: Sriram Kumar <[email protected]>
Raiden-Makoto added a commit to Raiden-Makoto/squidward that referenced this pull request Oct 29, 2026
zhiding512 added a commit that referenced this pull request Nov 4, 2026
…hem in test_moe_ep

A caller behind an expert-parallel dispatch passes fused_moe an expert mask,
and the launches it masks compile for the mask's length: the gfx950 masked
stage-2 reduction and route-guarded GEMM2, the gfx1250 g2l route and bf16
gather-reduce. No tuned row records that length, so the AOT build never
compiled them and EP serving JIT-compiled them on the request path.

aiter/aot/flydsl/moe_ep_profiles.csv lists EP callers as what one rank passes
fused_moe: local experts, routing columns, expert-mask length, largest M.
moe.py replays each profile with the mask at both ends of every get_padded_M
bucket up to that M (bisecting between them as for rows), with and without
num_local_tokens, against the tuned tables serving reads, so a profile needs
no tuned row. --ep-profile selects profile tables; without --csv and
--ep-profile both defaults are replayed, and run_aot replays both.

The default table covers gfx950 Kimi-K3 EP8, DeepSeek-V4-Pro EP8 (EPLB r0,
r32, r64) and EP16, GLM-5.3-Flash EP8/EP4/EP2, and gfx1250 Kimi-K3 EP8/EP16
and DeepSeek-V4-Pro EP4, from the EP rows tuned in #5804, #6928, #6435,

op_tests/test_moe_ep.py -t aot_ep_profiles, first in the defaults, runs every
profile of the GPU's arch through the EP fused_moe call in FlyDSL run-only
mode and requires logits_diff < 0.01. The MXFP4 cases now pin quant_dtype_a
instead of setting env switches, accept SiTUv2, and compare against a
stage-wise reference that quantizes a4w4 activations as the kernels do.

Co-authored-by: Cursor <[email protected]>
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.

6 participants