-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[bugfix][DCP] fix block_size of hash in DCP prefix caching #26296
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,14 +177,17 @@ def __init__( | |
self.vllm_config.cache_config.enable_prefix_caching | ||
or self.scheduler.get_kv_connector() is not None | ||
): | ||
block_size = vllm_config.cache_config.block_size | ||
hash_block_size = ( | ||
vllm_config.cache_config.block_size | ||
* vllm_config.parallel_config.decode_context_parallel_size | ||
) | ||
caching_hash_fn = get_hash_fn_by_name( | ||
vllm_config.cache_config.prefix_caching_hash_algo | ||
) | ||
init_none_hash(caching_hash_fn) | ||
|
||
self.request_block_hasher = get_request_block_hasher( | ||
block_size, caching_hash_fn | ||
hash_block_size, caching_hash_fn | ||
|
||
) | ||
|
||
self.step_fn = ( | ||
|
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.
This calculation for
hash_block_size
duplicates logic from theScheduler
's__init__
method, where itsblock_size
attribute is also adjusted fordecode_context_parallel_size
. This duplication is what led to the original bug this PR is fixing.To avoid this, you can reuse the
block_size
from the scheduler instance. This makes the code more robust by using a single source of truth.While
block_size
is not on theSchedulerInterface
, using it with atype: ignore
is a pragmatic way to remove the duplication within this file. A more complete solution would involve exposing the logical block size through the interface or a shared utility, which could be addressed in a follow-up.