Prevent incompatible CP shared-KV transfer mapping

Mooncake is the only disaggregation transfer backend in this branch with CP shared-KV owner filtering plus logical-page-position destination selection. NIXL still slices destination pages by the original chunk slice, so allowing CP shared-KV prefill on NIXL can silently pair filtered prefill pages with the wrong decode pages.

This keeps the supported path narrow while preserving the page-aligned transfer contract: non-page-aligned valid tails transfer their physical tail page, but do not get padded to CP-size pages.

Constraint: CP shared-KV transfer remaps prefill logical pages to per-rank physical pages while decode metadata remains request-position based.

Rejected: Let NIXL continue through the generic slice path | it lacks logical-page-position selection and can silently corrupt CP shared-KV transfers.

Confidence: high

Scope-risk: narrow

Directive: Do not enable CP shared-KV on another PD transfer backend until its sender filters owner pages and selects decode pages by logical request-page position.

Tested: Local py_compile for server_args and touched tests.

Tested: Remote g0034 pytest test_cp_shared_kv_transfer_mapping.py test_req_to_token_pool.py TestHiCacheArgs: 22 passed, 8 subtests passed.

Not-tested: End-to-end PD transfer with a live non-page-aligned prompt.

Co-authored-by: OmX <omx@oh-my-codex.dev>
This commit is contained in:
laoyao0822
2026-05-29 05:53:37 +08:00
parent 7e06eaebbf
commit 38532a1fc9
4 changed files with 80 additions and 0 deletions

View File

@@ -917,6 +917,16 @@ class ServerArgs:
"hicache_storage_backend in the host-only CP HiCache stage. "
"Disable hicache_storage_backend or disable CP shared KV."
)
assert not (
self.enable_nsa_prefill_cp_shared_kv
and self.disaggregation_mode == "prefill"
and self.disaggregation_transfer_backend != "mooncake"
), (
"enable_nsa_prefill_cp_shared_kv with prefill disaggregation "
"currently requires disaggregation_transfer_backend='mooncake'. "
"Other backends do not implement CP shared-KV logical-page-position "
"transfer mapping yet."
)
def _handle_cp_hicache_layout_validation(self):
if not (