[Hybrid] Fix and optimize block-aligned splitting in mamba cache align mode#33706
Merged
Conversation
Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
peakcrosser7
requested review from
ApostaC,
WoosukKwon,
alexm-redhat,
heheda12345,
njhill,
orozery,
robertgshaw2-redhat and
ywang96
as code owners
February 3, 2026 16:00
Contributor
There was a problem hiding this comment.
Code Review
This pull request addresses an issue with block-aligned splitting in Mamba's cache align mode, which previously did not handle resumed requests correctly. The changes ensure that block-aligned splitting is performed for both new and resumed requests during the prefill phase. Additionally, the logic is optimized to handle prompt and output tokens separately for resumed requests, which should improve cache hit rates. The code has been refactored to introduce a helper function _mamba_compute_cache_pos for better clarity. The changes appear correct and well-implemented to solve the described problem.
Closed
5 tasks
heheda12345
reviewed
Feb 4, 2026
This reverts commit c29650b. Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
heheda12345
enabled auto-merge (squash)
February 12, 2026 19:30
mystous
pushed a commit
to mystous/vllm_hybrid
that referenced
this pull request
May 10, 2026
…gn mode (vllm-project#33706) Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
my-other-github-account
pushed a commit
to my-other-github-account/vllm
that referenced
this pull request
May 15, 2026
…gn mode (vllm-project#33706) Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
my-other-github-account
pushed a commit
to my-other-github-account/vllm
that referenced
this pull request
May 15, 2026
…gn mode (vllm-project#33706) Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
0826joyce
pushed a commit
to 0826joyce/vllm-serving-optimization
that referenced
this pull request
May 19, 2026
…gn mode (vllm-project#33706) Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
plasticchris
pushed a commit
to plasticchris/vllm
that referenced
this pull request
Jul 20, 2026
…gn mode (vllm-project#33706) Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.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.
Purpose
Currently, block-aligned splitting is only executed during the prefill phase of new requests (
num_output_tokens == 0). It does not account for resumed requests. This leads to resumed requests being scheduled without block alignment, causing Mamba states to be stored in a non-aligned fashion. Consequently, incorrect states are retrieved during subsequent cache hits.Changes in this PR:
Optimize the logic to split prompt tokens and output tokens separately on block-aligned boundaries for resumed requests. This ensures that the Mamba states at the end of the prompt is cached, improving the cache hit rate during request replays.Removed for code simplicity.Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.