-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
v1: Set num_cpu_blocks on VllmConfig #24498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
orozery
wants to merge
1
commit into
vllm-project:main
Choose a base branch
from
orozery:num-cpu-blocks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+18
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also a knob called
offloaded_block_size
in #22595. IIUC, it also impacts the calculation of num_cpu_blocks, right? (i.e., if we have larger CPU blocks, we should have less number of CPU blocks)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In v0, the offloading was part of the core.
My suggestion for v1 is to have the offloading as a connector.
I wanted to follow the convention for connectors, where all of their arguments are actually defined in their
kv_connector_extra_config
.However, deriving
num_cpu_blocks
from some kind of aswap_space
parameter requires knowledge ofkv_bytes_per_block
.So basically, I need my connector (both scheduler-side and worker-side) to be aware of
kv_bytes_per_block
.This requires changing things in core, so I tried to make minimal changes and came up with the approach here:
For the scheduler-side connector, report
kv_bytes_per_block
by setting the existing V0 fieldnum_cpu_blocks
.For the worker-side connector, pass-on
kv_cache_configs
via theregister_kv_caches
function (in a follow-up PR).When the offloading connector gets this
num_cpu_blocks
(given in GPU block size), it can derive the actualnum_cpu_blocks
by dividing byblock_size_factor
.To sum-up, I'm trying to make minimal changes to the core.
This results in the actual offloading configuration parameters split between
vllm_config.cache_config
andkv_connector_extra_config
.I'm good with taking a different approach.
Your thoughts?
Perhaps we should ask other relevant folks on their opinion here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. This is a good point. I think at a high level, there should be two parameters that can be configured by users: (1)
total_cpu_buffer_size
and (2)cpu_buffer_block_size
(how many tokens in each CPU block).For (1), it's also worth thinking whether it's per rank or per vLLM instance (i.e., summed across all ranks). I feel like if it's per rank, probably it will be better to pass it in the KV connector configs, while it makes more sense to have a "global" cache size when it's configured by global configurations like
--swap-space
.For (2), I think it should definitely be put into the KV connector config as it's the current CPU-offloading-connector-specific configuration.
To sum up, I feel like putting all the configs into the KV connector config will probably be better and less confusing. WDYT?