← Back to Pull requests

MUSA: keep hybrid-cache state in the shared fused pool #324

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

Summary

Three commits:

1. GDN runs on mate in place — Qwen GDN prefill and decode write straight
into the mate state pool instead of staging copies, and the causal-conv state
offset is 64-bit in every kernel (the width4 vector kernel was still int32).
2. Mamba state stays in the shared fused pool — the dedicated Mamba state
allocation, its page-size override, jit_kernel/mamba_metadata.py and the
placement helpers are removed. 0203 carves one page-major view per state
out of the shared allocation, so a block's states stay inside the page they
were written to.
3. The patch series is renumbered to 0001..0204 — eight holes were left
where patches had been removed, which made regen unable to reproduce the
filenames it writes and kept check-series --round-trip red.

Why

The dedicated pool existed because the mate pin could not decode from a padded
SSM page; it now can, so the series stops carrying the machinery. Mamba states
move into the shared fused allocation, where the layout is page-major — every
block holds all of a layer's states. A flat state-major slice of that buffer
mixes bytes from adjacent blocks, so 0203 keeps the page stride and selects
each state's byte range within the page.

The series also carried eight removed entries (0078, 0108, 0112, 0119,
0120, 0204, 0206, 0207). regen names entries sequentially from the
maintenance commits, so any hole makes the written names drift from the ones on
disk; a declared-removals allowlist only silenced the numbering check while
--round-trip stayed red. Renumbering makes the series a fixed point again.

What changed

| commit | subject | files |
|---|---|---:|
| 2123d965 | MUSA: run GDN prefill and decode on mate in place | 3 |
| a05b4482 | MUSA: keep Mamba state in the shared fused pool | 38 |
| b1afc69d | chore(series): renumber patches 0001..0204 | 169 |

The renumber commit carries no patch content change: 121 entries are
byte-identical renames, 5 differ only in hunk-header offsets, and 2 drop the
-- / version footer. Companion references are updated in
patch-groups.json, legacy-lineage.json, series/README.md, 32 test files
and one example README.

Correctness

  • check-series PASS — 204 entries, contiguous 0001..0204

  • check-series --replay PASS — applies to the pinned commit

  • musa_sync verify PASS — 207 clean / 242 anchors

  • check-series --round-trip PASS — regen reproduces the series

  • applying all 204 patches to VLLM_COMMIT reproduces the holder tree byte for

  • byte (identical tree id)
  • 0203 gates on isinstance(spec, MambaSpec); separate_musa_pools no longer

  • occurs in the tree
  • tests/test_*source.py 188 passed, 1 skipped on a pytest-only runner
  • VLLM_TAG / VLLM_COMMIT are unchanged; the maintenance holder is rebuilt from
    the series by rebase, so any stale local holder cannot leak into the patches.

    Performance evidence

    How it was measured

    Server, one host with two cards (TP2, prefix caching on, MUSA build under test):

    vllm serve "$MODEL_PATH" \
      --served-model-name "$SERVED_NAME" --host 0.0.0.0 --port 18122 \
      --trust-remote-code --tensor-parallel-size 2 --gpu-memory-utilization 0.90 \
      --max-model-len "$MAX_MODEL_LEN" --max-num-seqs 8 \
      --max-num-batched-tokens 16384 \
      --enable-chunked-prefill --enable-prefix-caching --mamba-cache-mode align \
      -cc.mode=None -cc.cudagraph_mode=FULL_DECODE_ONLY \
      '-cc.cudagraph_capture_sizes=[1,2,4,8]'
    

    | model | served name | max-model-len |
    |---|---|---:|
    | Qwen3.5-27B-FP8 | qwen35-27b-fp8 | 140000 |
    | Qwen3.6-35B-A3B-FP8 | qwen36-35b-a3b | 140000 |
    | Qwen3.8-27B-FP8 | qwen38 | 140000 |
    | Nemotron-3.5-Lightning-30B-A3B | nemotron-30b-a3b | 132096 |

    Client: vllm bench serve against the OpenAI completions endpoint, fixed prompt
    files per shape, 1024 output tokens, --request-rate inf, --num-warmups 0:

    vllm bench serve --backend openai --base-url "$BASE" --endpoint /v1/completions \
      --model "$SERVED_NAME" --dataset-name custom --dataset-path "$PROMPTS" \
      --skip-tokenizer-init --disable-shuffle --custom-output-len 1024 \
      --num-prompts "$N" --max-concurrency "$C" --request-rate inf \
      --ignore-eos --temperature 0 --seed "$SEED" \
      --extra-body '{"max_tokens":1024,"temperature":0}' \
      --percentile-metrics ttft,tpot,itl,e2el --metric-percentiles 50,90,95,99 \
      --ready-check-timeout-sec 0 --num-warmups 0 --disable-tqdm
    

    Grid: 2048-c8, 4096-c8, 8192-c8, 16384-c8, 32768-c8, 65536-c4, 131072-c2. Four
    arms per model: 0.28.0, current with prefix ON on unique prompts, current with a
    50% shared prefix, current with prefix OFF.

    Each cell below is TTFT p50 (ms) / TPOT p50 (ms) / output throughput (tok/s);
    rows are the request shape. Full per-arm tables live on the report page
    generated/MUSA-100086/qwen35-27b-fp8/analysis/musa100086-prefix-analysis.html.

    Qwen3.5-27B-FP8

    | length | 0.28.0 | current · unique | current · shared50 | current · prefix OFF |
    |---|---|---|---|---|
    | 2048-c8 | 1831 / 21.0 / 352 | 1767 / 21.2 / 350 | 1153 / 21.1 / 360 | 1672 / 21.0 / 354 |
    | 4096-c8 | 2520 / 22.6 / 319 | 3177 / 22.5 / 312 | 2074 / 21.9 / 335 | 2526 / 23.0 / 314 |
    | 8192-c8 | 4218 / 24.9 / 269 | 4473 / 26.1 / 260 | 3747 / 24.1 / 288 | 4312 / 26.3 / 263 |
    | 16384-c8 | 7175 / 32.5 / 203 | 8619 / 32.5 / 195 | 6317 / 28.4 / 232 | 7100 / 33.8 / 196 |
    | 32768-c8 | 10044 / 50.0 / 135 | 15223 / 48.0 / 127 | 10103 / 39.2 / 164 | 10066 / 53.5 / 127 |
    | 65536-c4 | 14847 / 43.1 / 70 | 20473 / 40.7 / 66 | 14382 / 31.4 / 88 | 15148 / 45.3 / 67 |
    | 131072-c2 | 24529 / 38.7 / 32 | 29047 / 39.5 / 30 | 20994 / 30.3 / 39 | 26383 / 41.2 / 30 |

    shared50 hit rate: 2048 40.6% · 4096 40.6% · 8192 40.6% · 16384 45.7% · 32768 48.2% · 65536 49.5% · 131072 49.5%

    Qwen3.6-35B-A3B-FP8

    | length | 0.28.0 | current · unique | current · shared50 | current · prefix OFF |
    |---|---|---|---|---|
    | 2048-c8 | 599 / 13.7 / 567 | 632 / 12.3 / 624 | 971 / 12.1 / 612 | 504 / 11.9 / 649 |
    | 4096-c8 | 705 / 14.0 / 542 | 989 / 12.4 / 596 | 819 / 12.4 / 610 | 746 / 12.4 / 608 |
    | 8192-c8 | 1190 / 14.7 / 499 | 1339 / 13.4 / 541 | 1179 / 12.9 / 572 | 1299 / 13.1 / 554 |
    | 16384-c8 | 2217 / 16.8 / 423 | 2408 / 15.6 / 449 | 2028 / 13.6 / 514 | 2065 / 15.3 / 464 |
    | 32768-c8 | 3028 / 22.0 / 324 | 3858 / 20.5 / 333 | 3263 / 16.1 / 415 | 3042 / 20.4 / 345 |
    | 65536-c4 | 5139 / 18.5 / 170 | 6821 / 18.9 / 156 | 4472 / 16.9 / 188 | 4894 / 20.3 / 160 |
    | 131072-c2 | 8527 / 15.7 / 84 | 9527 / 17.8 / 74 | 6628 / 15.5 / 91 | 9157 / 17.8 / 75 |

    shared50 hit rate: 2048 0.0% · 4096 26.6% · 8192 39.8% · 16384 46.5% · 32768 49.8% · 65536 49.8% · 131072 49.8%

    Qwen3.8-27B-FP8

    | length | 0.28.0 | current · unique | current · shared50 | current · prefix OFF |
    |---|---|---|---|---|
    | 2048-c8 | 1682 / 21.0 / 353 | 1754 / 21.1 / 351 | 1137 / 21.0 / 362 | 1644 / 21.0 / 355 |
    | 4096-c8 | 2676 / 22.5 / 319 | 3130 / 22.4 / 315 | 2062 / 21.8 / 336 | 2486 / 22.8 / 317 |
    | 8192-c8 | 4609 / 24.9 / 269 | 4410 / 25.8 / 263 | 3703 / 24.0 / 289 | 4252 / 26.1 / 265 |
    | 16384-c8 | 7163 / 32.5 / 203 | 8010 / 33.6 / 196 | 6235 / 28.4 / 234 | 6995 / 33.6 / 198 |
    | 32768-c8 | 10051 / 50.6 / 133 | 11871 / 51.6 / 127 | 11388 / 37.1 / 166 | 9924 / 53.0 / 129 |
    | 65536-c4 | 16228 / 41.8 / 70 | 20244 / 40.5 / 66 | 13454 / 31.9 / 89 | 13404 / 46.4 / 67 |
    | 131072-c2 | 24513 / 38.8 / 32 | 28520 / 39.2 / 30 | 20659 / 30.1 / 40 | 24532 / 42.2 / 30 |

    shared50 hit rate: 2048 40.6% · 4096 40.6% · 8192 40.6% · 16384 45.7% · 32768 48.2% · 65536 49.5% · 131072 49.5%

    Nemotron-3.5-Lightning-30B-A3B

    | length | 0.28.0 | current · unique | current · shared50 | current · prefix OFF |
    |---|---|---|---|---|
    | 2048-c8 | 1518 / 17.1 / 435 | 1570 / 16.9 / 436 | 1514 / 17.3 / 430 | 1561 / 16.7 / 442 |
    | 4096-c8 | 2231 / 17.2 / 408 | 2075 / 17.1 / 415 | 2073 / 18.4 / 394 | 2234 / 17.4 / 415 |
    | 8192-c8 | 3720 / 19.0 / 351 | 3387 / 18.9 / 351 | 2872 / 18.2 / 381 | 3715 / 18.7 / 352 |
    | 16384-c8 | 5918 / 22.3 / 282 | 5205 / 23.3 / 279 | 3755 / 19.7 / 337 | 6171 / 22.3 / 280 |
    | 32768-c8 | 9144 / 31.7 / 199 | 14321 / 28.4 / 188 | 8509 / 22.2 / 262 | 9638 / 32.4 / 193 |
    | 65536-c4 | 11929 / 29.4 / 96 | 16669 / 27.3 / 89 | 7773 / 21.9 / 133 | 14345 / 30.5 / 91 |
    | 131072-c2 | 18523 / 22.3 / 49 | 21063 / 21.6 / 47 | 11799 / 18.1 / 67 | 18721 / 24.0 / 47 |

    shared50 hit rate: 2048 0.0% · 4096 0.0% · 8192 25.8% · 16384 38.7% · 32768 45.1% · 65536 48.3% · 131072 50.0%

    What the numbers say

    The run was not on isolated cards — a neighbouring lease held card 1 until 00:42,
    so every Qwen3.5/Qwen3.6 cell and Qwen3.8 at 2K–32K were measured inside that
    window. Individual cells therefore carry some spread; the conclusions below are
    read from the trend across the grid, not from single cells.

    1. Basic performance aligns with 0.28.0; no regression in the trend.
    Comparing the prefix-OFF arm against 0.28.0 — the same no-reuse workload — 25 of
    28 TTFT cells land within ±10% and throughput spans −6.3% to +14.5%. The three
    TTFT cells outside that band (Qwen3.6 at 2K −15.9%, Qwen3.8 at 64K −17.4%,
    Nemotron at 64K +20.3%) fall inside the non-isolated measurement window and are
    not reproducible on their neighbours. Throughput sits slightly below 0.28.0 for
    Qwen3.5 from 32K upward (−3.8% to −6.3%) and for Qwen3.6 at 128K (−10.6%); the
    rest of the grid is flat or faster. Overall the cold path tracks 0.28.0.

    2. A shared 50% prefix does hit, and the gain grows with context. Hit rate
    reaches 40.6–49.8% (Nemotron 50.0% at 128K). Measured against the prefix-OFF arm
    on the same stack, output throughput rises with length — Qwen3.5:
    +1.6 / +6.5 / +9.5 / +18.3 / +28.4 / +31.7 / +31.7% over the 2K→128K grid;
    Nemotron: −2.8 / −5.1 / +8.2 / +20.1 / +36.0 / +47.1 / +42.5%. The flat or
    slightly negative cells are exactly the ones with no hit, where the prefix block
    is larger than the shared header (Qwen3.6 at 2K: 1088-token block vs 1024-token
    header; Nemotron at 2K/4K: 2112 vs 2048).

    3. On unique input, turning prefix caching on does not cost throughput.
    Across all 28 cells the difference against the prefix-OFF arm is −0.1% to −1.5%,
    which is within the spread of this non-isolated run. TTFT on the longest cells
    moves by more — Qwen3.5 +51.2% at 32K, Qwen3.8 +51.0% at 64K, Nemotron +48.6% at
    32K — with no matching throughput change, which points at a shared-card stall
    rather than extra work, and the same shapes read close to parity in the cells
    measured outside the window. Read those cells as measurement spread — or as not
    significant — rather than as a regression.

    Accuracy

    GSM8K, first 128 canonical CoT prompts, greedy, one request at a time:

    | model | arm | correct | accuracy |
    |---|---|---:|---:|
    | Qwen3.5-27B-FP8 | 0.28.0 | 112/128 | 87.50% |
    | Qwen3.5-27B-FP8 | current | 112/128 | 87.50% |
    | Qwen3.6-35B-A3B-FP8 | 0.28.0 | 122/128 | 95.31% |
    | Qwen3.6-35B-A3B-FP8 | current | 120/128 | 93.75% |
    | Qwen3.8-27B-FP8 | 0.28.0 | 118/128 | 92.19% |
    | Qwen3.8-27B-FP8 | current | 121/128 | 94.53% |
    | Nemotron-3.5-Lightning-30B-A3B | 0.28.0 | 110/128 | 85.94% |
    | Nemotron-3.5-Lightning-30B-A3B | current (no MTP) | 113/128 | 88.28% |

    Every arm moves by at most two questions against 0.28.0.

    Not covered by this table: nemotron mtp6-current, the v028 arms of
    Qwen3.5/Qwen3.6, and the novel arm were not run for accuracy.
    nemotron nomtp-base produced 38.28% with a 6-token median completion and is
    recorded as invalid (early run used the wrong endpoint).

    How to verify

    python tools/musa_sync.py check-series
    python tools/musa_sync.py check-series --repo <pin-checkout> --replay
    python tools/musa_sync.py check-series --repo <holder> --round-trip
    python tools/musa_sync.py verify --repo <pin-checkout>
    python -m pytest -q tests/test_*source.py
    

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: yeahdongcn Review duration: 4569m
    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 #324"
    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%