Fix swa chunk req deferred (#24318)
This commit is contained in:
@@ -1080,6 +1080,15 @@ class Scheduler(
|
||||
elif self.chunked_prefill_size is not None and self.chunked_prefill_size <= 0:
|
||||
self.chunked_prefill_size = None
|
||||
self.chunked_req = None
|
||||
# Tracks whether the current self.chunked_req was actually scheduled
|
||||
# into last iteration's batch (i.e., in can_run_list -> got a fresh
|
||||
# req_pool_idx from prepare_for_extend). Used to gate the
|
||||
# stash_chunked_request call at the top of get_next_batch_to_run:
|
||||
# if add_chunked_req early-returned under hybrid-SWA pressure,
|
||||
# the req_pool_idx was already freed and fill_ids was reset by
|
||||
# init_next_round_input, so running stash would double-free and
|
||||
# corrupt prefix_indices.
|
||||
self._chunked_req_scheduled_last_iter = False
|
||||
self.is_mixed_chunk = (
|
||||
self.chunked_prefill_size is not None
|
||||
and self.server_args.enable_mixed_chunk
|
||||
@@ -2455,7 +2464,9 @@ class Scheduler(
|
||||
# Move the chunked request out of the batch so that we can merge
|
||||
# only finished requests to running_batch.
|
||||
chunked_req_to_exclude.add(self.chunked_req)
|
||||
self.stash_chunked_request(self.chunked_req)
|
||||
|
||||
if self._chunked_req_scheduled_last_iter:
|
||||
self.stash_chunked_request(self.chunked_req)
|
||||
|
||||
# HiSparse has its own prefill-to-decode transition; skip last_batch merge.
|
||||
if self.enable_hisparse:
|
||||
@@ -2650,6 +2661,11 @@ class Scheduler(
|
||||
if self.chunked_req is not None:
|
||||
self.chunked_req.init_next_round_input()
|
||||
self.chunked_req = adder.add_chunked_req(self.chunked_req)
|
||||
self._chunked_req_scheduled_last_iter = (
|
||||
self.chunked_req in adder.can_run_list
|
||||
)
|
||||
else:
|
||||
self._chunked_req_scheduled_last_iter = False
|
||||
|
||||
if self.enable_lora:
|
||||
running_loras = {req.lora_id for req in self.running_batch.reqs}
|
||||
@@ -2741,6 +2757,9 @@ class Scheduler(
|
||||
# Update chunked prefill
|
||||
assert self.chunked_req is None
|
||||
self.chunked_req = adder.new_chunked_req
|
||||
# new_chunked_req is added to can_run_list by add_one_req,
|
||||
# so it will be scheduled this iter -> stash is needed next iter.
|
||||
self._chunked_req_scheduled_last_iter = True
|
||||
|
||||
if self.chunked_req is not None:
|
||||
self.chunked_req.is_chunked += 1
|
||||
|
||||
Reference in New Issue
Block a user