[Core][Refactor] Move KV cache planning logic to kv_cache_planning.py (#61183)
Signed-off-by: Dakai An <dakaian108@gmail.com> Signed-off-by: Yifan Qiao <yifanqiao@inferact.ai> Co-authored-by: Yifan Qiao <yifanqiao@inferact.ai> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Yifan Qiao
Claude Opus 5.5
parent
c077dc663d
commit
df6c7ad031
File diff suppressed because it is too large
Load Diff
+1
-1614
File diff suppressed because it is too large
Load Diff
@@ -50,10 +50,10 @@ from vllm.utils.hashing import get_hash_fn_by_name
|
||||
from vllm.utils.network_utils import make_zmq_socket
|
||||
from vllm.utils.system_utils import decorate_logs, set_process_title
|
||||
from vllm.v1.attention.backends.utils import resolve_kv_cache_layout
|
||||
from vllm.v1.core.kv_cache_planning import get_kv_cache_configs
|
||||
from vllm.v1.core.kv_cache_utils import (
|
||||
BlockHash,
|
||||
generate_scheduler_kv_cache_config,
|
||||
get_kv_cache_configs,
|
||||
get_request_block_hasher,
|
||||
init_none_hash,
|
||||
resolve_cache_hit_alignment_tokens,
|
||||
|
||||
@@ -71,7 +71,7 @@ def get_hisparse_kv_cache_groups(
|
||||
if not mla_specs:
|
||||
return None
|
||||
|
||||
from vllm.v1.core.kv_cache_utils import get_kv_cache_groups
|
||||
from vllm.v1.core.kv_cache_planning import get_kv_cache_groups
|
||||
|
||||
mla_group_spec = UniformTypeKVCacheSpecs.from_specs(mla_specs)
|
||||
assert mla_group_spec is not None
|
||||
@@ -323,7 +323,7 @@ def get_hisparse_kv_cache_config(
|
||||
available_memory: int,
|
||||
host_budget: int,
|
||||
) -> KVCacheConfig:
|
||||
from vllm.v1.core.kv_cache_utils import (
|
||||
from vllm.v1.core.kv_cache_planning import (
|
||||
_get_kv_cache_bytes_per_block,
|
||||
may_override_num_blocks,
|
||||
validate_kv_cache_layout,
|
||||
|
||||
@@ -989,7 +989,7 @@ def _extrapolate_full_graph_memory(mem_samples: list[int], total_graphs: int) ->
|
||||
|
||||
def _init_minimal_kv_cache_for_profiling(runner: "GPUModelRunner") -> None:
|
||||
"""Allocate the smallest KV cache that still lets every graph be captured."""
|
||||
from vllm.v1.core.kv_cache_utils import (
|
||||
from vllm.v1.core.kv_cache_planning import (
|
||||
get_kv_cache_config_from_groups,
|
||||
get_kv_cache_groups,
|
||||
)
|
||||
|
||||
@@ -6206,7 +6206,7 @@ class GPUModelRunner(
|
||||
gc.collect()
|
||||
|
||||
def _init_minimal_kv_cache_for_profiling(self) -> None:
|
||||
from vllm.v1.core.kv_cache_utils import (
|
||||
from vllm.v1.core.kv_cache_planning import (
|
||||
get_kv_cache_config_from_groups,
|
||||
get_kv_cache_groups,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user