[Bugfix] Exclude kv_cache_memory_bytes from CacheConfig.compute_hash (#47356)
Signed-off-by: Nils Matteson <nils@thaw.sh> Signed-off-by: Nils Matteson <nilsmatteson@icloud.com> Co-authored-by: Nils Matteson <nils@thaw.sh>
This commit is contained in:
co-authored by
Nils Matteson
parent
abe41f28de
commit
d6875196ad
@@ -6,6 +6,7 @@ from enum import Enum
|
||||
|
||||
import pytest
|
||||
|
||||
from vllm.config.cache import CacheConfig
|
||||
from vllm.config.utils import get_hash_factors, hash_factors, normalize_value
|
||||
|
||||
# Helpers
|
||||
@@ -201,3 +202,15 @@ print(hash_factors(envs.compile_factors()))
|
||||
"compile_factors hash differs between fresh initializations - "
|
||||
"dynamic env vars may not be properly ignored"
|
||||
)
|
||||
|
||||
|
||||
def test_cache_config_hash_ignores_kv_cache_sizing_knobs():
|
||||
"""kv_cache_memory_bytes only sizes the KV cache allocation (like
|
||||
gpu_memory_utilization, which is already ignored); it does not affect
|
||||
the compiled computation graph. If it leaks into the hash, setting the
|
||||
documented fast-boot knob silently invalidates the torch.compile cache
|
||||
and forces a full recompile.
|
||||
"""
|
||||
base_hash = CacheConfig().compute_hash()
|
||||
assert CacheConfig(kv_cache_memory_bytes=1 << 30).compute_hash() == base_hash
|
||||
assert CacheConfig(gpu_memory_utilization=0.5).compute_hash() == base_hash
|
||||
|
||||
@@ -205,6 +205,7 @@ class CacheConfig:
|
||||
ignored_factors = {
|
||||
# Runtime/derived knobs that don't affect compiled graph shape
|
||||
"gpu_memory_utilization",
|
||||
"kv_cache_memory_bytes",
|
||||
"is_attention_free",
|
||||
"num_gpu_blocks_override",
|
||||
"enable_prefix_caching",
|
||||
|
||||
Reference in New Issue
Block a user