Default CP bs>1 extend admission to chunk budget
When chunked prefill is active, CP shared-KV bs>1 cannot consume more extend tokens than the current chunk budget. If the CP-specific extend-token limit is omitted, default it to rem_chunk_tokens so scheduler admission reflects the reachable chunk capacity. The request-count and cached-token knobs keep their None-as-unlimited behavior. Constraint: CP bs>1 batching must not advertise a larger extend batch than chunked prefill can execute. Rejected: Require users to always set --cp-shared-kv-prefill-max-total-extend-tokens | the safe default is already available from chunked prefill state. Rejected: Default batch request or cached-token limits | those are policy knobs and None should remain unlimited. Confidence: high Scope-risk: narrow Directive: Keep --cp-shared-kv-prefill-max-total-extend-tokens as min(user_limit, chunk_budget) when both exist. Tested: Local py_compile for schedule_policy.py and test_prefill_adder.py. Tested: Remote g0034 cjy-glm5-new targeted prefill_adder tests: 2 passed. Not-tested: Full ETE scheduler batching distribution after defaulting the extend limit. Co-authored-by: OmX <omx@oh-my-codex.dev>
This commit is contained in:
@@ -483,18 +483,20 @@ class PrefillAdder:
|
||||
if (
|
||||
self._is_cp_prefill_context()
|
||||
and self.enable_cp_shared_kv_prefill_bs_gt1
|
||||
and self.cp_shared_kv_prefill_max_total_extend_tokens is not None
|
||||
and self.rem_chunk_tokens is not None
|
||||
):
|
||||
# When chunked prefill is active, a batch cannot consume more
|
||||
# extend tokens than the current chunk budget. Use the smaller
|
||||
# value as the effective CP-specific grouping limit so the generic
|
||||
# max_prefill_tokens lift below does not advertise unreachable
|
||||
# capacity.
|
||||
self.cp_shared_kv_prefill_max_total_extend_tokens = min(
|
||||
self.cp_shared_kv_prefill_max_total_extend_tokens,
|
||||
max(self.rem_chunk_tokens, 0),
|
||||
)
|
||||
# extend tokens than the current chunk budget. If the CP-specific
|
||||
# limit is omitted, default it to the chunk budget; other CP bs>1
|
||||
# admission knobs keep their None == unlimited semantics.
|
||||
chunk_extend_limit = max(self.rem_chunk_tokens, 0)
|
||||
if self.cp_shared_kv_prefill_max_total_extend_tokens is None:
|
||||
self.cp_shared_kv_prefill_max_total_extend_tokens = chunk_extend_limit
|
||||
else:
|
||||
self.cp_shared_kv_prefill_max_total_extend_tokens = min(
|
||||
self.cp_shared_kv_prefill_max_total_extend_tokens,
|
||||
chunk_extend_limit,
|
||||
)
|
||||
self.cp_shared_kv_prefill_max_total_cached_tokens = (
|
||||
cp_shared_kv_prefill_max_total_cached_tokens
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user