Repository navigation
[Bugfix] Index Mamba align state copies by request slot in MRV2 - #60210
Conversation
Co-authored-by: Karl0007 <44745209+Karl0007@users.noreply.github.com> Co-authored-by: Yongqin Wang <yongqinwang@roblox.com> Signed-off-by: zjy0516 <riverclouds.zhu@qq.com>
|
/ci run --allow-stale |
|
✅ Triggered Buildkite CI #93220 for commit
|
CI selector (shadow): 132 test steps (173 jobs) instead of 70 (86 jobs)Shadow mode: this changes nothing about what CI runs. It shows what the evidence-based selector would pick for this PR, next to today's rules. How it works. Feedback welcome: reply here if it would skip a step this change needs, or runs something unrelated. Selector would run (132)
Would skip (today's rules run them) (14)
Would add (today's rules do not run them) (76)
AMD mirrors: would skip (9)
AMD mirrors: would add (63)
6 changed files · base |
…-project#60210) The hook upstream main added in vllm-project#60210 (2026-10-07, after this branch's base 74c5cbc): ModelState.initialize_kv_cache(kv_cache_config, block_tables), run after the KV cache tensors are allocated and bound (the CUDA-graph memory-profiling cache, then the real one). Identical to upstream's; drops out on rebase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FezMZ1ejD2hGmG6kJYzp9g
…-project#60210) Signed-off-by: zjy0516 <riverclouds.zhu@qq.com> Co-authored-by: Karl0007 <44745209+Karl0007@users.noreply.github.com> Co-authored-by: Yongqin Wang <yongqinwang@roblox.com>

Overview
Fix Mamba "align" state copies reading another request's block ids under MRV2 + PP + MTP, which poisons recurrent state (all-NaN logits, constant-token output, acceptance collapse). Consolidates #55506 and #57807 into a smaller change; both authors are co-authors. Refs #54173.
Claims
req_idx, so a postprocess that runs steps after its batch (non-last PP rank) no longer reads tables re-gathered for a later batch.compute_aligned_state_indicesis unchanged: it still reads the gathered batch-order tables, so padded rows and CUDA graph capture behave as on main.initialize_kv_cacheinstead of lazily from whichever caller runs first, which removes the capture-time / profiling binding issues raised on [Bugfix] Index mamba spec-decode block tables by request slot, not batch row #55506 and [Bugfix][Model Runner V2] Separate Mamba aligned-metadata and state-copy contexts #57807.Validation
pytest tests/kernels/mamba/test_precopy_mamba_align.py tests/v1/worker/test_mamba_utils.py tests/v1/worker/test_mamba_hybrid_model_state.py tests/v1/worker/test_gpu_model_runner_v2_cudagraph_profiling.py: 146 passed (GB200).--async-scheduling --enable-prefix-caching --mamba-cache-mode align(reproduction from @tomasruizt on [Bugfix] Index mamba spec-decode block tables by request slot, not batch row #55506). main = upstream 31e2443.The stuck requests on main are the constant-token loop from poisoned recurrent state; with a 4096 max-token cap, main PP=2 averaged 235 output tokens per GSM8K question vs 82 for this PR at PP=2 and PP=1. The fix does not change kernel work; the throughput gain comes from the recovered acceptance length.
Reproduction commands
Acceptance length is
1 + spec_decode_num_accepted_tokens / spec_decode_num_draftsfrom/metrics.Details
Root cause:
MambaSpecDecodeGPUContextcaptures block-table pointers once. MRV2 bound it toinput_block_tables, a single buffer re-gathered in batch order every step, and the copy kernels indexed it by batch row. On a non-last PP rank the postprocess for step N runs after step N+k has re-gathered that buffer, so batch rows point at other requests' blocks. With the unified hybrid cache layout those copies land in live state.Why not just #55506 or #57807: both keep lazy binding and add machinery around it (temporary bindings /
bindflag, or two lazily bound contexts plus profiling teardown), and #55506 remaps the aligned-index kernel throughidx_mapping, which changes padded-row behavior. Binding both table sets eagerly avoids all of that. The source tables are safe to read late because a request is not rescheduled (so its row is not rewritten or its slot reused) until its in-flight step's output is processed.MRV1 is unaffected: it launches both kernels without
idx_mapping, wherereq_idx == batch_idx, and passes a single table set, which stays the default for the aligned-index tables.Credit: root cause first identified by @zebgop-ops; fix direction and kernel tests from @Karl0007 (#55506); separate metadata/copy tables and the profiling lifetime issue from @yongqinwang-cmd (#57807).
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.