[KV offload] Parallel-agnostic fs-tier cache for single full-attention group (#44733)
Signed-off-by: Itay Etelis <itay.etelis@ibm.com> Co-authored-by: Itay Etelis <itay.etelis@ibm.com>
This commit is contained in:
co-authored by
Itay Etelis
parent
e62d00ab73
commit
c3662b36ea
@@ -4,6 +4,7 @@
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
from vllm.v1.kv_cache_interface import FullAttentionSpec, MLAAttentionSpec
|
||||
from vllm.v1.kv_offload.base import (
|
||||
OffloadingSpec,
|
||||
OffloadKey,
|
||||
@@ -81,6 +82,15 @@ class FileMapper:
|
||||
}
|
||||
for group in kv_cache_config.kv_cache_groups
|
||||
]
|
||||
# Only a single full-attention group is parallelism-invariant. MLA is
|
||||
# excluded: its latent KV is replicated per rank, never head-sharded.
|
||||
groups = kv_cache_config.kv_cache_groups
|
||||
spec = groups[0].kv_cache_spec if len(groups) == 1 else None
|
||||
parallel_agnostic = (
|
||||
parallel_agnostic
|
||||
and isinstance(spec, FullAttentionSpec)
|
||||
and not isinstance(spec, MLAAttentionSpec)
|
||||
)
|
||||
return cls(
|
||||
root_dir=root_dir,
|
||||
model_name=vllm_config.model_config.model,
|
||||
|
||||
@@ -107,11 +107,12 @@ class FileSystemTierManager(SecondaryTierManager):
|
||||
)
|
||||
self._block_size: int = primary_kv_view.strides[0]
|
||||
|
||||
# Create file mapper
|
||||
# Opt in; FileMapper enables it only for a parallelism-invariant block.
|
||||
self.file_mapper = FileMapper.from_offloading_spec(
|
||||
root_dir=root_dir,
|
||||
offloading_spec=offloading_spec,
|
||||
gpu_blocks_per_file=offloading_spec.block_size_factor,
|
||||
parallel_agnostic=True,
|
||||
)
|
||||
|
||||
# Write config file
|
||||
|
||||
@@ -108,7 +108,10 @@ class ObjectStoreSecondaryTierManager(SecondaryTierManager):
|
||||
self._primary_reg = None
|
||||
self._block_size_bytes: int = 0
|
||||
root_dir = f"{prefix}/" if prefix else ""
|
||||
self._file_mapper = FileMapper.from_offloading_spec(root_dir, offloading_spec)
|
||||
# Opt in; FileMapper enables it only for a parallelism-invariant block.
|
||||
self._file_mapper = FileMapper.from_offloading_spec(
|
||||
root_dir, offloading_spec, parallel_agnostic=True
|
||||
)
|
||||
self._next_obj_dev_id: int = 1 # dev_id=0 is reserved for _exists() probes
|
||||
|
||||
self._probe_connectivity()
|
||||
|
||||
Reference in New Issue
Block a user