Keep chunked CP prefills solo during bs>1 admission

Revert the tail-chunk co-batching gate from 54c056af because allowing a continued chunk to share the next CP bs>1 batch reopens the mixed chunk/page-tail scheduler risks we are currently avoiding. Keep the independent real-prefix budget accounting so chunked requests still contribute their carried prefix to CP cached-token and buffer estimates.\n\nConstraint: Chunked-prefill requests must remain solo until the CP split/page-tail contract is revalidated for mixed batches.\nRejected: Full revert of 54c056af | it would also drop true-prefix budget accounting and under-estimate cache/buffer pressure for admitted chunks.\nConfidence: high\nScope-risk: moderate\nDirective: Do not reintroduce tail-chunk co-batching without tests covering page-tail split, CP buffer admission, and ETE chunked+cache-hit replay.\nTested: Local py_compile for environ.py, schedule_policy.py, cp_shared_kv_compose.py, test_prefill_adder.py, test_cp_shared_kv_compose_v2_8rank.py.\nTested: Remote cjy-glm5-new PYTHONPATH=python pytest -q test/registered/unit/managers/test_prefill_adder.py -> 25 passed.\nTested: Remote cjy-glm5-new PYTHONPATH=python pytest -q test/registered/unit/mem_cache/test_cp_shared_kv_runtime.py -> 157 passed, 2 subtests passed.\nNot-tested: Full mixed replay with chunked-prefill traffic after service restart.
This commit is contained in:
laoyao0822
2026-06-13 01:28:35 +08:00
parent f290e1e35c
commit ee843a946b
5 changed files with 9 additions and 147 deletions
@@ -42,17 +42,11 @@ class _CpGroupShim:
def _build_scenario(rank: int, cp_size: int, device: torch.device):
"""bs=5 with mixed prefix/extend lengths, extends crossing page bounds.
The last request is CHUNK-SHAPED (large page-aligned carried prefix +
a tail-chunk-sized extend): with mix-chunked co-batching (plan doc S1)
a continued chunk is exactly such a (prefix, extend) pair to the CP
compose machinery, so this scenario byte-validates the mixed batch.
"""
"""bs=4 with mixed prefix/extend lengths, extends crossing page bounds."""
page_size = 64
prefix_lens = [640, 1280, 320, 640, 2048]
extend_lens = [95, 130, 64, 200, 512]
batch_size = len(prefix_lens)
batch_size = 4
prefix_lens = [640, 1280, 320, 640]
extend_lens = [95, 130, 64, 200]
kv_dim = 656 # fp8 layout bytes/token
from sglang.srt.mem_cache.cp_shared_kv_compute_owner import (