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
co-authored by OmX
parent 7e06eaebbf
commit 38532a1fc9
4 changed files with 80 additions and 0 deletions
@@ -415,6 +415,29 @@ class TestHiCacheArgs(CustomTestCase):
hicache_storage_backend="mooncake",
)
def test_cp_shared_kv_prefill_rejects_nixl_transfer_backend(self):
with (
self.assertRaisesRegex(
AssertionError,
"enable_nsa_prefill_cp_shared_kv.*disaggregation_transfer_backend.*mooncake",
),
patch.object(
ServerArgs,
"get_model_config",
side_effect=AssertionError("get_model_config should not be called"),
),
):
ServerArgs(
model_path="dummy",
enable_nsa_prefill_context_parallel=True,
enable_nsa_prefill_cp_shared_kv=True,
nsa_prefill_cp_mode="in-seq-split",
disaggregation_mode="prefill",
disaggregation_transfer_backend="nixl",
page_size=64,
enable_hisparse=False,
)
def test_hicache_io_backend_and_mem_layout_compatibility(self):
cases = [
{