[KV Connector][Mooncake] Add cache_prefix to namespace store keys (#45767)
Signed-off-by: Dao Le <Dao007forever@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
188c68798e
commit
44b2512767
@@ -33,6 +33,10 @@ class KeyMetadata:
|
||||
dcp_rank: int
|
||||
pp_rank: int
|
||||
group_id: int = 0
|
||||
# Optional namespace prepended to every key. Lets separate deployments
|
||||
# share one Mooncake master without colliding on identical block hashes.
|
||||
# Empty (the default) keeps keys byte-identical to the unprefixed format.
|
||||
cache_prefix: str = ""
|
||||
|
||||
|
||||
@dataclass(order=True)
|
||||
@@ -45,6 +49,7 @@ class PoolKey:
|
||||
def __hash__(self):
|
||||
return hash(
|
||||
(
|
||||
self.key_metadata.cache_prefix,
|
||||
self.key_metadata.model_name,
|
||||
self.key_metadata.tp_rank,
|
||||
self.key_metadata.pcp_rank,
|
||||
@@ -56,7 +61,13 @@ class PoolKey:
|
||||
)
|
||||
|
||||
def to_string(self) -> str:
|
||||
prefix = (
|
||||
f"{self.key_metadata.cache_prefix}@"
|
||||
if self.key_metadata.cache_prefix
|
||||
else ""
|
||||
)
|
||||
return (
|
||||
f"{prefix}"
|
||||
f"{self.key_metadata.model_name}"
|
||||
f"@tp_rank:{self.key_metadata.tp_rank}"
|
||||
f"@pcp{self.key_metadata.pcp_rank}"
|
||||
|
||||
@@ -982,6 +982,11 @@ class MooncakeStoreWorker:
|
||||
pcp_rank=self.pcp_rank,
|
||||
dcp_rank=self.dcp_rank,
|
||||
pp_rank=self.pp_rank,
|
||||
cache_prefix=str(
|
||||
vllm_config.kv_transfer_config.kv_connector_extra_config.get(
|
||||
"cache_prefix", ""
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
# Initialize MooncakeDistributedStore with its own TransferEngine
|
||||
|
||||
Reference in New Issue
Block a user