[Scheduler] Soften Long Prefill Tokens Threshhold (#57951)
Signed-off-by: Robert Shaw <robertgshaw2@gmail.com> Signed-off-by: Robert Shaw <robshaw@redhat.com> Co-authored-by: Robert Shaw <robshaw@redhat.com>
This commit is contained in:
co-authored by
Robert Shaw
parent
78d7836525
commit
c64b15cde5
@@ -599,6 +599,15 @@ class Scheduler(SchedulerInterface):
|
||||
throttle_prefills and not self.prefill_capacity_bound
|
||||
) and any(not r.is_prefill_chunk for r in self.running)
|
||||
|
||||
# `long_prefill_token_threshold` exists to stop a long prefill from
|
||||
# starving other requests of the token budget. When it is the only
|
||||
# request there is nobody to starve, so let it use the whole budget.
|
||||
long_prefill_token_threshold = (
|
||||
self.scheduler_config.long_prefill_token_threshold
|
||||
if len(self.running) + len(self.waiting) + len(self.skipped_waiting) > 1
|
||||
else 0
|
||||
)
|
||||
|
||||
# First, schedule the RUNNING requests.
|
||||
req_index = 0
|
||||
while req_index < len(self.running) and token_budget > 0:
|
||||
@@ -650,8 +659,8 @@ class Scheduler(SchedulerInterface):
|
||||
+ request.num_output_placeholders
|
||||
- request.num_computed_tokens
|
||||
)
|
||||
if 0 < self.scheduler_config.long_prefill_token_threshold < num_new_tokens:
|
||||
num_new_tokens = self.scheduler_config.long_prefill_token_threshold
|
||||
if 0 < long_prefill_token_threshold < num_new_tokens:
|
||||
num_new_tokens = long_prefill_token_threshold
|
||||
num_new_tokens = min(
|
||||
num_new_tokens, token_budget, input_budget - draft_slots
|
||||
)
|
||||
@@ -1090,9 +1099,8 @@ class Scheduler(SchedulerInterface):
|
||||
num_new_tokens = padded_num_tokens
|
||||
pad_spec_decode = True
|
||||
|
||||
threshold = self.scheduler_config.long_prefill_token_threshold
|
||||
if 0 < threshold < num_new_tokens:
|
||||
num_new_tokens = threshold
|
||||
if 0 < long_prefill_token_threshold < num_new_tokens:
|
||||
num_new_tokens = long_prefill_token_threshold
|
||||
|
||||
# chunked prefill has to be enabled explicitly to allow
|
||||
# pooling requests to be chunked
|
||||
|
||||
Reference in New Issue
Block a user