Repository navigation
Fix TP16 host prefix records and retain deep DRAM prefixes - #264
Conversation
Version 1 and 2 record headers cannot describe the Kimi TP16 geometry: sixteen ranks with 768 planes require 6513 bytes, exceeding the fixed 4096-byte header block and rejecting every host-cache publication. Add record format version 3 with u32 plane sizes, reducing that header to 3441 bytes without changing segment offsets. Preserve version 1 and 2 decoding and byte-identical rewrites, keep version metadata out of semantic header equality, and reject plane sizes that do not fit the new encoding. Keep redundant interior rows while the DRAM pool has more than two row slots of headroom. Resume eager row thinning automatically under real memory pressure so deep-prefix restore does not trade unbounded DRAM growth for retention. Update retention tests to cover direct deep-endpoint restores and pressure behavior. Log host-store submission and completion errors instead of silently discarding their causes. Validation: all 393 Selene unit tests pass. Native TP16 store/drain and DRAM restore tests show zero I/O errors and a complete 153295-token prompt reused as 132593 GPU tokens plus 20702 host-restored tokens with zero new prefill. Those service tests used the db29 C1 diagnostic package. A separate C4 long-request CUDA_ERROR_ILLEGAL_ADDRESS remains under investigation and is not covered by this commit. Previous-core serving beyond signed package inspection was not separately revalidated. Design-Signed-Off-By: Kimi (Kimi); design-review=cfcf Co-Authored-By: Kimi <noreply@anthropic.com>
Reserved transfer intake made the row-thinning threshold unreachable during ordinary retention pressure. Reclaim eligible redundant rows using free warm slots, and do so before incoming allocations evict reusable endpoints. Remove queued thinning keys with removed or compacted records so bookkeeping remains bounded by the resident index. Pinned rows remain protected. Record validation used the v3 size limit even for decoded legacy headers, and cross-rank agreement hashed wire versions despite semantic equality. Validate the stored encoding, retain lossless legacy writes for wide planes, select valid legacy replication versions, and hash a canonical encoding for rank agreement. Existing record bytes remain stable when rewritten without semantic changes. Update the cache format and retention documentation. These changes preserve usable endpoints under pressure and keep equivalent records from being rejected across format versions. Metadata-only tests cover 4 GiB planes, byte-exact rewrites, replication flags and mixed-format agreement. Pressure tests cover intake reserves, multi-slot rows, larger incoming records, pins and repeated chain removal. All 401 Selene tests and the CLI cargo check pass. No GPU or end-to-end serving test was run during this review. Design-Signed-Off-By: Codex GPT-6; design-review=cfcf Signed-off-by: Martin Vit <martin@voipmonitor.org>
|
I reviewed this after merge, against the rest of Selene, assuming every process runs the new binaries. I found no correctness problems: v3 encode/decode, rank agreement, pool announcements, replicated records, pins and readiness all look right, and I found no path that frees a row while something is reading it. Two things don't do what the PR intends. 1. CI: the selene-manager header test now fails
The manager itself handles v3 correctly; only the expected bytes are stale. The validation in the description ran 2. Memory + pool: proactive retirement runs before row thinningThe PR intends to "reclaim redundant rows before an incoming allocation needs to evict other records." On the store path that holds:
So whenever A minimal fix keeps the store-path ordering in poll: if self.core.spill {
let need = self.reserve(2 * self.core.pool.intake_slots());
if need > 0 {
self.core.thin_rows_for(usize::MAX); // reclaim redundant rows first
self.core.retire_for(self.reserve(2 * self.core.pool.intake_slots()));
}
}A regression test would be a standalone spill store with a three-record chain and free slots in that band. Assert that Paths this doesn't touch
|
Composite and disk stores eagerly removed redundant parent rows even with retention headroom. A single child does not establish that its parent's endpoint is unused: a later conversation branch can still resume there. MemoryStore already keeps such rows until pressure (NVIDIA#264, NVIDIA#302). Reclaim eligible rows in least-recently-used order under retention or incoming-allocation pressure, stopping once headroom returns, and do it before disk maintenance hands any leaf to the pool (leaves already held for handover count toward the target). A composite spill is lossless (the row goes to disk with the record), so it does not thin first; rows are reclaimed where an allocation needs room. Share candidate ordering and free-retention calculations with MemoryStore, queue restored memory rows, and remove queued keys at every removal site (as MemoryStore does), so the queue holds only resident records. Keep the NVIDIA#336 BACKLOG / 2 cap on in-flight truncates; at the cap, make_room can evict a whole record before reclaiming further rows. Parent endpoints stay reusable while space remains, and colder redundant rows go before any other record under pressure. The disk tier now writes the row of every spilled parent, which costs write bytes up front and a truncate later under pressure. Six regressions fail without the change and pass with it: rows kept with headroom and reclaimed in access order under pressure (composite and disk), rows reclaimed before disk maintenance retires leaves, and the thinning queue holding only resident records after expiry, eviction, discard and retirement (composite and disk). The composite, disk-store and memory modules pass on Linux. Not tested: GPU serving with a branching workload. Design-Signed-Off-By: yatesdr; design-review=ed22
persisted_header_matches_the_descriptor_layout has failed on main since #264 moved record headers to version 3: the manager now encodes version 3, and the test still compared the encoding with the version 1 fixture. Add a version 3 fixture and compare the encoding with it. Keep the version 1 fixture to check that a header written before #264 still decodes to the same header, and keep its invalid-field checks. On cn4 (Linux, x86_64) the manager's record tests pass; before, this test failed with a version byte of 3 against 1. Design-Signed-Off-By: yatesdr; design-review=1af4
Why
Host checkpoint publication fails when the rank/plane catalog exceeds its fixed 4 KiB header. With sixteen ranks and 48 planes per rank, the
u64plane-size format needs 6,513 bytes. Compact plane sizes can represent that geometry without changing payload offsets or truncating values.The DRAM cache also discarded interior continuation rows even with ample retention space. Keeping those rows allows deep-prefix rewinds to restore an endpoint directly. Pressure handling must exclude reserved transfer intake and reclaim redundant rows before evicting useful endpoints.
Changes
u32plane sizes and unchangedu64row sizes. The sixteen-rank, 48-plane header occupies 3,441 bytes. Fresh geometries with a plane larger thanu32::MAXretain the losslessu64encoding; every encoding still has to fit the fixed header block.Result and compatibility
The compact format permits the TP16 geometry to be published. Retained continuation rows can avoid replay from an earlier endpoint, while pressure reclamation preserves the transfer reserve and bounded retention budget. These behaviors are implemented and qualified by CPU record, store and recovery tests; no inference-speed improvement is claimed.
Versions 1 and 2 remain readable, including their previously supported wide-plane geometries. Version 3 is not readable by older binaries: their recovery logic treats unsupported record versions as invalid and deletes them, so downgrading loses those cached checkpoints. Model-core format, graph export and model arithmetic are unchanged.
Validation
Review validation on the corrected branch, without GPU or end-to-end execution:
cargo check --locked --manifest-path flare-cli/Cargo.tomlpassed. Its unused-method warning concernsdominates_padding, outside this change.git diff --checkpassed. Repository-wide formatting differences outside this change were not rewritten. The existing unreadable-file test bypasses its permission check when run as root.Reproduce from the repository root:
cargo test --locked --manifest-path selene/Cargo.toml --lib cargo check --locked --manifest-path flare-cli/Cargo.tomlEarlier serving evidence reported for the submitted implementation, not rerun for these corrections:
🤖 Generated with Claude Code