← Back to Pull requests

perf(s5000): consolidate v0.32.0-dev S5000 performance rollup (#376-#387) #391

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

Summary

Consolidates the 12 S5000 performance PRs (#376, #377, #378, #379, #380, #381, #382, #383, #384, #385, #386, #387) into one conflict-free, end-to-end validated rollup on top of v0.32.0-dev (82534a26d), preserving reviewable per-topic commits while eliminating cross-PR patch-series and shared-module rebase conflicts.

In addition to folding in all dsh-auto-review v2 review fixes and runtime kill-switches across #376–#387, combined S5000 Baseline-vs-Candidate A/B testing caught and resolved two cross-subsystem interactions:
1. Exact FP32 carrier before asymmetric INT8 zero-point adjustment (730e37d63, 881a5b976): MUSATorchInt8ScaledMMLinearKernel.apply_weights now computes torch.mm(x_q.to(torch.float32), w_q.to(torch.float32)) rather than accumulating through a 7-bit-mantissa bfloat16 GEMM carrier before subtracting x_zp azp_adj, keeping asymmetric W8A8 output within < 1 FP16 ULP of the exact int32 dequant reference.
2. Per-VllmConfig quantized piecewise native route across rotary adapters (e00c4146e): Bound bind_quantized_piecewise_native_route / should_use_native_quantized_piecewise_op onto MusaRotaryEmbedding, MusaMRotaryEmbedding, MusaVisionApplyRotaryEmb, and deep_gemm_warmup.py in lockstep with RMSNorm / SiluAndMul / QuantFP8. This preserves Inductor q_norm + k_norm + RoPE fusion on FP8 piecewise prefill (Qwen3-8B-FP8 TP=1 prefill +1.06%, 0.0 logprob diff) without mutating process-global os.environ across BF16 engines.

---

Consolidated PRs & Ordered Commits

| Supersedes | Commit | Subsystem & Summary |
|---|---|---|
| #376 | 013c257d0 | Distributed / Logits: Generalize MUSA JIT IPC all_gather for TP LogitsProcessor across arbitrary vocabulary sizes, dtypes, and batch sizes (VLLM_MUSA_TP_LOGITS_IPC=0 kill-switch). |
| #377 + fix | e948a9c36, e00c4146e | Compilation / Custom Ops: Scope VLLM_MUSA_CUSTOM_OP_USE_NATIVE per-VllmConfig strictly to FP8 piecewise graphs across norm, activation, quant, and rotary adapters instead of mutating process-global os.environ. |
| #378 | b31aaf79e | MoE BF16 Prefill: Support folded E=257, top_k=9 (QWEN35_SHARED_EXPERT_FOLD) in BF16 MoE prefill contract and skip dead DeepGEMM warmup when unquantized. |
| #380 | 1a6903b5d | MRV2 Sampler: Replace O(B) sequential Python torch.multinomial loop on seeded requests with batched stateless Philox gumbel_sample (VLLM_MUSA_MRV2_SEEDED_GUMBEL=0 kill-switch) and add 152064 vocab Triton hints. |
| #381 | da00488d5 | MoE S5000 MP-Bin Fallback: Add nearest-MP-bin dispatch-policy fallback across S5000 48 / 56 / 60 / 64 MP cards and calibrate folded Qwen3.5-35B-A3B-FP8 GEMV (VLLM_MUSA_FUSED_MOE_DISPATCH=0 kill-switch). |
| #382 + fix | 58edcffca, 730e37d63, 881a5b976 | FP8 / INT8 Linear & Quant: Fuse static scaled_fp8_quant (per-tensor / rowwise / colmajor / group) in a single-pass Triton kernel and register MUSARowWiseTorchFP8ScaledMMLinearKernel + FP32-carrier MUSATorchInt8ScaledMMLinearKernel. |
| #383 | 1520173fa | Attention (mate >= 0.2.8): Restore Qwen FA3 single-request LUT scheduler metadata across S5000 MP bins and DeepSeek sparse FlashMLA direct-out (num_heads in (64, 128)) on mate >= 0.2.8, with head_size_v guard. |
| #384 | 3e49de584 | FP8 MoE Mid-Batch: Extend compact/dedup fp8_moe_mma with chunked 16-row route map (R <= 280) and fused moe_route_prep (VLLM_MUSA_FP8_MOE_ROUTE_PREP=0 kill-switch). |
| #385 | 76be99045 | Multimodal / ViT: Add contiguous 4D FA3 + chunked/broadcast SDPA fastpaths in MusaMMEncoderAttention and enable bucketed ViT EncoderCudaGraphManager when cudagraph_mm_encoder=True. |
| #386 | ea6d25687 | FP8 Block Split-K: Pre-quantize BF16 activations once in fp8_block_splitk_mm (32x32 / 128x128), add MP64 split-K calibration, and bound dynamic workspace cache (VLLM_MUSA_FP8_SPLITK_ACT_QUANT=0 kill-switch). |
| #387 | 9b7e7de58 | Qwen3.5 GDN Projections: Pack unquantized [in_proj_qkvz; in_proj_ba] into a single GEMM + fused_zba_packed and restore compiled FP8 dual-stream overlap via layer_name-free musa_gdn_fp8_qkvz_bf16_ba_proj. |
| #379 | 1a9b3070a | Speculative Decoding (Eagle / Eagle3 / DFlash): Enable FULL draft CUDAGraph capture (VLLM_MUSA_DRAFT_FULL_WRAP=1 default), fix MRV1 padded decode FA metadata length mismatch, fix MRV2 Eagle3 target_hidden_states / slot_mappings wiring, and replace review-flagged torch.cuda.
calls with torch.musa.* + explicit del buffer release. |
| Tests | 236071ba7 | Unit Test Alignment: Align integrated S5000 unit tests with v0.32.0-dev contracts (nn.Module.__init__ in IPC logits test, is_prefilling, FP8ScaledMMLinearLayerConfig). |
| Cleanup | f9640e858, e3277473d, 02e7f4e97, aa7f49e80 | Lint, Idiom, Test & Dead-Code Cleanup: Apply ruff-format 0.15.1, drop redundant hasattr(torch, "musa") and dict-id lru_cache guards, update test_fp8_block_gemv_native.py source assertion, and remove unreferenced tree_attn.py (-469 lines). |

---

Environment Variables (New & Updated Kill-Switches)

1. New Environment Variables Introduced in This PR

| Env Var | Default | Module / File | Purpose & Fallback (0) |
|---|---|---|---|
| VLLM_MUSA_TP_LOGITS_IPC | 1 | distributed/device_communicators/musa_jit_custom_all_reduce.py | Enable MUSA JIT IPC all_gather for TP LogitsProcessor; 0 falls back to tensor-model-parallel gather / all_reduce. |
| VLLM_MUSA_MRV2_SEEDED_GUMBEL | 1 | v1/sample/topk_topp_sampler.py | Enable batched stateless Philox gumbel_sample on seeded MRV2 requests; 0 falls back to sequential torch.multinomial. |
| VLLM_MUSA_TRITON_STATIC_FP8_QUANT | 1 | patches/vllm___custom_ops.patch.py | Enable fused single-pass Triton static scaled_fp8_quant; 0 falls back to PyTorch eager quantization. |
| VLLM_MUSA_ROWWISE_FP8_SCALED_MM | 1 | model_executor/kernels/linear/scaled_mm/torch_scaled_mm.py | Enable MUSARowWiseTorchFP8ScaledMMLinearKernel for row-wise FP8 scaled_mm; 0 declines registration. |
| VLLM_MUSA_FP8_MOE_ROUTE_PREP | 1 | kernels/fp8_moe_mma.py | Enable fused moe_route_prep + chunked 16-row fp8_moe_mma route map (R <= 280); 0 reverts to legacy route prep. |
| VLLM_MUSA_FP8_SPLITK_ACT_QUANT | 1 | kernels/fp8_block_splitk.py | Pre-quantize BF16 activations once via native.act_quant in fp8_block_splitk_mm; 0 keeps in-CTA Triton quantization. |
| MUSA_GDN_PACKED_PROJ | 1 | model_executor/layers/mamba/gdn/qwen_gdn_linear_attn.py | Pack unquantized [in_proj_qkvz; in_proj_ba] into a single GEMM on Qwen3.5 GDN; 0 keeps separate projections. |
| MUSA_GDN_OPAQUE_DUAL_STREAM | 1 | model_executor/layers/mamba/gdn/qwen_gdn_linear_attn.py | Overlap FP8 in_proj_qkvz and BF16 in_proj_ba on dual MUSA streams under torch.compile; 0 runs sequentially. |

2. Existing Environment Variables Updated / Interacting with This PR

| Env Var | Default | Module / File | Behavior |
|---|---|---|---|
| VLLM_MUSA_CUSTOM_OP_USE_NATIVE | unset (per-VllmConfig) | utils/environ.py, optimization_contract/policy.py | When unset, auto-routes per-VllmConfig strictly for FP8 piecewise CUDAGraph models without mutating os.environ; explicit 0 / 1 overrides process-wide. |
| VLLM_MUSA_DRAFT_FULL_WRAP | 1 (was 0 on Eagle3) | patches/series/0030, 0159 | Default enabled (1) for Eagle / Eagle3 / DFlash FULL draft CUDAGraph capture; set 0 to revert draft model to PIECEWISE. |
| VLLM_MUSA_DFLASH_FULL_WRAP | 1 | patches/series/0030, 0159 | DFlash-specific gate for FULL draft CUDAGraph capture; set 0 to revert DFlash draft to PIECEWISE. |
| VLLM_MUSA_FUSED_MOE_DISPATCH | auto | model_executor/layers/fused_moe/dispatch_policy.py | Existing MoE dispatch selector; 0 / upstream bypasses S5000 48/56/60/64 MP-bin dispatch overrides. |
| VLLM_MUSA_FP8_NATIVE_GEMV | 1 | kernels/fp8_block_splitk.py | Existing native FP8 GEMV toggle; 0 also disables native.act_quant pre-quantization in fp8_block_splitk_mm. |

---

Validation & S5000 Baseline-vs-PR A/B Evidence

Environment


  • Base Image: v0.32.0-ph1-5.2.0-torch2.13.0.post1-20261126 (Python 3.12.16, torch/torch_musa 2.13.0.post1+musa5.2.0, MUSA runtime 50200 / driver 5.2.0-server, torchada 0.1.111, mate 0.2.8.post1, flash_attn_3 0.2.8.post1+musa, triton 3.2.0).

  • Hardware: Validated across both MTT S5000 80 GiB MP64 and MP60 bins.

  • Methodology: Compiled + CUDAGraph serving configuration (TORCHDYNAMO_DISABLE unset), interleaved Baseline (v0.32.0-dev 6bddc3bf1) vs Integrated Candidate runs on the same physical GPUs.
  • 1. Offline CI & S5000 Pytest Gates


  • python3 tools/musa_sync.py check-series --replay: 223 / 223 clean (PASS) after merging 82534a26d (#363).

  • ruff check & ruff format --check across all 48 touched Python files: PASS.

  • Patch metadata, lineage, and porting-contract suite: 151 passed.

  • S5000 24-module unit & kernel pytest suite (MP64) + post-fix delta suite (MP60): 411 passed, 0 failed (43.39s) + 74 passed, 0 failed (65.97s).
  • 2. TP=1 Compiled + CUDAGraph Interleaved A/B (S5000)

    | Model (TP=1) | KV Cache Delta | Greedy Token / Logprob Parity (6 prompts) | Prefill (Base -> Cand) | Decode c=1 (Base -> Cand) | Batched Decode (Base -> Cand) |
    |---|---|---|---|---|---|
    | Qwen3-8B BF16 (MRV2 seeded) | 0.0% (47.35 GiB) | 6/6 exact prefix, max_diff=0.0 | 16275 -> 16283 tok/s (+0.05%) | 76.09 -> 76.14 tok/s (+0.07%) | c=32: 1749.9 -> 2085.9 tok/s (+19.21%) |
    | Qwen3-8B-FP8 | 0.0% (53.74 GiB) | 6/6 exact prefix, max_diff=0.0 | 16131 -> 16301 tok/s (+1.06%) | 110.55 -> 114.53 tok/s (+3.60% MP64) / +0.28% MP60 | c=32: 3105.6 -> 3142.1 tok/s (+1.17% MP64) / +0.07% MP60 |
    | Qwen3.5-2B BF16 (GDN) | 0.0% (59.02 GiB) | 6/6 exact 8-tok prefix | 18374 -> 18107 tok/s (-1.45%) | 210.56 -> 229.46 tok/s (+8.98%) | c=64: 8777.7 -> 9098.9 tok/s (+3.66%) |
    | Qwen3.5-35B-A3B-FP8 (GDN+MoE) | -0.04% (27.02 GiB) | 6/6 exact prefix, max_diff=0.0 | 7010 -> 6450 tok/s (pre-e00c4146e; -4.14% TP=2 post-fix) | 95.03 -> 121.41 tok/s (+27.76%) | c=16: 896.6 -> 903.8 tok/s (+0.80%) |
    | Qwen3-VL-8B-Instruct (VLM) | 0.0% (42.80 GiB) | Semantic image match (PASS) | 1-image E2E: 175.34 -> 174.94 ms (-0.23%) | 4-image E2E: 711.30 -> 711.30 ms (0.0%) | cudagraph_mm_encoder=True: 175.99 ms / 712.95 ms (PASS) |

    3. TP=2 Multi-Subsystem Compiled + CUDAGraph Interleaved A/B (S5000 MP60)

    | Model (TP=2) | Subsystem | KV Cache Delta | Greedy Parity | Prefill (Base -> Cand) | Decode c=1 (Base -> Cand) | Batched Decode (Base -> Cand) |
    |---|---|---|---|---|---|---|
    | Qwen3-8B BF16 | Dense + MRV2 seeded + IPC | 0.0% (50.10 GiB) | 6/6 exact prefix | 14639 -> 14589 tok/s (-0.34%) | 109.23 -> 110.06 tok/s (+0.76%) | c=32: 2109.2 -> 2683.2 tok/s (+27.21%) |
    | Qwen3-30B-A3B-FP8 | FP8 MoE (E=128) | 0.0% (41.60 GiB) | 6/6 exact, max_diff=0.0 | 6494 -> 6627 tok/s (+2.04%) | 94.95 -> 94.27 tok/s (-0.72%) | c=32: 1960.2 -> 1960.5 tok/s (+0.02%) |
    | DeepSeek-V2-Lite-Chat | MLA (FLASHMLA + MP60 MoE) | 0.0% (44.56 GiB) | 6/6 exact 1st tok | 3321 -> 9064 tok/s (+172.97%) | 73.15 -> 98.36 tok/s (+34.46%) | c=16: 777.3 -> 960.9 tok/s (+23.62%) |
    | Qwen3.5-35B-A3B-FP8 | Hybrid GDN + Folded FP8 MoE | -0.05% (39.02 GiB) | 6/6 exact prefix | 5767 -> 5529 tok/s (-4.14%) | 93.07 -> 132.14 tok/s (+41.98%) | c=16: 1075.1 -> 1094.3 tok/s (+1.79%) |
    | DeepSeek-V2-Lite + Eagle3 | Spec-Decode (eagle3, k=3) | 0.0% (37.49 GiB) | 6/6 exact, max_diff=0.0 | Baseline v0.32.0-dev: CRASH (EngineDeadError) -> Cand: 10129 tok/s | Baseline: CRASH -> Cand: 133.56 tok/s (+35.8% vs non-spec 98.36) | c=8: 762.24 tok/s (PASS) |

    4. OpenAI HTTP vllm serve Multi-Turn + 8-Way Concurrent Burst Gate (S5000)

    | Serve Target | Attention Backend | KV Cache / CUDAGraph | 5-Turn Chat Reply Chars | 8-Way Mixed-Seed Burst Chars | Error-Log Audit |
    |---|---|---|---|---|---|
    | Qwen3-8B-FP8 (TP=1) | FLASH_ATTN | 51.75 GiB (376,768 tok) / 1.06 GiB | [143, 463, 151, 517, 140] | [220, 220, 226, 227, 216, 217, 210, 213] | PASS (no non-contiguous FP8 / Triton fallback) |
    | Qwen3.5-2B GDN (TP=1) | FLASH_ATTN | 56.24 GiB (2,495,926 tok) / 0.78 GiB | [32, 413, 141, 411, 127] | [205, 212, 208, 191, 209, 196, 232, 196] | PASS |
    | DeepSeek-V2-Lite-Chat (TP=1) | FLASHMLA | 32.67 GiB (1,127,680 tok) / 0.82 GiB | [97, 459, 100, 491, 110] | [250, 193, 235, 193, 183, 193, 193, 242] | PASS |

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: yeahdongcn Review duration: 848m
    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
    0.57
    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
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #391"
    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: 57% (MEDIUM) · Higher = larger blast radius
    57%
    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: 30.4% · Safe to merge
    30.4%