fix: address CP HiCache review regressions
This commit is contained in:
@@ -732,23 +732,25 @@ class HiRadixCache(RadixCache):
|
||||
device_indices=node.value,
|
||||
node_id=node.id,
|
||||
)
|
||||
metadata = getattr(result, "metadata", None)
|
||||
required_host_slots = 0
|
||||
if getattr(result, "metadata", None) is None:
|
||||
if metadata is None:
|
||||
required_host_slots = result.required_host_slots
|
||||
self._evict_host_for_physical_slots(
|
||||
required_host_slots,
|
||||
synchronize_across_ranks=getattr(self, "tp_world_size", 1) > 1,
|
||||
)
|
||||
if getattr(result, "metadata", None) is None:
|
||||
if metadata is None:
|
||||
result = self.cache_controller.write(
|
||||
device_indices=node.value,
|
||||
node_id=node.id,
|
||||
)
|
||||
if getattr(result, "metadata", None) is None:
|
||||
metadata = getattr(result, "metadata", None)
|
||||
if metadata is None:
|
||||
return 0
|
||||
|
||||
node.host_len = len(node.value)
|
||||
node.cp_hicache = result.metadata
|
||||
node.cp_hicache = metadata
|
||||
node.host_value = None
|
||||
self.ongoing_write_through[node.id] = node
|
||||
if not write_back:
|
||||
@@ -1100,7 +1102,9 @@ class HiRadixCache(RadixCache):
|
||||
self, required_host_slots: int, synchronize_across_ranks: bool = False
|
||||
) -> int:
|
||||
synchronize_across_ranks = (
|
||||
synchronize_across_ranks and getattr(self, "tp_world_size", 1) > 1
|
||||
synchronize_across_ranks
|
||||
and getattr(self, "tp_group", None) is not None
|
||||
and getattr(self, "tp_world_size", 1) > 1
|
||||
)
|
||||
if required_host_slots <= 0 and not synchronize_across_ranks:
|
||||
return 0
|
||||
@@ -1148,9 +1152,7 @@ class HiRadixCache(RadixCache):
|
||||
if x.host_ref_counter > 0:
|
||||
continue
|
||||
|
||||
host_indices = (
|
||||
x.cp_hicache.host_indices if x.cp_hicache is not None else None
|
||||
)
|
||||
host_indices = self._node_host_evict_indices(x)
|
||||
physical_count = len(host_indices) if host_indices is not None else 0
|
||||
|
||||
self._record_remove_event(x)
|
||||
@@ -1197,7 +1199,9 @@ class HiRadixCache(RadixCache):
|
||||
# Block deleted entirely (GPU already evicted, now CPU freed) --
|
||||
# emit BlockRemoved so the router removes this block from its index.
|
||||
self._record_remove_event(x)
|
||||
num_evicted += self.cache_controller.evict_host(x.host_value)
|
||||
num_evicted += self.cache_controller.evict_host(
|
||||
self._node_host_evict_indices(x)
|
||||
)
|
||||
|
||||
parent = self._remove_host_leaf(x)
|
||||
|
||||
@@ -1581,8 +1585,10 @@ class HiRadixCache(RadixCache):
|
||||
while last_node.evicted:
|
||||
host_hit_length += len(last_node.host_value)
|
||||
last_node = last_node.parent
|
||||
while not last_host_node.backuped:
|
||||
while last_host_node != self.root_node and not last_host_node.backuped:
|
||||
last_host_node = last_host_node.parent
|
||||
if not last_host_node.backuped:
|
||||
last_host_node = self.root_node
|
||||
|
||||
return MatchResult(
|
||||
device_indices=value,
|
||||
|
||||
@@ -745,15 +745,15 @@ class ServerArgs:
|
||||
Orchestrates the handling of various server arguments, ensuring proper configuration and validation.
|
||||
"""
|
||||
|
||||
# Normalize load balancing defaults early (before dummy-model short-circuit).
|
||||
self._handle_load_balance_method()
|
||||
|
||||
# Validate SSL arguments early (before dummy-model short-circuit).
|
||||
self._handle_ssl_validation()
|
||||
|
||||
# Validate CP shared KV constraints early (before dummy-model short-circuit).
|
||||
self._handle_cp_shared_kv_validation()
|
||||
|
||||
# Normalize load balancing defaults early (before dummy-model short-circuit).
|
||||
self._handle_load_balance_method()
|
||||
|
||||
if self.model_path.lower() in ["none", "dummy"]:
|
||||
# Skip for dummy models
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user