[HiCache][PD] fix: keep decode load-back polling out of rank-local collectives (#41393)
This commit is contained in:
@@ -288,13 +288,8 @@ class DecodeHiCacheTransferMixin:
|
||||
):
|
||||
dr.hicache_restore_status = HiCacheRestoreResult.READY
|
||||
|
||||
# Phase B: queue new load_back ops if the next slot is free.
|
||||
# The (producer_index + 1) check ensures we never overwrite a still-in-flight slot:
|
||||
# if a previous req holds that slot and isn't done, its event won't be signaled.
|
||||
counter = self.tree_cache.cache_controller.layer_done_counter
|
||||
if not self.tree_cache.is_load_back_event_done(
|
||||
(counter.producer_index + 1) % counter.num_counters
|
||||
):
|
||||
# Phase B: queue new load_back ops if the next slot is free on every rank.
|
||||
if not self.tree_cache.has_free_load_back_slot():
|
||||
return
|
||||
queued = [
|
||||
dr
|
||||
|
||||
@@ -3533,25 +3533,19 @@ class UnifiedRadixCache(BasePrefixCache):
|
||||
return 0
|
||||
|
||||
def is_load_back_event_done(self, consumer_index: int) -> bool:
|
||||
"""Return True after the local load-back event is complete.
|
||||
|
||||
Lets the disagg decode restore state machine
|
||||
(``DecodeHiCacheTransferMixin``) gate on load-back completion; the
|
||||
controller-level ``layer_done_counter`` event is shared across cache
|
||||
implementations, while the tree-side bookkeeping runs in
|
||||
``loading_check``.
|
||||
"""
|
||||
"""Return True after this rank's load-back event is complete."""
|
||||
if consumer_index < 0 or self.cache_controller is None:
|
||||
return True
|
||||
|
||||
finish_event = self.cache_controller.layer_done_counter.events[
|
||||
consumer_index
|
||||
].finish_event
|
||||
if not finish_event.query():
|
||||
return False
|
||||
return finish_event.query()
|
||||
|
||||
self.loading_check()
|
||||
return True
|
||||
def has_free_load_back_slot(self) -> bool:
|
||||
"""Acks are reaped in lockstep, so every rank agrees on this."""
|
||||
cc = self.cache_controller
|
||||
return len(cc.ack_load_queue) < cc.layer_done_counter.num_counters
|
||||
|
||||
# ---- Query / Inspection APIs ----
|
||||
# These APIs exist for compatibility with other RadixTree implementations.
|
||||
|
||||
Reference in New Issue
Block a user