[None][feat] Support beam search in KV cache manager v2#14945
Open
yizhang-nv wants to merge 1 commit into
Open
[None][feat] Support beam search in KV cache manager v2#14945yizhang-nv wants to merge 1 commit into
yizhang-nv wants to merge 1 commit into
Conversation
Signed-off-by: Yi Zhang <187001205+yizhang-nv@users.noreply.github.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.
@coderabbitai summary
Description
Support beam search in KV cache manager v2 for the PyTorch runtime path. Context still starts with beam width 1; generation expands the KV cache to the request beam width. Full context blocks are shared across beams, while the final partial context block is copied into private pages for new beams. Beam-search generation commit remains a runtime responsibility, and V2 only commits full context blocks for reuse.
Test Coverage
python3 -m py_compile tensorrt_llm/runtime/kv_cache_manager_v2/_core/_kv_cache.py tensorrt_llm/_torch/pyexecutor/resource_manager.py tests/unittest/kv_cache_manager_v2_tests/test_kv_cache_manager_v2.pyruff check --select F401 tensorrt_llm/runtime/kv_cache_manager_v2/_core/_kv_cache.py tensorrt_llm/_torch/pyexecutor/resource_manager.py tests/unittest/kv_cache_manager_v2_tests/test_kv_cache_manager_v2.pygit diff --checkpython -m pytest -s -q tests/unittest/kv_cache_manager_v2_tests/test_kv_cache_manager_v2.py::TestNoBatching::test_beam_width_expansion_shares_full_context_blocks tests/unittest/kv_cache_manager_v2_tests/test_kv_cache_manager_v2.py::TestNoBatching::test_beam_width_expansion_copies_partial_context_tail tests/unittest/kv_cache_manager_v2_tests/test_kv_cache_manager_v2.py::TestNoBatching::test_beam_search_generation_commit_is_runtime_responsibility tests/unittest/kv_cache_manager_v2_tests/test_kv_cache_manager_v2.py::TestNoBatching::test_beam_width_expansion_close_uses_stop_committing(4 passed, 2 warnings).PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.