Repository navigation
feat(ops): Qwen3.5 MXFP4 MoE at TP4 and at larger TP2 verify sizes, and its bf16 lm_head at TP4 and TP2 - #223
Merged
Merged
Conversation
ChengYao-amd
temporarily deployed
to
gpu-trusted
November 16, 2026 09:34 — with
GitHub Actions
Inactive
Collaborator
Author
|
CI run 43840808340: |
ChengYao-amd
marked this pull request as ready for review
November 17, 2026 08:08
ChengYao-amd
requested review from
RuibinCheung,
irvineoy,
jiejingzhangamd,
kyle-256,
xiaobochen-amd and
zhenhuang12
as code owners
November 17, 2026 08:08
…ore inter-512 token counts Two schemas of [email protected] at model dim 4096, 513 experts (512 routed plus the fused shared expert), top-11, the Qwen3.5-397B MXFP4 MoE: - inter 256 (TP4): n_tokens 48 to 128 in steps of 8, the EAGLE verify sizes above the 40 tokens where sglang's own W4A16 path stops. Same two-launch kernel as the inter-512 schema with the inter dim halved. 1.25-1.33x over aiter. - inter 512 (TP2): a second schema next to 657d1f53 for n_tokens 88 and 176 to 320, the verify sizes of graph batch sizes 22 and 44 to 80. Same kernel as 657d1f53 with these token counts. 1.05-1.07x over aiter. 104, 112 and 120 stay on aiter (1.04-1.05x). Accuracy matches aiter's (SQNR to the reference within 0.1 dB, zero violations). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…at K 4096 gemm_n62080_k4096 and gemm_n124160_k4096, the lm_head of a 248320-token vocabulary under TP4 and TP2 (Qwen3.5-397B), on the weight-streaming body of gemm_n25256_k8192 (gemm_stream.h, unchanged) with tiles picked per m bucket. Workloads are the EAGLE draft and verify sizes where the kernel is clearly ahead: m 1-16 (1.61-1.73x over aiter), 52-64 (1.18-1.72x), 88-96 (1.10-1.18x) and 104-128 (1.53-1.70x). Between them, at m 18-48 and 72-80, aiter's GEMM already streams the weight at a similar rate (0.99-1.06x), so those sizes stay on it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
zhenhuang12
force-pushed
the
dev/qwen35-mxfp4-schema-gaps
branch
from
November 18, 2026 02:00
732322d to
bb47b81
Compare
zhenhuang12
temporarily deployed
to
gpu-trusted
November 18, 2026 02:02 — with
GitHub Actions
Inactive
This branch was previously deployed
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.
Why
Qwen3.5-397B-A17B MXFP4 (AttnFP8-V2) still falls back with
no_workloadin three places after #209:fused_moea4w4 call with 513 experts (the fused shared expert is expert 512), top-11 and inter 256 per rank. sglang's own W4A16 path takes 40 tokens and fewer; above that,[email protected]takes the call but has no schema for inter 256. With EAGLE (3 steps, top-k 1, 4 draft tokens) the verify step runs the MoE on 4·bs tokens, so at concurrency 12–16 the verify graphs of bs 12–32 (48–128 tokens) all go to aiter.LogitsProcessor._compute_lm_headalready routes the bf16 head into[email protected], but nothing has its shape: 62080 × 4096 at TP4, 124160 × 4096 at TP2 (vocabulary 248320). It runs once per verify (m = 4·bs) and once per draft step (m = bs), and is 2–4% of the wall clock in an AgentX run.Scope
fused_moe_shuffled_16x16_model_dim4096_n_experts513_topk11_inter_dim256(new):64140271, 48–128 tokens in steps of 8. Same two-launch kernel as feat(flydsl): fused MoE kernel for model dim 4096, 513 experts, top-11, inter 512 #209 (in-LDS routing sort, MXFP4 quantization of the gathered rows and gate/up GEMM in stage 1; down GEMM with bf16 atomics in stage 2), with the inter dim halved.fused_moe_shuffled_16x16_model_dim4096_n_experts513_topk11_inter_dim512: a second schema8e3f0f83next to657d1f53, for 88 and 176–320 tokens (176–256 in steps of 16, 288, 320). Same kernel as657d1f53; only its token-count list differs.gemm_n62080_k4096(f72cfb48) andgemm_n124160_k4096(8960372a) (new): the weight-streaming body ofgemm_n25256_k8192(gemm_stream.h, unchanged), with its tile picked per m bucket for these shapes. m 1–8, 10–16, 88, 96, 104–128 for both; 56, 64 for n 62080 and 52–64 for n 124160.Tradeoffs
gemm_a16w16(hipBLASLt) already streams the weight at 6.0–6.5 TB/s and this kernel measured 0.99–1.06x, so those sizes are not listed. The kernel reaches 6.7–7.1 TB/s at m ≤ 16. Above m 128 it is slower than hipBLASLt, so nothing larger is listed.mfma_moe1_silu_mul_afp4_wfp4_bf16_t32x128x256+mfma_moe2_afp4_wfp4_bf16_cshuffle), whose MXFP4 rounding matches the reference's: 47 dB to the reference against this kernel's 29 dB. Against a reference with unrounded activations both are equally accurate (13.2–13.4 dB each, at 48 and 128 tokens, with uniform and shared-expert routing). At inter 512, this kernel and aiter's chain are 45 dB apart, as in feat(flydsl): fused MoE kernel for model dim 4096, 513 experts, top-11, inter 512 #209.Verification
CI: run 43840808340:
code-lintpassed;unittest-aklrfailed only ontest_reference[[email protected]], which also fails on main (run 43832645862), sovalidationwas skipped. The tables and log below are a local run of the same validation.Environment: MI355X,
lmsysorg/sglang:v0.5.22-rocm10-mi35x, ROCm 7.15, torch 2.11.0+rocm10.0.0, Triton 3.8.0, FlyDSL 0.3.2, AITER asci.yaml'sAKLR_BASELINE_AITER.Gate overrides: none
Kernels
[email protected]aklr.ops.fused_moe.baseline.fused_moe_baseline(aiterfused_moe, a4w4 per_1x32)[email protected]aklr.ops.gemm.baseline.gemm_baseline(aitergemm_a16w16)fused_moeinter 256 (64140271)fused_moeinter 512 (8e3f0f83)gemm_n62080_k4096(f72cfb48)gemm_n124160_k4096(8960372a)Against the image's own aiter (
0.1.23.dev183+ge7d2453f2, FlyDSL 0.3.4.1), the same kernels measured: inter 256, 1.25x–1.33x; inter 512 at 88 and 176–256 tokens, 1.05x–1.08x (288 and 320 not run there); lm_head, 1.10x–1.73x (lower bounds). Every listed point was ≥ 1.05x in each of the 3–4 runs made (both aiters). Outside validation: at inter 512 the output's SQNR to the reference equals aiter's at 88–320 tokens with every token routed to expert 512 (as the fused shared expert is) and with all routes on 24 hot experts; at inter 256 its SQNR to the unrounded-activation reference equals aiter's at 48 and 128 tokens, with uniform and expert-512 routing.Validation log
Code
python -m aklr export check,python -m aklr validate --base origin/main --stages audit,pytest tests/ops/test_contracts.py: passed.pytest tests: 1166 passed, 1 failed:test_reference.py::...[[email protected]](delta_stateviolation fraction 6.1e-05), which fails the same way onorigin/main(51acbd5) here and does not touch these ops.tests/ops/names.txtalready lists both name patterns.Serving check (not end to end): Qwen3.5-397B-A17B-MXFP4-AttnFP8-V2 on MI355X, EAGLE 3/1/4 with the InferenceX agentic recipe's server arguments for TP2 + HiCache concurrency 32 (
--max-running-requests 64 --cuda-graph-max-bs-decode 64), TP4 concurrency 8 (--max-running-requests 16 --cuda-graph-max-bs-decode 16) and TP4 concurrency 16 (--max-running-requests 32 --cuda-graph-max-bs-decode 32, driven at 32 parallel requests so verify reaches 128 tokens), the image's aiter, acceptance not simulated,AKLR_MIN_SPEEDUP=0(these files have no CI speedup yet),AKLR_EXPORT=1.fused_moeinter 512 at 4–96, 128 and 160 (feat(flydsl): fused MoE kernel for model dim 4096, 513 experts, top-11, inter 512 #209) plus 88 and 176–256, and lm_head n 124160 at all 22 listed m; TP4 c8,fused_moeinter 256 at 48–64 and lm_head n 62080 at m 1–16, 56, 64; TP4 c16,fused_moeinter 256 at all of 48–128 and lm_head at all 20 listed m.Not run
Risk
Affects: Qwen3.5-397B MXFP4 (V2) at TP4 and TP2: the MoE at the listed verify token counts, and the lm_head at the listed m (target verify and EAGLE draft steps).
If wrong: wrong MoE or logits output, or slower steps at those counts.
Undo:
[email protected]/[email protected], orgit revert.🤖 Generated with Claude Code