perf(musa): support folded E=257 Qwen3.5 BF16 MoE prefill and skip dead warmup #378
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.55) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.55 · 590 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.382
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #378"
general
weight: 0.35
yeahdongcn
Summary
Implements P0-C from the S5000
v0.32.0-devoptimization roadmap (MUSA-100113):1. Match folded
E=257, top_k=9TP=4Qwen3.5/3.6-35B-A3BBF16 prefill shapes inmatches_qwen35_moe_bf16_prefill_layer(vllm_musa/optimization_contract/qwen.py):-
OptimizationFeature.QWEN35_SHARED_EXPERT_FOLDis enabled by default onQwen3.5/3.6MoE models, folding the shared expert intow13_weight/w2_weight(E=256 -> 257, runtimetopk_ids.shape[1]=9,global_num_experts=257).- While
matches_qwen35_moe_bf16_decode_gemv_layeralready accepted both folded(257, 9)and unfolded(256, 8)TP=4 shapes,matches_qwen35_moe_bf16_prefill_layerstill hardcoded(256, 8). Consequently,prefer_upstream_qwen_prefillwasFalsein production on default foldedQwen3.5-35B-A3B/Qwen3.6-35B-A3BTP=4 BF16, sending>= 1024-token prefill batches into_maybe_moe_deepgemm_bf16_prefillinstead of the faster calibrated Triton MoE path.2. Fix
_warmup_bf16_grouped_moefor folded MoE layers & skip dead DeepGEMM precompilation (vllm_musa/model_executor/warmup/deep_gemm_warmup.py):- When
_fold_shared_expert_weightsfolds the shared expert (_musa_shared_folded=True),module.top_k(8) andmodule.global_num_experts(256) onFusedMoEstill hold the routed-only counts untilforward_ootextends them to(9, 257). Added_effective_moe_routing_countsso folded layers resolve(9, 257)(max_grouped_tokens=106368instead of the wrong98176on TP=1/TP=2!).- Added
_module_prefers_upstream_qwen_bf16_prefill(handlingMoEActivation.SILUenums) so TP=4(256|257, 256, 2048)layers that route to upstream Triton skip10.05 sof deaddeep_gemm.m_grouped_bf16_gemm_nt_contiguousstartup compilation.Validation Evidence
Environment
origin/v0.32.0-dev(ae29e343865b6a9f0cd8dc9e4cb45904bd1553ec)bd91be25d24937573eda2974e1ca3ed024545738sh-harbor.mthreads.com/mcctest/vllm:v0.32.0-ph1-5.2.0-torch2.13.0.post1-20261126@sha256:57c32bbbdbd9d539b2b8e8b46f0b132252d36e4646e2d8a452dde0fa84e471af10.20.37.14(worker37014),4 × MTT S5000(80 GiB,mp_count=64, driver5.2.0-server, shared-host leaseMUSA_VISIBLE_DEVICES=0,4,5,6)3.12,torch=2.13.0.post1+musa5.2.0,torch_musa=2.13.0.post1+musa5.2.0,torchada=0.1.111,mate=0.2.8.post1,flash_attn_3=0.2.8.post1+musa1. Unit & Source Gates
pytest(test_qwen_moe_bf16_prefill_policy.py,test_moe_bf16_deepgemm_source.py,test_qwen_contract_source.py,test_qwen_optimization_contract.py,test_paged_mqa_logits_metadata_warmup.py,test_rope_store_hint_prewarm.py):105 passed.2. Cold-Cache Operator & Warmup Microbenchmark (
MTT S5000,mp=64, 8.0 GB L2 Flush)E=257):10.050 s -> 0.0042 s(-10.05 s).top_k=9warmup bucket fix (E=257, N=512): FirstT=2048prefill latency18.29 ms(Baselinetop_k=8miss) ->1.31 ms(Candidatetop_k=9hit,14.0xfaster).E=257, top_k=9(N=256, K=2048) Cold-Cache MoE Prefill Latency:| Prefill Tokens (
T) | Baseline DeepGEMM (ms) | Candidate Upstream Triton (ms) | Speedup | Parity ||---:|---:|---:|---:|---|
|
1024|1.029|0.712|1.45x|PASS||
1536|1.078|0.706|1.53x|PASS||
2048|1.201|0.831|1.45x|PASS||
4096|1.561|1.141|1.37x|PASS||
8192|2.232|1.768|1.26x|PASS|3. End-to-End Compiled
FULL_AND_PIECEWISEServing (Qwen3.5-35B-A3B-BF16, TP=4,--max-num-batched-tokens 8192)344.79 s(Baseline) ->334.68 s(Candidate,-10.11 s;Warming MUSA BF16 grouped MoE GEMMeliminated andUsing the upstream fused MoE path for large BF16 Qwen3.5/3.6-35B-A3B prefill batchesactive).-
2048-in / 64-out(c=1): Mean TTFT89.73 -> 87.93 ms(-2.0%), Median TTFT89.55 -> 86.80 ms(-3.1%).-
2048-in / 64-out(c=8,n=24): Mean TTFT274.43 -> 260.15 ms(-5.2%), Total throughput15470.7 -> 15725.2 tok/s(+1.65%).-
4096-in / 64-out(c=4,n=16): Mean TTFT865.10 -> 854.77 ms, Total throughput4563.8 -> 4613.8 tok/s(+1.10%).4. Mandatory 3-Family Regression Matrix
PASS qwen3_8b_dense_tp2(tp=2,contains_beijing=True)PASS qwen35_35b_a3b_moe_bf16_tp4(tp=4,contains_beijing=True)PASS deepseek_coder_v2_lite_mla_tp4(tp=4,contains_beijing=True)