Support prefill max requests limitation (#14993)
This commit is contained in:
@@ -329,6 +329,7 @@ class PrefillAdder:
|
||||
rem_chunk_tokens: Optional[int],
|
||||
mixed_with_decode_tokens: int = 0,
|
||||
priority_scheduling_preemption_threshold: int = 0,
|
||||
prefill_max_requests: Optional[int] = None,
|
||||
):
|
||||
self.page_size = page_size
|
||||
self.tree_cache = tree_cache
|
||||
@@ -368,6 +369,7 @@ class PrefillAdder:
|
||||
priority_scheduling_preemption_threshold
|
||||
)
|
||||
self.nsa_enable_prefill_cp = is_nsa_enable_prefill_cp()
|
||||
self.prefill_max_requests = prefill_max_requests
|
||||
|
||||
def _get_running_request_total_token_offset(self, req: Req) -> int:
|
||||
return (
|
||||
@@ -575,6 +577,10 @@ class PrefillAdder:
|
||||
# therefore, the prefill-batch setting is temporarily set to 1.
|
||||
if self.nsa_enable_prefill_cp and len(self.can_run_list) >= 1:
|
||||
return AddReqResult.OTHER
|
||||
|
||||
if (x := self.prefill_max_requests) is not None and len(self.can_run_list) >= x:
|
||||
return AddReqResult.OTHER
|
||||
|
||||
if req.sampling_params.ignore_eos and getattr(self.tree_cache, "disable", True):
|
||||
return self.add_one_req_ignore_eos(req)
|
||||
|
||||
|
||||
@@ -1822,6 +1822,7 @@ class Scheduler(
|
||||
chunked_prefill_size,
|
||||
running_bs if self.is_mixed_chunk else 0,
|
||||
self.priority_scheduling_preemption_threshold,
|
||||
prefill_max_requests=self.server_args.prefill_max_requests,
|
||||
)
|
||||
|
||||
if self.chunked_req is not None:
|
||||
|
||||
Reference in New Issue
Block a user