Commit 2999431
M2.5 Phase 2: decode CUDA-graph capture/replay (single-stream) + fused-MoE residency
Wire CUDA-graph capture/replay into the fp4/CUDA pure-decode path (mirrors
vLLM's decode CUDAGraph capture: capture per batch shape, persistent inputs,
decode-only). New Qwen3_5DecodeGraph captures the forward's layer region once
per shape and replays it per token; the embedding is kept OUTSIDE the graph
(its CUDA op mallocs/frees/syncs a bounds-check flag) and writes a persistent
hidden buffer that the captured region reads. Per-step-varying inputs live in
persistent HOST vectors mutated in place (capturable on GB10 pageable memory).
A cold shape runs one eager step to pre-warm the DevicePool + residency, the
next step captures, subsequent steps replay.
Fused-MoE (MoeBlockFusedCuda): the per-layer expert pointer/scale arrays +
pair->token map are now uploaded ONCE into a resident cache instead of rebuilt
+ re-uploaded from host stack temporaries every step (those dangling host
sources are illegal inside a capture region; also pure per-step waste).
Correctness (GB10, free box): test_qwen36_paged_engine greedy gate passes
16/16 token-for-token with the graph active. All other tests pass (the sole
red, test_qwen36_weights, is pre-existing: it expects bf16 experts but the
on-disk checkpoint is NVFP4 — fails identically at baseline).
Measured decode A/B (GB10, 0% contention), graph ON vs OFF:
num_reqs==1 (1x16x128): TPOT 65.5 vs 67.2 ms -> ~2.6% faster (graph helps)
num_reqs==8 (8x1024x128): TPOT 265 vs 247 ms -> ~7% slower (graph hurts)
After Phase 1 made decode async-on-stream, host launch overhead is largely
hidden behind the GPU, so graph capture recovers little; batched decode is
GPU-bound and gains extra graph-launch overhead from the many GDN-gather nodes.
The runner therefore gates the graph to num_reqs==1 (single-stream latency win,
no batched-throughput regression). Env VLLM_CPP_CUDAGRAPH=0 disables it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UJyFKcK62CcR3imhgbiBnW1 parent b5bcbb4 commit 2999431
4 files changed
Lines changed: 501 additions & 69 deletions
File tree
- include/vllm
- model_executor/models
- v1/worker/gpu
- src/vllm
- model_executor/models
- v1/worker/gpu
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
104 | 157 | | |
105 | 158 | | |
106 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
177 | 184 | | |
178 | 185 | | |
179 | 186 | | |
| |||
0 commit comments