Skip to content

perf(musa): tune fused MoE dispatch by active MP and graph bucket - #193

Closed
yeahdongcn wants to merge 44 commits into
v0.28.0-devfrom
codex/musa100006-core-bin-tactics
Closed

yeahdongcn wants to merge 44 commits into
v0.28.0-devfrom
codex/musa100006-core-bin-tactics

Conversation

@yeahdongcn

@yeahdongcn yeahdongcn commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add fail-closed, MP-aware fused-MoE dispatch for S5000 and ship the first
production-calibrated Qwen3.5 folded-BF16 profile.

The runtime key is the device's active multiprocessor count plus the exact
operator shape and graph-static descriptor. Unknown MPs, unprofiled shapes,
compile mode, invalid context, LoRA and unsupported graph modes retain the
upstream backend.

Current head: af16fcaf5bf8491254bd8754c95ece5156b91b23

Base refresh note: current head merges live v0.28.0-dev at 3f728c148
(vLLM 0.28 pin 2cf0a6915). The v0.24 MP56/MP60 evidence below is retained
as historical calibration evidence; v0.28 exact-build and hardware gates are
being recorded separately and are the only release-decision evidence.

Production behavior

MP56 Qwen3.5 folded BF16

  • shape: E257/topk9/H2048/intermediate128 after shared-expert folding
  • native GEMV only for calibrated decode buckets 1, 2 and 4
  • graph path requires exact FULL, uniform, one-token-per-request descriptors
  • eager NONE may use the engine-static profile only when runtime tokens match
    the selected max-num-seqs profile
  • PIECEWISE, speculative/nonuniform, LoRA, invalid/missing capture context,
    compile mode, bucket 16/64 and unknown MP all fail closed to upstream

MP60 compatibility and correction

  • preserve the pre-existing MP60 NONE/PIECEWISE compatibility paths instead of
    silently disabling them when ForwardContext metadata is present
  • require every MP60 FULL descriptor to be exact and uniform; speculative,
    nonuniform or token-mismatched FULL calls fail closed
  • correct the folded E257/topk9 route-worst boundary from M<=12 to M<=4
  • keep the separately calibrated unfolded E256/topk8 boundary unchanged
  • direct cold-L2 crossover evidence covers balanced, hot and unique-random
    routes with two seeds; M<=4 is the conservative route-worst winner

VLLM_MUSA_FUSED_MOE_DISPATCH=upstream remains the immediate rollback.

Runtime hardening

  • project pinned vLLM ForwardContext/BatchDescriptor fields into a validated
    MusaForwardGraphBucket
  • distinguish absent context from present-but-invalid dependency/API state
  • validate runtime modes against actual NONE/PIECEWISE/FULL values
  • block capture specialization when ForwardContext is missing
  • expose a read-only, msgpack-safe worker RPC for resolved cudagraph mode and
    capture descriptors; no insecure callable serialization is enabled
  • make selector-attribution tools short-input only so they cannot contaminate a
    long-prefill source A/B by disabling existing prefill optimizations

Validation

Focused tests and build

  • local focused suite: 58 passed, 2 skipped
  • exact final source on the pinned MP56 runtime: 75 passed
  • ruff, format, compileall, both benchmark --help paths and git diff --check
    pass
  • editable native build/import boundary f95d5ff99: PASS in 53.1s with 51/51
    task-local ccache hits
  • final delta from f95d5ff99 to 74ed28bcc is Python-only worker/harness
    introspection; no native input, dependency pin or build metadata changed
  • final delta from the frozen MP56 evidence head 74ed28bcc to 574b8728b
    only makes non-exact/speculative FULL descriptors globally fail closed and
    adds its policy test; normal MP56 FULL behavior is unchanged
  • final delta to e185fdfd7 makes the read-only evidence RPC tolerate eager
    dense runners without a cudagraph dispatcher; source and model smokes pass

MP56 final-head graph replay

  • physical S5000 GPUs 0/1/2/3, runtime MP56, TP4
  • one max-num-seqs=64 engine
  • bounded capture sizes 1,2,4,16,64
  • mixed order 1→16→4→16→1→2→16
  • all four ranks reported initialized FULL_AND_PIECEWISE state and identical
    FULL descriptors 64,16,4,2,1
  • candidate selected native only for 1/2/4; 16/64 stayed upstream
  • exact 128-token outputs and Beijing semantic checks passed in both source arms

MP56 formal exact-source HTTP A/B

  • base: fcc2188a5e3a7176e5c714d6fe09cc8f930fe850
  • candidate: 74ed28bcc41cef187e77f001f2afe94ff4a74365
  • immutable image digest:
    sha256:b200181dfb64447567f663440fd40be0657a1e925b5c2b39acf592d04b460ffe
  • same isolated 4 GPUs, both arms AUTO
  • Qwen3.5-35B-A3B-BF16 TP4, 4096 logical random prompt tokens plus chat
    template, exactly 1024 output tokens
  • BS/concurrency 1, 4, 16 and 64
  • fresh-server process order A-B-B-A-A-B
  • aggregate each metric per process, then take the median of three processes
BS Base output tok/s Candidate output tok/s Delta p99 TTFT p99 TPOT p99 E2E
1 90.66 140.55 +55.03% -1.59% -35.95% -35.50%
4 396.12 435.87 +10.04% -1.22% -9.23% -9.12%
16 1060.04 1064.68 +0.44% -0.37% -0.43% -0.44%
64 2319.54 2315.96 -0.15% -0.23% +0.18% +0.16%

All 24 normalized rows passed. Every request produced exactly 1024 tokens;
prompt identities and input-length vectors match across all six processes.
Output-throughput CV is below 0.72% for every arm/batch. Target gains, fallback
neutrality and all <=2% p99 regression gates pass.

Output-text digests are stable within each arm at BS1 but differ across arms;
at higher concurrency they are not stable even within the same source. This is
recorded as a model-quality review item. Direct fused-MoE numerical oracles and
all server/request health checks pass.

Evidence archive SHA256:
160a37d66032d710913d4da338cc9138feadea9dce9b359472989cb5aca718c6

MP60 final-head runtime-mode replay

  • exact final source 574b8728b, four physical MP60 GPUs, TP4
  • exact pinned-runtime focused suite: 75 passed
  • mixed order 1→8→4→8→1→2→8, 256/128 tokens
  • default FULL_AND_PIECEWISE, forced PIECEWISE and eager NONE all pass exact
    output and semantic checks on ranks 0/1/2/3
  • selector logs show native only for M=1/2/4 in all three modes; M=8/16 has
    zero native selections and stays upstream
  • non-exact/speculative FULL is fail-closed by the final policy test

MP60 evidence archive SHA256:
dff887c1b8b5d6c52f983446d313a3e0e3c1a6a4fd0ebbd4b02a9f251a4c369f

Final-head regression controls

  • final source e185fdfd7, physical MP60 GPU, eager NONE
  • exact final-source focused suite: 75 passed
  • Qwen3-8B dense: exact 32 tokens and Beijing semantic marker PASS
  • DeepSeek-V2-Lite-Chat-FP8: exact 32 tokens and Beijing semantic marker PASS;
    existing MP60 FP8 native fused-MoE route exercised
  • the dense smoke found that the evidence RPC assumed every eager runner had a
    cudagraph dispatcher; final head now reports explicit NONE/empty state when
    it is absent, and the same hardware smoke passes

Regression evidence archive SHA256:
ebdc09342d48e296898e065cd81504c398dcd849c7e22a028182453a9b620daa

Current v0.28 release-base gate

Live base 3f728c148 was merged into candidate af16fcaf5. The dependency pin
is now vLLM 2cf0a6915; all 133 MUSA patches apply in order. Exact editable
native build passes in 140.792s with 51/51 task-local ccache hits, exact imports,
and 91 passed focused tests. No GDN source workaround is needed on this base.

MP56 exact-source formal result:

BS Base output tok/s Candidate output tok/s Delta p99 TTFT p99 TPOT p99 E2E
1 91.00 142.51 +56.61% -3.07% -36.65% -36.15%
4 401.74 442.27 +10.09% -0.36% -9.32% -9.16%
16 1069.04 1077.01 +0.74% -1.07% -0.71% -0.74%
64 2324.98 2325.58 +0.03% +0.05% -0.03% -0.03%

MP60 exact-source formal result:

BS Base output tok/s Candidate output tok/s Delta p99 TTFT p99 TPOT p99 E2E
1 114.78 114.68 -0.09% +0.64% +0.09% +0.04%
4 375.93 374.78 -0.31% -0.26% +0.47% +0.42%
16 960.09 959.32 -0.08% -0.24% +0.08% +0.04%
64 2188.84 2190.49 +0.08% -0.13% -0.05% -0.06%

Both bins complete 24/24 rows with exact 1024-token outputs and all frozen
throughput/p99 gates PASS. Merged-head exact descriptor replays also pass on
both MP56 and MP60.

  • v0.28 MP56 archive SHA256:
    715276adb55d0efa724684801e46ef89962acb2117b3618a80dc28c45527a299
  • v0.28 MP60 archive SHA256:
    2bc666fb05c338ba150b6d7fc9b7642cdba115f553d1992ddf6e65c638fa84f4

Design guidance

The policy follows the common cross-vendor pattern rather than using MP alone:

(arch, active_mp, kernel/source ABI, op/stage, M bucket, N/K, dtype, layout/quant, graph descriptor) -> tactic

NVIDIA CUTLASS/Triton and AMD CK/AITER use architecture- and shape-keyed tactic
selection with a conservative fallback. This change applies the same principle
to MUSA: exact entries only, explicit provenance, bounded tuning regions and no
nearest-MP guessing. The reusable policy is documented in
docs/vllm_musa/hardware-aware-kernel-tactics.md.

Source Practice adopted here
NVIDIA CUTLASS/Triton architecture+shape specialization, offline profiling, cached exact tactics, generic fallback
AMD CK/AITER curated/tunable tile maps with conservative coverage and explicit unsupported-shape fallback
MATE/MUSA query the actual active MP at runtime and combine it with graph-static execution metadata
Combined policy keep AOT/upstream as the safe baseline; enable a JIT/native tactic only for a measured exact key, version it by source/ABI, and retune rather than interpolate when hardware or workload identity changes

Known limitations / why Draft remains

  • historical v0.24 evidence required a symmetric GDN workaround and saw a broad
    PIECEWISE capture crash; current v0.28 release-base gates need no workaround
    and use the explicitly supported bounded FULL_DECODE_ONLY capture contract
  • GitHub CI and independent maintainer review are still required

Test plan

  • focused policy/source tests
  • exact pinned-runtime focused suite on MP56
  • MP56 final-head mixed graph replay and exact-base control
  • isolated MP56 formal A-B-B-A-A-B HTTP gate
  • MP60 two-seed, three-route direct crossover
  • MP60 final-head runtime-mode compatibility replay
  • final-head dense and DeepSeek FP8 regression controls
  • current v0.28 exact build and focused tests
  • current v0.28 MP56/MP60 descriptor replays
  • current v0.28 MP56/MP60 formal source A/B gates
  • CI and independent review

@yeahdongcn yeahdongcn changed the title perf(musa): prototype active-MP-aware kernel tactics perf(musa): add active-MP tactic evaluation foundation Aug 25, 2026
@yeahdongcn

Copy link
Copy Markdown
Collaborator Author

MP56 compiled/captured pilot completed on MTT S5000 (MP56), Qwen3.5-35B-A3B-BF16 TP4, 256 input / 128 exact output, enforce_eager=False, warmup=4, repeats=5.

  • max_num_seqs=1: 76.009 -> 111.057 tok/s (+46.11%)
  • max_num_seqs=2: 174.108 -> 196.226 tok/s (+12.70%)
  • max_num_seqs=4: 319.989 -> 338.203 tok/s (+5.69%)
  • max_num_seqs=16: 1123.361 -> 1129.585 tok/s (+0.55%; fail-closed upstream)

All arms passed exact output and Beijing semantic checks. Evidence SHA256: 035bf4e39457d57b729671fa15aa46bb1821988b03f0eb034dc33d85551d84c3. This is an offline compiled/captured throughput pilot; MP60 and HTTP TTFT/TPOT remain pending. The test-only GDN compile workaround is not part of this PR.

@yeahdongcn

Copy link
Copy Markdown
Collaborator Author

Evidence provenance update: the MP56 pilot was rebuilt with final product source snapshots (12327201e) and the benchmark harness included. Source-complete archive: generated/MUSA-100006/mp56-qwen35-e2e-20260825/musa100006-mp56-qwen35-e2e-final.tar.gz, SHA256 cb62908fbfcf6418933314650339b0b290fef94595b04135ad536f3f21226eab. The pilot remains diagnostic/integration evidence: no MP60, HTTP TTFT/TPOT, or order-balanced independent-arm ship gate yet.

@yeahdongcn

Copy link
Copy Markdown
Collaborator Author

Safety follow-up pushed at 18d9e8e7c: the MoE selector now reports graph_mode=compile while Dynamo is symbolically tracing, and no calibrated MP entry exists for that mode. This prevents a small-batch GEMV arm from being baked into a reusable larger graph. Focused policy/tuning suite: 30 passed. The earlier MP56 pilot numbers were collected before this guard and remain diagnostic; a post-guard MP56 rerun is required before treating them as final selector evidence.

@yeahdongcn yeahdongcn changed the title perf(musa): add active-MP tactic evaluation foundation perf(musa): tune fused MoE dispatch by active MP and graph bucket Aug 27, 2026
@yeahdongcn

Copy link
Copy Markdown
Collaborator Author

Superseded by #202. #202 contains all commits from this PR and carries the final v0.28 model-level E2E results and current-head clean AOT build/install evidence. Please continue review in #202.

@yeahdongcn yeahdongcn closed this Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant