{{ message }}
Repository navigation
[Bugfix][HiSparse] Route by swap-row capacity, not the index-group workspace - #60682
Merged
LucasWilkinson merged 1 commit intoOct 8, 2026
Merged
Conversation
…rkspace HiSparseMLAIndexGroup sent a batch to swap_in whenever it fit the index group's physical_topk_indices workspace, which the builder allocates with one spare row. swap_in consumes the HiSparse shared swap rows instead, sized exactly max_num_seqs * max_decode_query_len. A batch of capacity+1 tokens therefore overflowed swap_in: with max_num_seqs=1 the 2-token piecewise CUDA-graph capture fails engine startup, and with max_num_seqs=2 a 3-token prompt crashes at runtime. Compare against the runtime's swap-row capacity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
41 of 64 tasks
MatthewBonanni
marked this pull request as ready for review
October 8, 2026 17:44
MatthewBonanni
requested review from
LucasWilkinson and
pavanimajety
as code owners
October 8, 2026 17:44
Member
Author
|
/ci run |
LucasWilkinson
enabled auto-merge (squash)
October 8, 2026 18:12
6 tasks done
michael-gpu
pushed a commit
to practical-inference/vllm-ampere-extended
that referenced
this pull request
Oct 20, 2026
…rkspace (vllm-project#60682) Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Overview
HiSparse crashes when a batch has exactly
max_num_seqs * max_decode_query_len + 1tokens. Withmax_num_seqs=1the engine fails at startup, and withmax_num_seqs=2a 3-token prompt crashes at runtime:Part of #60072.
Claims
swap_inonly when the batch fits the swap rows thatswap_inconsumes. Larger batches take the existing all-resident fallback.Validation
1×H200, upstream
main242e421. Repro (tiny DeepSeek-V3.2, dummy weights):mainpython repro.py 1stop=2, capacity=1python repro.py 2stop=3, capacity=2max_num_seqs=1, 16k context, 256 output tokens,host_pool_gib=32stop=2, capacity=1Tests on this PR (each command run separately):
pytest tests/v1/attention/test_sparse_mla_backends.py -k "hisparse or index_group": 40 passed. The regression casetest_hisparse_resident_prefill_uses_attention_block_stridefails onmainand passes with this PR.pytest tests/v1/kv_connector/unit/test_hisparse_connector.py: 9 passedpytest tests/v1/core -k hisparse: 72 passedpytest tests/v1/e2e/general/test_hisparse.py: 4 passedDetails
Root cause.
HiSparseMLAIndexGroup.convert_logical_to_physical_topksends a batch toswap_inwhenever the batch fitsphysical_topk_indices. That index-group workspace is allocated with one spare row (max_decode_rows + 1).swap_in, however, writes into the HiSparse runtime's shared swap rows, which hold exactlymin(max_num_batched_tokens, max_num_seqs * max_decode_query_len)rows. A batch one token larger than the swap capacity therefore passes the routing check and then overflows in_step_rows.With
max_num_seqs=1, the CUDA-graph capture sizes are[1, 2]. The 2-token piecewise capture follows the all-resident prefill path into this conversion, so the engine fails at startup. Withmax_num_seqs=2, capture sizes[1, 2, 4]skip 3 tokens, so the failure only appears when a real 3-token batch arrives.Fix. Route on
HiSparseRuntime.max_swap_rows, the capacity thatswap_inactually consumes. The non-HiSparseSparseMLAIndexGroupdoes not change.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.
🤖 Generated with Claude Code