[Bugfix][Core] Drain async KV loads in pause(mode="wait"), and pause the drain test only once a request is in flight (#60572)

Signed-off-by: aoshen02 <aoshen@inferact.ai>
Signed-off-by: Stefan Koncarevic <Stefan.Koncarevic@amd.com>
Co-authored-by: aoshen02 <aoshen@inferact.ai>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
stefankoncarevic
2026-10-08 09:33:41 +00:00
committed by GitHub
co-authored by aoshen02 Claude Opus 5.5
parent c4cd88d9fe
commit 7816afdb25
4 changed files with 103 additions and 8 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ class PauseState(enum.IntEnum):
- UNPAUSED: Normal operation
- PAUSE_NEW: No new requests are scheduled, requests already in
running state are scheduled.
running state or holding KV blocks are scheduled.
- PAUSE_ALL: No requests are scheduled
"""
+8 -4
View File
@@ -887,7 +887,7 @@ class Scheduler(SchedulerInterface):
assert len(scheduled_loras) <= self.lora_config.max_loras
# Next, schedule the WAITING requests.
if not preempted_reqs and self._pause_state == PauseState.UNPAUSED:
if not preempted_reqs and self._pause_state != PauseState.PAUSED_ALL:
step_skipped_waiting: deque[Request] = deque()
step_skipped_kv_holding: deque[Request] = deque()
@@ -900,8 +900,11 @@ class Scheduler(SchedulerInterface):
step_skipped_waiting.appendleft(request_to_skip)
while token_budget > 0:
# Requests holding KV blocks are always drained first.
request_queue = self.kv_holding_waiting or self.waiting
# Requests holding KV blocks are always drained first, and are
# the only ones admitted under PAUSED_NEW (e.g. async KV loads).
request_queue = self.kv_holding_waiting
if not request_queue and self._pause_state == PauseState.UNPAUSED:
request_queue = self.waiting
if not request_queue or input_budget <= draft_slots:
break
# Paused streaming sessions (WAITING_FOR_STREAMING_REQ) are not
@@ -2802,7 +2805,8 @@ class Scheduler(SchedulerInterface):
return 0
num_running, num_waiting = self.get_request_counts()
if self._pause_state == PauseState.PAUSED_NEW:
return num_running
# Requests holding KV blocks still drain; queued ones stay queued.
num_waiting = len(self.kv_holding_waiting)
num_waiting -= self.num_waiting_for_streaming_input
return num_waiting + num_running