MXMoE kernels for Qwen3.5-397B TP2 decode - #4513
Merged
Merged
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
yichiche
marked this pull request as ready for review
August 3, 2026 02:55
zufayu
self-requested a review
August 4, 2026 01:27
lalala-sh
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inter_dim=512) MXFP4 fused-MoE decode buckets on MI355X (gfx950).expert=512, topk=10M16/M32/M64/M128 rows.expert=513, topk=11shared-expert-fused rows are unchanged.Motivation
Qwen3.5-397B TP2 MXFP4 shapes were originally added by #3859. The current small-token rows were subsequently tuned to the gfx950 flat ASM and generic two-stage kernels introduced by #4001.
The generalized FlyDSL MXFP4 MoE path merged by #3832 now provides a coupled pipeline with:
Retuning the Qwen3.5 TP2 production shape (
NE=512, H=4096, D_INTER=512, TOPK=10) shows that this path wins from M16 through M128, while the existing flat kernels remain faster at M4/M8.Technical details
The selected rows use:
flydsl_mxmoe_g1_a4w4_16x256x256_f16in_ntflydsl_mxmoe_g2_a4w4_16x256x256_atomicflydsl_mxmoe_g1_a4w4_16x256x256_f16in_ntflydsl_mxmoe_g2_a4w4_16x256x256_atomic_ntNo aux codegen shape is added. The existing
(NE=512, H=4096, TOPK=10, MB)dispatch instances already cover TP2 because the aux dispatch key does not includeD_INTER.Quantization metadata is unchanged: BF16 output, MXFP4 weights/activations (
torch.float4_e2m1fn_x2),QuantType.per_1x32,ActivationType.Silu, and GU-interleaved weights.AITER_MXFP4_INTERMEDIATE=0is used, so G2 accumulates directly into BF16 output rather than using the optional lossy FP4 final staging path.Performance
Operator latency
The table below reports the GPU device time of one complete
fused_moe(...)operator call. The timed call includes token sorting and output-buffer initialization, input activation quantization, G1, any separate inter-stage quantization, and G2. Three independent runs, reported as the median.(The CSV
usfield is not directly comparable between the existing rows and the coupled MXMoE rows. Existing rows come from the ordinary stage tuner and record the stage-based/additive result asus = us1 + us2. The coupled MXMoE tuner times its full_port_e2esequence as one unit and stores that entire value inus1, withus2=0. Consequently, the M64/M128 MXMoE CSVusvalues can be higher even though the uniform full-operator replay below is faster.)Profiler-free SGLang serving
Environment: Qwen3.5-397B-A17B-MXFP4, TP2/EP1, MI355X, SGLang
84cdfde5b2cc383ea7008fe9fca519d4b1277329, AITER702aacd62c8a6e2fbbc260da338c510ab76f1b1c, and FlyDSL 0.2.4.Workload: random ISL 8192 / OSL 1024, range ratio 0.8, ignore EOS, request rate
inf,num_prompts=10*C, three repeats per variant/concurrency. No profiler was enabled. The table reports the median total-token throughput.All 36/36 serving result files completed the requested workload, and every result reported
completed=10*C.GSM8K accuracy
The full 1319-question GSM8K test split was evaluated with SGLang's built-in evaluator:
Tuning
The coupled MXMoE search used the in-tree tuner:
Final production replay used
--warmup 10 --iters 50 --errRatio 0.05 --verbose, with three independent processes for each config. The four rows in this PR are selected from those production medians rather than a single fastest sample.Validation
git diff --checkerrRatio=0.05)p=0.936)The full-trace steady-window kernel attribution is intentionally not used for the serving performance claim above. Serving numbers come only from the separate profiler-free A/B.
Notes
gfx950).expert=513, topk=11rows remain unchanged.Submission checklist