← Back to Pull requests

refactor: unify vLLM-MUSA registration around native vLLM plugin contracts #365

Closed
unknown closed this pull request without merging on Nov 26, 2026 06:25 UTC
View on GitHub
unknown unknown commented on Nov 24, 2026 07:25 UTC
Author

Summary

Unifies vLLM-MUSA's registration architecture around vLLM's native out-of-tree plugin contracts (superseding #359 and #362 without adding a parallel manifest or global registry):

  • Split, idempotent general plugins (pyproject.toml, vllm_musa/__init__.py):

  • - vllm.general_plugins declares musa_out_of_tree = "vllm_musa:register_out_of_tree" and musa_attn_backends = "vllm_musa:register_attn_backends", removing the legacy musa_custom_ops alias and all VLLM_PLUGINS=musa,musa_custom_ops settings across docs, cookbook recipes, and examples (vLLM auto-discovers all installed plugins when VLLM_PLUGINS is unset).
    - Deferred maybe_register_musa_template_heuristics() out of bare import vllm_musa into _register_patches().
    - Aligned MUSAPlatformBase.import_kernels() to load all four AOT extensions (vllm._C, vllm._C_stable_libtorch, vllm._moe_C, vllm_musa._C), matching #360's NATIVE_MODULES.
  • Separated vllm_musa/ir/ from vllm_musa/kernels/:

  • - Moved IR providers into vllm_musa/ir/{layernorm.py,gated_qkv.py} (1:1 with upstream vllm/ir/ops/), loaded exclusively by MUSAPlatformBase.import_ir_kernels().
    - vllm_musa/kernels/ holds only standalone MUSA/Triton kernel helpers (no IR registration or re-export shims).
  • Explicit, idempotent install_hooks() for all 14 compatibility adapters:

  • - 7 model-executor adapters wired into vllm_musa.model_executor.register_model_executor_adapters() (cleanly separated from the 8 @*.register_oot layers).
    - 7 v1 runtime adapters wired into vllm_musa.v1.register_v1_adapters() (with mla/common cat-4a drift tripwire regenerated).
  • End-to-end RMSNorm IR convergence:

  • - vllm_musa/ir/layernorm.py wires MUSA JIT musa_csrc_rmsnorm ahead of _C::rms_norm under @ir.ops.rms_norm.register_impl("musa").
    - MusaRMSNorm.forward_oot() delegates non-residual RMSNorm to self.forward_native(x, residual) -> vllm.ir.ops.rms_norm; get_default_ir_op_priority() honors VLLM_MUSA_CUSTOM_OP_USE_NATIVE and quantized PIECEWISE safety routing.
  • Developer guide & CI-gated contract tests:

  • - Added docs/vllm_musa/registration.md and tests/test_registration_architecture.py (wired into .github/workflows/patch-series.yml).

    Alignment with #360

    When rebasing onto #360 (codex/v032-image-runtime-refactor):

  • Keep #360's lora_filesystem_resolver and lora_hf_hub_resolver under [project.entry-points."vllm.general_plugins"].

  • Update musa_custom_ops -> musa_out_of_tree + musa_attn_backends in #360's tests/packaging/verify_install.py and tests/packaging/verify_bundled_wheel.py.
  • Validation

    Offline & CI (543945ba8)


  • pre-commit run on all changed files: 15/15 passed (isort, ruff, black, codespell, check-toml, check-ast, etc.)

  • pytest -q tests/test_v1_worker_import_order.py tests/test_registration_architecture.py: 29 passed, 5 skipped (runtime MUSA tests run on S5000 below)

  • GitHub CI: Patch series gates / offline-series & Cookbook site / build green
  • S5000 Runtime & Functional Validation


  • Environment: worker34068 (10.20.34.68), MTT S5000 (GPUs 6 & 7), pre-built image sh-harbor.mthreads.com/mcctest/vllm:v0.32.0-ph1-5.2.0-torch2.13.0.post1-20261124@sha256:3bd17e280acd003685a88a337cde333022c713449bfd59a0a7ab6936619fa889 (torch 2.13.0.post1+musa5.2.0, torchada 0.1.111, mate 0.2.8.post1, vllm 0.32.0)

  • Zero-VLLM_PLUGINS auto-discovery & custom-op invocation (96f40aac1): unset VLLM_PLUGINS && pytest -q tests/test_registration_architecture.py tests/test_fused_add_rms_norm_compile.py — 27/27 passed (verifies automatic plugin discovery, 4 AOT extensions loaded, direct MUSA execution + parity of AOT _C_musa_ops::musa_fused_add_rms_norm and JIT vllm::musa_csrc_rmsnorm, all 14 adapters _HOOKS_INSTALLED, and MusaRMSNorm OOT -> IR dispatch).

  • Broader S5000 suite (125895a08): tests/test_registration_architecture.py + tests/test_musa.py + tests/test_fused_add_rms_norm_compile.py — 103/103 passed; Qwen3.5-27B-FP8 TP2+MTP1 chat smoke returned "Beijing".
  • S5000 A/B Serving Performance (Baseline pre-built image vs PR #365)


    All runs use identical model checkpoints, cookbook flags, vllm bench serve random 1024 -> 256 (--seed 12345 --ignore-eos), and verified FLASH_ATTN + graph capture with VLLM_PLUGINS unset:

    | Model / Config | Concurrency | Baseline Out tok/s | PR #365 Out tok/s | Delta | Baseline TTFT / TPOT p50 | PR #365 TTFT / TPOT p50 |
    | --- | --- | ---: | ---: | ---: | --- | --- |
    | Qwen3-8B-FP8 (TP1, FULL_AND_PIECEWISE) | c=1 (n=16) | 89.45 | 89.50 | +0.06% | 49.86 / 9.44 ms | 50.19 / 9.44 ms |
    | Qwen3-8B-FP8 (TP1, FULL_AND_PIECEWISE) | c=16 (n=64) | 163.32 | 163.97 | +0.40% | 330.69 / 12.98 ms | 335.23 / 12.98 ms |
    | Qwen3.5-27B-FP8 (TP2, MTP1, FULL_DECODE_ONLY) | c=1 (n=16) | 34.20 | 34.18 | -0.06% | 153.87 / 15.15 ms | 153.74 / 15.19 ms |
    | Qwen3.5-27B-FP8 (TP2, MTP1, FULL_DECODE_ONLY) | c=16 (n=48) | 158.21 | 158.62 | +0.26% | 440.96 / 28.13 ms | 499.67 / 28.49 ms |
    | Qwen3.5-35B-A3B-FP8 (TP2 MoE, FULL_DECODE_ONLY) | c=1 (n=16) | 40.14 | 40.02 | -0.30% | 108.53 / 10.98 ms | 109.15 / 11.01 ms |
    | Qwen3.5-35B-A3B-FP8 (TP2 MoE, FULL_DECODE_ONLY) | c=16 (n=48) | 713.71 | 712.13 | -0.22% | 503.02 / 17.12 ms | 502.07 / 17.23 ms |

    All three models (TP1 Dense FULL_AND_PIECEWISE, TP2 Dense + MTP1, TP2 MoE + Mamba/Hybrid) are within ±0.4% throughput parity with the stock pre-built image.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: yeahdongcn Review duration: 2820m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)). 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.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #365"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 22.5% · Safe to merge
    22.5%