← Back to Pull requests

perf: calibrate the unsharded Qwen3-30B-A3B FP8 MoE GEMV on MP56 and MP60 #334

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 09, 2026 09:17 UTC
Author

Why

Served without tensor or expert sharding, Qwen3-30B-A3B-FP8 runs its MoE layers at the per-rank shape E=128, N=1536, K=2048, top-k 8 with 128×128 FP8 blocks. The dispatch policy has no entry for that shape, so decode batches take the upstream Triton kernel. On S5000 that kernel costs about 200 µs per layer at M=1, while the native FP8 block GEMV costs 74 µs. This holds on both the 56-MP and the 60-MP parts.

What

  • An entry for that shape on MP56 and MP60, in eager and capture modes:

  • - M <= 3 takes the GEMV.
    - Larger batches keep the upstream path.
    - Grouped GEMM stays off.
  • A test covering:

  • - the boundary on both MP counts and the grouped-GEMM setting;
    - isolation from the MP48, expert-parallel, TP-sharded and EP-sharded variants of the shape.

    The second commit extends the MP56 entry to MP60, so it can be dropped on its own.

    M is hidden_states.shape[0] for one MoE call.

    pytest tests/test_fused_moe_dispatch_policy.py: 24 passed.

    Evidence

    Setup: One MTT S5000 GPU per MP count, each on a node whose other GPUs were in use, so the serving numbers are indicative.

  • MP56: an mpx28 node with driver 5.2.0-server.

  • MP60: an mpx30 node with driver 5.2.0-server.

  • Image v0.32.0-ph1-5.2.0-torch2.11.0.post2-20261106 (sha256:65d5e96b5027c796494a7ad6597c6267953d60b96e2436c344760b243c346bc1).

  • Packages: vLLM 0.32.0, vllm-musa 0.1.32, torch and torch_musa 2.11.0.post2+musa5.2.0, torchada 0.1.105, MATE 0.2.8.post1.

  • On both nodes the image's dispatch_policy.py and fused_moe.py are byte-identical to v0.32.0-dev@d6ad785b. Each arm below changes only dispatch_policy.py.

  • The policies tested on each node produce the same threshold table as this branch.
  • Crossover

    benchmarks/fused_moe/benchmark_dispatch_crossover.py --name qwen3-30b-a3b-tp1 --experts 128 --hidden-size 2048 --intermediate-size 768 --top-k 8 --tokens 1,2,...,16,24,32,64 --sweep-kind dense --backends gemv,upstream --rounds 4 was run once per route mode with seeds 20261108, 20262108 and 20263108, on each MP count. All eighteen runs pass the correctness and FP32-oracle gates.

    | MP | Route | GEMV boundary per seed | M=1, GEMV / upstream | M=4, GEMV / upstream |
    |---|---|---|---|---|
    | 56 | balanced | 3, 13, 13 | 74 / 198 µs | 180 / 229 µs |
    | 56 | unique_random | 6, 6, 6 | 76 / 198 µs | 187 / 235 µs |
    | 56 | hot | 3, 3, 3 | 74 / 199 µs | 135 / 100 µs |
    | 60 | balanced | 9, 14, 14 | 74 / 201 µs | 180 / 236 µs |
    | 60 | unique_random | 6, 3, 6 | 77 / 201 µs | 183 / 238 µs |
    | 60 | hot | 3, 3, 3 | 73 / 202 µs | 134 / 101 µs |

    Times are medians over the three seeds. Each entry takes the worst boundary for its MP count, which is 3 on both:

  • Hot routes set the boundary. When tokens share experts, the Triton kernel reads each expert once per batch, while the GEMV reads it once per token.

  • Two other runs stop at 3 for a different reason. These are MP56 balanced seed 20261108 and MP60 unique_random seed 20262108. Their upstream timings at M = 4 exceed the 0.1 IQR/median gate. The GEMV is not slower there.
  • Grouped GEMM is left out of the sweep:

  • With it included, the harness marks every run unqualified. Its output differs from upstream by a relative L2 of about 0.013, outside its 0.01 envelope, although both are about 0.044 from the FP32 oracle.

  • In a three-backend balanced sweep on MP56, it was slower than the GEMV at M <= 11 and slower than upstream at M = 12–64.
  • CUDAGraph replay

    benchmarks/fused_moe/benchmark_dispatch_graph.py --experts 128 --hidden-size 2048 --intermediate-size 768 --top-k 8 --tokens M --replays 8 --requested auto was run with the entry installed, on each MP count:

  • M = 1, 2, 3 capture the GEMV.

  • M = 4 captures upstream.

  • All eight graphs replay 8/8 bitwise-equal to eager, across the three route modes.
  • Serving A/B/A (MP56)

    vllm serve Qwen3-30B-A3B-FP8 --max-model-len 4096 --max-num-batched-tokens 4096 --max-num-seqs 64 \
      --gpu-memory-utilization 0.85 --no-enable-prefix-caching \
      --compilation-config '{"mode":"NONE","cudagraph_mode":"FULL_DECODE_ONLY"}'
    

    The client is vllm bench serve with random 1024→512 prompts and --ignore-eos. A warm pass runs first. The measured pass sends 4×c prompts, with a minimum of 16. Each cell is output tok/s, then mean TPOT.

    | c | base | entry | base | TPOT change |
    |---|---|---|---|---|
    | 1 | 64.7, 15.27 ms | 107.5, 9.11 ms | 65.1, 15.19 ms | −40.2% |
    | 2 | 121.4, 16.08 ms | 166.7, 11.60 ms | 120.1, 16.26 ms | −28.3% |
    | 4 | 241.3, 16.11 ms | 242.3, 16.04 ms | 240.5, 16.16 ms | −0.6% |
    | 8 | 414.5, 18.54 ms | 411.8, 18.68 ms | 415.7, 18.51 ms | +0.9% |

  • Path selection: At c ≥ 4 the decode batch is above the boundary, so both arms take the same upstream path.

  • Logs: The entry arm logs selected backend=gemv policy=s5000-mp56-20261108-e128-n1536-k2048-capture-dense-v6 and its eager counterpart. The base arms log no dispatcher selection.

  • Accuracy: GSM8K over all 1319 questions scores 0.9325 with the entry. Earlier TP1 runs on the same image that did not select the GEMV scored 0.9310 and 0.9386.
  • Not covered

  • MP60 serving A/B/A: not run. The only free MP60 node had no model store mounted. The MP60 kernel timings and boundary match MP56, so the same end-to-end effect is expected, but it is not measured.

  • Isolated-node A/B/A: not run yet.

  • Other shapes of this model: the expert-parallel and tensor-parallel shapes are not calibrated.
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: yeahdongcn Review duration: 140m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Real PR Conversation Timeline
    1 comments
    "Review active on #334"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.7% · Safe to merge
    27.7%