feat: support KV cache CPU offloading in vLLM#269
Open
qinganrice wants to merge 1 commit intoovg-project:mainfrom
Open
feat: support KV cache CPU offloading in vLLM#269qinganrice wants to merge 1 commit intoovg-project:mainfrom
qinganrice wants to merge 1 commit intoovg-project:mainfrom
Conversation
Contributor
Author
|
For SGLang's support, KVCached requires |
Collaborator
After support prefix cache, kvcached should no long require |
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.
Summary:
This PR adds support for using vLLM CPU offloading with KVCached. KV cache blocks are moved between GPU and CPU so that repeated prompts can be served from CPU cache instead of recomputing.
Changes:
KVConnectorMixinPatch
KVConnectorModelRunnerMixin.use_uniform_kv_cache()so it returns False when kvcached is enabled.prefer_cross_layer_blocks=Truemakesuse_uniform_kv_cache()return True, so vLLM usesallocate_uniform_kv_caches()and a single cross-layer torch.zeros tensor. That skips kvcached’s_allocate_kv_cache_tensorspath and the VMM elastic pool.use_uniform_kv_cache()to False, allocation goes through_allocate_kv_cache_tensors, so kvcached’s VMM-backed tensors are used and CPU offloading works.Test: