Skip to content

[FlyDSL] fix(flydsl): support kmk3 ep moe & opt for ep moe gemm2 - #5804

Merged
coderfeli merged 1 commit into
mainfrom
opt/support_and_opt_for_ep_kk3
Oct 12, 2026
Merged

coderfeli merged 1 commit into
mainfrom
opt/support_and_opt_for_ep_kk3

Conversation

@Bernard-Liu

Copy link
Copy Markdown
Contributor
  • fix(flydsl): bound EP GEMM2 atomics by valid tokens
  • test(flydsl): clarify EP benchmark throughput metrics
  • add kmk3 ep config

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

@Bernard-Liu
Bernard-Liu requested review from a team and a lite review from Copilot September 24, 2026 02:34
@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; main branch always runs both MI35X and MI300X
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 5804 --add-label <label>

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 opt this PR out.

@github-actions github-actions Bot changed the title fix(flydsl): bound EP GEMM2 atomics by valid tokens [FlyDSL] fix(flydsl): bound EP GEMM2 atomics by valid tokens Sep 24, 2026

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

🟡 Changes recommended

Add regression coverage for dynamic-token EP GEMM2 atomic writes.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Fixes FlyDSL EP GEMM2 atomic writes by bounding them to valid tokens, with dispatch/AOT propagation and Kimi K3 configurations.

Changes:

  • Adds runtime valid-token write limits.
  • Propagates and caches kernel variants through dispatch and AOT paths.
  • Adds Kimi K3 tuning configurations.
File Summary
aiter/​ops/​flydsl/​kernels/​mxmoe_gemm_v2.py Bounds atomic stores by valid tokens.
aiter/​ops/​flydsl/​kernels/​mxmoe_dispatcher.py Adds runtime dispatch and kernel variants.
aiter/​fused_moe.py Propagates valid-token metadata through EP stage 2.
aiter/​configs/​model_configs/​kimik3_a8w4_tuned_fmoe.csv Adds Kimi K3 EP configurations.
aiter/​aot/​flydsl/​mxfp4_moe.py Precompiles token-bound variants.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread aiter/fused_moe.py Resolved
@Bernard-Liu Bernard-Liu changed the title [FlyDSL] fix(flydsl): bound EP GEMM2 atomics by valid tokens [FlyDSL] fix(flydsl): support kmk3 ep moe & opt for ep moe gemm2 Sep 24, 2026
@zufayu
zufayu requested a review from coderfeli September 26, 2026 00:20
- fix(flydsl): bound EP GEMM2 atomics by valid tokens
- test(flydsl): clarify EP benchmark throughput metrics
- add kmk3 ep config
@Bernard-Liu
Bernard-Liu force-pushed the opt/support_and_opt_for_ep_kk3 branch from c710d91 to bff0e9c Compare October 8, 2026 05:19
Copilot AI lite review requested due to automatic review settings October 8, 2026 05:19

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

Add a regression test covering padded inputs and valid-token-bounded atomic GEMM2 writes.

1 open finding

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@coderfeli coderfeli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coderfeli
coderfeli merged commit 6bf550b into main Oct 12, 2026
@coderfeli
coderfeli deleted the opt/support_and_opt_for_ep_kk3 branch October 12, 2026 08:04
Qubitium added a commit to Qubitium/aiter that referenced this pull request Oct 12, 2026
Single conflict in aiter/aot/flydsl/mxfp4_moe.py: this branch's
include_bias_variants gate and main's use_valid_token_count variants
(ROCm#5804) both rewrote the same stage-2 option list in parse_csv().

Resolution keeps both behaviours: include_bias_variants still selects
enable_bias_options, and count_options still adds the atomic-epilog
use_valid_token_count variants inside that loop, so the parser emits the
union of both job sets and the tuner path keeps its no-bias fast scan.
zhiding512 added a commit that referenced this pull request Oct 13, 2026
mxfp4_moe.py stays deleted. #5804 taught it the use_valid_token_count
GEMM2 variant, which the runtime selects when the caller passes
num_local_tokens; the next commit has the replay enumerate that caller
choice instead.

Signed-off-by: zhimding <zhimding@amd.com>
zhiding512 added a commit that referenced this pull request Oct 13, 2026
Callers behind an EP dispatch pass the received token count as
num_local_tokens. Since #5804 the runtime then bounds the layout-v2
GEMM2 atomics by it, a compile-time choice the old mxfp4_moe.py had to
be taught by hand; on inline-sort rows the runtime instead drops the
tuned config for heuristic FlyDSL kernels that no AOT compiled.

Each row is now replayed with num_local_tokens too. Of the old script's
use_valid_token_count kernels, the replay has every one the runtime
reaches; the 227 it lacks come from bias variants of Silu/SiTUv2 rows
(the runtime enables bias for Swiglu only since #6376), from inline-sort
rows the runtime abandons under num_local_tokens, and from a token=3
row that get_padded_M never selects.

Signed-off-by: zhimding <zhimding@amd.com>
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 <cursoragent@cursor.com>
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.

3 participants