MUSA: serve DP+EP MoE on MCCL and add the MATE Mega MoE backend #325
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.57) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.388
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #325"
general
weight: 0.35
yeahdongcn
Why
Two gaps keep block-FP8 MoE models from serving with data-parallel attention and expert parallelism on MUSA.
DP+EP does not start.
--data-parallel-size 8 --enable-expert-parallelwith the defaultallgather_reducescatterall2all fails in three places, each hidden behind the previous one:1. pynccl is disabled.
find_nccl_library()raises on MUSA becausetorch.version.cudaandtorch.version.hipare bothNone. EveryPyNcclCommunicatortherefore disables itself, and the profile run asserts inCudaCommunicator.all_gatherv.2. The collectives escape the decode graph. MUSA captures on torch_musa's own capture stream. vLLM's
current_stream()never sees that switch, because torch_musa callstorch_musa.set_streamrather than the patchedtorch.cuda.set_stream. pynccl therefore issues the all2all outside the graph, and startup hangs.3. MCCL 2.30.4 hangs on a group of small collectives. There are two such groups:
- The dispatch all-gathers four tensors in one group.
- Uneven
all_gatherv/reduce_scattervgroup one broadcast or reduce per rank.Mega MoE cannot be selected. MATE 0.2.8 ships Mega MoE (
mate.mega_moe). It runs the dispatch, both FP8 expert GEMMs with SwiGLU, and the weighted combine in persistent kernels over an intranode symmetric buffer, but vllm-musa has no backend that uses it.What
0213adds--moe-backend mate_mega_moefor block-FP8 MoE layers:- It is bound to the passthrough all2all, the same self-dispatching contract as the FlashInfer MoE-EP backends.
- It maps to
Fp8MoeBackend.MATE_MEGA_MOEand keeps the loaded weight layout.- The experts repack the weights once the modular kernel is built.
vllm_musa/model_executor/layers/fused_moe/mate_mega_moe.py(MateMegaMoEExperts):- Quantizes the activations straight into the symmetric buffer and repacks the weights with
transform_weights_for_mega_moe.- Shares one buffer per shape across all MoE layers.
- Takes MATE's decode or prefill kernels from the largest token count across data-parallel ranks, since both are collectives.
-
is_supported_confignames what the kernels do not cover, so an unsupported shape is rejected at backend selection rather than aborting inside the symmetric-buffer setup. The limits are: more than 8 ranks, a hidden or intermediate size that is not a multiple of 256, intermediate above 8192, top-k above 32, a non-SwiGLU activation, bias, LoRA, EPLB, DBO, and redundant experts.0214returnslibmccl.so.2fromfind_nccl_library()on MUSA. torchada resolves thencclXxxlookups to MCCL'smcclXxxexports, which cover all 20 symbols pynccl loads.0215wrapstorch_musa.set_streamon the firstcurrent_stream()call on MUSA, socurrent_stream()follows every stream switch.0216keeps the all2all collectives out of MCCL groups on MUSA:- A batched
all_gathervpacks the rows of its tensors (hidden states, top-k weights, top-k ids, block scales) into one byte matrix and gathers it with one all-gather. The dispatch costs one collective per MoE layer instead of four.- Uneven
all_gatherv/reduce_scattervrun as oneall_gather/reduce_scatterover rows padded to the largest size.- Mega MoE: limits (including 1408), DP-consistent path choice, an idle rank, guards and supported schemes.
- pynccl: MCCL library choice and symbol coverage, stream tracking, padded row offsets, and the packed gather round trip (fp8, fp32 and int32 tensors, uneven and empty ranks).
- A source contract for each series entry.
0213joinsmoe,0214and0216joindistributed, and0215joinscompilation.Evidence
Setup:
v0.32.0-ph1-5.2.0-torch2.11.0.post2-20261106(sha256:65d5e96b5027c796494a7ad6597c6267953d60b96e2436c344760b243c346bc1), MCCL 2.30.4, MATE 0.2.8.post1.All servers use
--max-model-len 4096 --max-num-batched-tokens 4096 --gpu-memory-utilization 0.85 --no-enable-prefix-caching --compilation-config '{"mode":"NONE","cudagraph_mode":"FULL_DECODE_ONLY"}'. On top of that:--tensor-parallel-size 8 --enable-expert-parallel --max-num-seqs 128.--data-parallel-size 8 --enable-expert-parallel --max-num-seqs 64.--moe-backend mate_mega_moe.The load is
vllm bench serveon random 1024 in / 512 out with--ignore-eosand 4×c prompts, measured after a warm-up pass that sends the same requests, so first-use Triton compiles stay out of the measured pass. Output tok/s, mean TPOT in ms:| c | TP8+EP8 | DP8+EP8 | Mega MoE |
|---|---|---|---|
| 1 | 71.8 (13.70) | 57.0 (17.15) | 83.9 (11.67) |
| 8 | 523.2 (14.66) | 376.9 (20.55) | 554.0 (14.00) |
| 64 | 2606.1 (23.25) | 2314.3 (25.59) | 3387.2 (17.74) |
| 128 | 4076.9 (29.41) | 4198.8 (27.13) | 5891.0 (19.86) |
all_gathervduring the profile run.all_gathervorreduce_scatterv; in an earlier lease on the same image it stayed within 1% of the unmodified tree.Other models, with the series (warm-up pass of c requests):
| Model | Config | Output tok/s at c=1 / 8 / 64 | GSM8K |
|---|---|---|---|
| DeepSeek-V2-Lite-Chat (BF16, MLA) | TP8+EP8 | 75.0 / 457.8 / 2317.3 | 0.6694 |
| DeepSeek-V2-Lite-Chat (BF16, MLA) | DP8+EP8 | 61.7 / 391.5 / 2279.7 | 0.6573 |
| Qwen3-Next-80B-A3B-Instruct (BF16) | TP8+EP8 | 41.9 / 282.6 / 1499.6 | 0.9507 |
| Qwen3-Next-80B-A3B-Instruct (BF16) | DP8+EP8 | 32.8 / 124.9 / 925.9 | 0.9447 |
Qwen3-Next DP8+EP8 at c=8 and c=64 still includes first-use compiles (TTFT p99 47.5 s at c=64).
Qwen3.8-Flash-Next-FP8 with
--moe-backend mate_mega_moestops at startup withMATE_MEGA_MOE does not support the deployment configuration since kernel does not support intermediate size 640 not divisible by 256. The model does not start on MUSA in any configuration (Qwen4Exp QSA requires FlashAttention).Isolated checks, on 8 ranks:
all_reduce+all_gatherv+reduce_scattervgraph replayed with fresh inputs.all_gatherv, a Triton kernel andreduce_scattervthe way vLLM does on MUSA. Without0215the replay returns wrong results; with it the results are correct.libmccl.so.2(no vLLM or PyTorch) hangs on 2, 4 and 8 ranks when onemcclGroupStart/mcclGroupEndholds an all-gather of at least 2 KB per rank and one of at most 1 KB per rank. It completes when every op is on the same side of that boundary or when the ops are issued without a group. NoMCCL_PROTO,MCCL_ALGO, channel-count,MCCL_SYM_KERNELorMCCL_RUNTIME_CONNECTsetting avoids the hang.0216it hangs; with it, it passes.Validation:
check-series --replayagainst a pristine checkout at5df63a72: 216 clean.verify: 219 clean, 0 need attention.pre-commit run --fileson the change set.test_cli_never_tracebacks_on_a_broken_entry_file[chmod-000-unreadable], which fails the same way on the unmodified image when run as root.Not covered:
send/recvthrough pynccl are checked only in the collectives test.deepep_low_latencystops at startup withBuffer.__init__() got an unexpected keyword argument 'enable_shrink'(deep_ep 1.1.0+musa).deepep_high_throughputserves only without decode graphs. There it matches the default all2all, at a TPOT of 149 ms at c=8 for both, against 20.6 ms for DP8+EP8 with graphs.