Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions tests/unit_tests/kv_offload/test_offloading_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
init_none_hash,
)
from vllm.v1.core.sched.scheduler import Scheduler
from vllm.v1.kv_cache_interface import KVCacheConfig
from vllm.v1.kv_cache_interface import FullAttentionSpec, KVCacheConfig, KVCacheGroupSpec
from vllm.v1.kv_offload.abstract import (
LoadStoreSpec,
OffloadingEvent,
Expand Down Expand Up @@ -160,8 +160,24 @@ def __init__(self, offloaded_block_size: int, gpu_block_size: int, num_gpu_block
},
)

kv_cache_config = KVCacheConfig(
num_blocks=num_gpu_blocks,
kv_cache_tensors=[],
kv_cache_groups=[
KVCacheGroupSpec(
["layer"],
FullAttentionSpec(
block_size=gpu_block_size,
num_kv_heads=1,
head_size=1,
dtype=torch.float32,
),
)
],
)

self.scheduler: Scheduler = create_scheduler(vllm_config, num_blocks=num_gpu_blocks)
self.worker_connector = OffloadingConnector(vllm_config, KVConnectorRole.WORKER)
self.worker_connector = OffloadingConnector(vllm_config, KVConnectorRole.WORKER, kv_cache_config)

# register worker kv_caches to enable OffloadingWorker creations
self.worker_connector.register_cross_layers_kv_cache(
Expand Down
6 changes: 4 additions & 2 deletions vllm_gaudi/v1/kv_offload/worker/cpu_hpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,12 @@ def get_handlers(
attn_backends: dict[str, type[AttentionBackend]],
) -> Iterator[tuple[type[LoadStoreSpec], type[LoadStoreSpec], OffloadingHandler]]:
if not self._handlers:
assert len(self.gpu_block_size) == 1
gpu_block_size = self.gpu_block_size[0]
self._handlers = CpuGpuOffloadingHandlers(
attn_backends=attn_backends,
gpu_block_size=self.gpu_block_size,
cpu_block_size=self.offloaded_block_size,
gpu_block_size=gpu_block_size,
cpu_block_size=gpu_block_size * self.block_size_factor,
Comment on lines 362 to +368
num_cpu_blocks=self.num_blocks,
gpu_caches=kv_caches,
)
Expand Down
Loading