[Feat][Core] Add disk offloading support to SimpleCPUOffloadConnector (#49644)
Signed-off-by: Guanyi Chen <939416532@qq.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -75,9 +75,14 @@ class SimpleCPUOffloadScheduler:
|
||||
scheduler_block_size: int,
|
||||
hash_block_size: int,
|
||||
lazy_offload: bool = False,
|
||||
disk_capacity_bytes: int = 0,
|
||||
):
|
||||
self.vllm_config = vllm_config
|
||||
self.kv_cache_config = kv_cache_config
|
||||
# When disk mode is active, the offload pool size is disk-based.
|
||||
offload_capacity = (
|
||||
disk_capacity_bytes if disk_capacity_bytes > 0 else cpu_capacity_bytes
|
||||
)
|
||||
self.enable_kv_cache_events = (
|
||||
vllm_config.kv_events_config is not None
|
||||
and vllm_config.kv_events_config.enable_kv_cache_events
|
||||
@@ -90,7 +95,7 @@ class SimpleCPUOffloadScheduler:
|
||||
# Derive a CPU KVCacheConfig from the GPU config and build a coordinator
|
||||
assert kv_cache_config is not None
|
||||
self.cpu_kv_cache_config = self._derive_cpu_config(
|
||||
kv_cache_config, cpu_capacity_bytes
|
||||
kv_cache_config, offload_capacity
|
||||
)
|
||||
self.num_cpu_blocks = self.cpu_kv_cache_config.num_blocks
|
||||
# Find the full attention kv group for prefix cache matching.
|
||||
@@ -111,10 +116,12 @@ class SimpleCPUOffloadScheduler:
|
||||
assert self.block_size % self.fa_block_size == 0
|
||||
|
||||
logger.info(
|
||||
"SimpleCPUOffloadScheduler: Allocating %d CPU blocks (%.2f GB, mode=%s)",
|
||||
"SimpleCPUOffloadScheduler: Allocating %d offload blocks "
|
||||
"(%.2f GB, mode=%s, backend=%s)",
|
||||
self.num_cpu_blocks,
|
||||
cpu_capacity_bytes / (1024**3),
|
||||
offload_capacity / (1024**3),
|
||||
"lazy" if lazy_offload else "eager",
|
||||
"disk" if disk_capacity_bytes > 0 else "cpu",
|
||||
)
|
||||
|
||||
spec_config = vllm_config.speculative_config
|
||||
|
||||
Reference in New Issue
Block a user