[HiCache] Manage buffer-mode backups per storage pool (#42633)

Co-authored-by: merrymercy <merrymercy@users.noreply.github.com>
Co-authored-by: xiezhq-hermann <xiezhq-hermann@users.noreply.github.com>
This commit is contained in:
metamergebot
2026-10-06 16:45:05 -07:00
committed by GitHub
co-authored by merrymercy xiezhq-hermann
parent fd62ee84f7
commit 08aad0c196
11 changed files with 1495 additions and 415 deletions
+13 -8
View File
@@ -1295,15 +1295,9 @@ class HiCacheController:
)
hash_value, storage_hit_count = [], 0
storage_hit_count_tensor = torch.tensor(
storage_hit_count, dtype=torch.int
storage_hit_count = self._sync_prefetch_hit_query(
operation, storage_hit_count
)
self._all_reduce(
storage_hit_count_tensor,
torch.distributed.ReduceOp.MIN,
self.prefetch_hits_sync_groups,
)
storage_hit_count = storage_hit_count_tensor.item()
# Record the TP-synced hit count; the scheduler thread decides
# at drain time whether to revoke (below threshold) or allocate.
@@ -1316,6 +1310,17 @@ class HiCacheController:
except Empty:
continue
def _sync_prefetch_hit_query(self, operation, storage_hit_count: int) -> int:
"""Rank-reduce a hit query (MIN) so every rank agrees on the usable
prefix. Runs for every operation, hit or miss."""
hit_count = torch.tensor(storage_hit_count, dtype=torch.int)
self._all_reduce(
hit_count,
torch.distributed.ReduceOp.MIN,
self.prefetch_hits_sync_groups,
)
return int(hit_count.item())
def write_storage(
self,
host_indices: torch.Tensor,