[Scheduler] Count the parked chunked-prefill request in the busy mem check (#37502)
This commit is contained in:
@@ -2293,6 +2293,7 @@ class Scheduler(
|
|||||||
pool_stats_observer=self.pool_stats_observer,
|
pool_stats_observer=self.pool_stats_observer,
|
||||||
get_last_batch=lambda: self.last_batch,
|
get_last_batch=lambda: self.last_batch,
|
||||||
get_running_batch=lambda: self.running_batch,
|
get_running_batch=lambda: self.running_batch,
|
||||||
|
get_chunked_req=lambda: self.chunked_req,
|
||||||
)
|
)
|
||||||
|
|
||||||
def init_rank_consensus_checker(self) -> None:
|
def init_rank_consensus_checker(self) -> None:
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ class SchedulerInvariantChecker:
|
|||||||
pool_stats_observer: SchedulerPoolStatsObserver
|
pool_stats_observer: SchedulerPoolStatsObserver
|
||||||
get_last_batch: Callable
|
get_last_batch: Callable
|
||||||
get_running_batch: Callable
|
get_running_batch: Callable
|
||||||
|
# The chunked-prefill request parked between chunks is in neither batch;
|
||||||
|
# its uncached tokens must still be counted.
|
||||||
|
get_chunked_req: Callable = field(default=lambda: None)
|
||||||
count_req_pool_leak_warnings: int = 0
|
count_req_pool_leak_warnings: int = 0
|
||||||
count_memory_leak_warnings: int = 0
|
count_memory_leak_warnings: int = 0
|
||||||
recent_busy_msgs: Deque[str] = field(
|
recent_busy_msgs: Deque[str] = field(
|
||||||
@@ -262,8 +265,15 @@ class SchedulerInvariantChecker:
|
|||||||
|
|
||||||
full_uncached = 0
|
full_uncached = 0
|
||||||
swa_uncached = 0
|
swa_uncached = 0
|
||||||
for batch in batches:
|
counted: set[int] = set()
|
||||||
for req in batch.reqs:
|
reqs = [req for batch in batches for req in batch.reqs]
|
||||||
|
chunked_req = self.get_chunked_req()
|
||||||
|
if chunked_req is not None:
|
||||||
|
reqs.append(chunked_req)
|
||||||
|
for req in reqs:
|
||||||
|
if id(req) in counted:
|
||||||
|
continue
|
||||||
|
counted.add(id(req))
|
||||||
if not req.kv.holds_kv:
|
if not req.kv.holds_kv:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user