Keep CP HiCache owner lanes padded for valid-tail victims

Load-back owner-lane eviction can need to evict a device-resident node whose radix value is a valid tail shorter than the physical tail page. The eviction planner now pads that value only to the page boundary before deriving owner counts, matching the existing write/load capacity contract without exposing padding to radix or scheduler lengths.

Constraint: CP HiCache capacity remains page-owner based while radix node values remain valid-token based.
Constraint: Avoid collectives; owner-lane capacity must be deterministic from local metadata and logical page ids.
Rejected: Require device-resident victim values to be page-aligned | valid-tail cache nodes are now an intentional supported state.
Rejected: Pad to cp_size pages | this would waste KV and violate the page-boundary-only contract.
Confidence: medium
Scope-risk: narrow
Directive: If split-inside-tail support is added later, preserve page ownership/refcount semantics before sharing one padded physical page across radix nodes.
Tested: local py_compile for hiradix_cache.py and touched CP HiCache tests.
Tested: remote g0034 new C8 exact tests: 3 passed, 3 warnings.
Tested: remote g0034 CP HiCache impacted suites: 146 passed, 5 warnings.
Tested: remote g0034 CP shared KV C1-C5 suite: 122 passed, 5 warnings.
Not-tested: full local pytest, blocked by missing runtime dependencies such as starlette.
Not-tested: CUDA E2E runtime for this commit.
Co-authored-by: OmX <omx@oh-my-codex.dev>
This commit is contained in:
laoyao0822
2026-05-29 05:39:25 +08:00
co-authored by OmX
parent 7cfc3c1324
commit 0043037f78
4 changed files with 104 additions and 7 deletions
@@ -656,6 +656,10 @@ Current state:
- HiCache capacity planning counts `page_size` tokens per owner page.
- Some entry points still pass scalar valid lengths or page-aligned-only
`device_indices`.
- `HiRadixCache._cp_load_back_node_owner_page_counts()` still rejects a
device-resident CP node whose `node.value` is a valid tail shorter than the
padded physical page span. This can break load-back owner-lane eviction when
the victim that should free a lane is a valid-tail node.
Correction:
@@ -670,6 +674,21 @@ Tests:
one page on owner 1.
- Target and draft required vectors must match when draft HiCache is enabled.
Implemented C8 slice:
- CP write admission derives required host capacity from the padded page owner
vector; a 100-token suffix on 64-token pages requires `(64, 64, 0, ...)`,
not a 100-token scalar and not CP-size padding.
- Target and draft admission share the same padded required vector; only their
available-capacity vectors differ.
- Host capacity snapshots count committed and pending valid-tail nodes by
`metadata.page_owners` / `metadata.padded_len`, so target/draft usage reflects
physical pages while `host_len` remains valid-token based.
- Load-back owner-lane eviction now pads a device-resident valid-tail victim to
its physical tail page before counting freed owner pages. A 6-token value on
4-token pages frees owner pages `(1, 1, 0, 0)` when it spans logical pages 1
and 2.
### C9. Draft/EAGLE currently has safe fallbacks, not the final contract
Current state: