#1 [high] Change: size and file map of PR #694
PR #694 "selene,helios: add write-side NVMe and pool spill profitability gate", author yatesdr (COLLABORATOR), opened 2026-12-02, base main, head d74e810, state open/ready-for-review, labels: none, reviews: none, CI on head: passed (per orientation packet).
Size: 52 files, +22770/−3868.
- selene/src 23 files (+15357/−3030): store.rs (+170/−10), memory.rs (+5271/−2648), composite.rs (+3042/−78), disk_store.rs (+2049/−134), disk.rs (+1019/−57), pool/cascade.rs (+2762/−54), levels.rs (+14), shared/index.rs (+156), pool/store.rs (+89/−13), pool/local.rs (+51), pool/lookup.rs (+21), shard.rs (+16), geometry.rs (+6), offload.rs (+25), lib.rs (+3/−2).
- helios/src 17 files (+4127/−579): scheduler/cache_memory.rs (+1011/−83), server/runtime.rs (+370/−106), runtime_core/cache_memory.rs (+491/−132), scheduler/checkpoints.rs (+462/−68), server/metrics.rs (+158/−36), cache.rs (+151/−44), scheduler.rs (+118/−45), scheduler/sharing.rs (+57), plus tests (server/runtime/phase_tests.rs +1012/−63, runtime_core/memory/codec_layout_tests.rs +209).
- selene-manager/src 5 files (+2961/−159): store.rs (+2728/−146), pool/claims.rs (+143/−10), arena.rs (+85), control.rs (+1), pool/store_bridge.rs (+4/−3); selene-manager/tests/client.rs (+154/−43).
- docs 3 files (+149/−50): docs/api.md +12/−3, docs/prefix-cache-offload.md +114/−39, docs/runtime-core-design.md +23/−8; selene-manager/docs/operating.md +6/−4.
- verification/helios-lifecycle/check.py +10/−2; tests/server/test_conditioned_input_cache.py +6/−1.
Note: the PR body says "zero … selene-manager server … changes", but selene-manager/src is touched in 5 files (+2961/−159), including store.rs +2728. That is a discrepancy worth checking (may be inherited from #674 through the stack, or may be new in the top commit — pr_diff is unavailable because the local copy cannot resolve base commit c513e46a, so top-commit-only diff could not be computed).
#2 [high] Change: new profitability API in selene/src/store.rs (top commit vs #674)
Verified by comparing files at pr/694 (head d74e810) against pr/674 (parent branch head 831c47c7) — the tool resolves pr/<n> only for items in the local copy; pr/694 itself cannot be read (git cannot resolve base c513e46a) but individual files at pr/674 can, so the top-commit delta is diffable file-by-file.
New in the top commit (selene/src/store.rs):
StoreStats::spill_skipped_unprofitable: [u64; 2]andspill_skipped_unprofitable_bytes: [u64; 2], indexed[local_nvme, pool](selene/src/store.rs:261-265).StoreOutcome::Unprofitable(store.rs:275).PoolSpillPolicy { level: crate::levels::Level, rate_bytes_per_sec: f64 }withmaterially_differs_fromhysteresis: level change or >=5% rate change (vsother.rate.max(1.0)) (store.rs:278-293).TierStore::set_pool_spill_policy(Option<PoolSpillPolicy>)(store.rs:454-455),spill_eligible_pool(key)(456-459),persisted_in_pool(key)(460-463),record_is_packed(key)(464-467).HostStore::compacted(&mut self, _evicted: PrefixKey, _heir: PrefixKey)for heir lineage when a compacted heir was "unready or deferred" (store.rs:396-399).- Free functions:
standalone_spill_profitable(transfer_seconds, prefill_saved_ns)— returns true whenprefill_saved_ns == 0(gate disabled/unpriced), else reusesworth_restorei.e. transfer < 0.5*prefill (store.rs:526-534);fork_dedup_profitable(pages, child_paths, page_record_bytes, row_record_bytes)—pages>0 && child_paths>=2 && (child_paths-1)*pages*page_record_bytes > row_record_bytes(store.rs:536-550). - Existing
worth_restore(transfer, prefill)=transfer < 0.5 * prefill, false on non-finite (store.rs:494-500), unchanged from #674 (store.rs:449-455 at pr/674). Retirement::Moveddoc changed to say the warm L1 copy is acknowledged but not released on acknowledgment alone (store.rs:322-326).- New unit test
spill_profitability_predicates_and_policy_hysteresis(store.rs:593-638) with geometry-derived break-even examples: qwen38-tp1 (905,216 B page vs 122,014,720 B row → 18 children), deepseek41 (135,168 B page vs 3,043,840 B row → 4 children).
#3 [high] Change: NVMe write gate and dram_only shadow mechanics in selene/src/composite.rs
selene/src/composite.rs (local NVMe tier of CompositeStore, DRAM + Disk):
standalone_nvme_bytes(key,row) -> (disk_bytes, upload_bytes): both equallayout.record_bytes_for(total_pages,row)— uncompressed logical bytes, "matches CompositeStore::hit cold-restore pricing: both disk read and GPU upload charge uncompressed logical bytes" (composite.rs:569-577).spill_eligible_nvme(key,parent,row,prefill_saved_ns) -> (bool, disk_bytes):transfer_seconds = disk_bytes/disk_inbound_rate + upload_bytes/dram_inbound_rate(both rates floored at 1.0), thenstore::standalone_spill_profitable; if not profitable, falls back tofork_dedup_profitable(marginal_pages, child_paths, page_record_bytes, row_record_bytes)where marginal_pages = pages(key) - pages(parent) and child_paths = number of recordeddram_only_descendantsvoters (composite.rs:579-609).promote_dram_only(key): converts a skippeddram_onlyprefix intoparked+outboundso it is written to NVMe; clearssuppressed_fork_votes(composite.rs:611-656).record_dram_only_descendant(descendant,parent,offered): walks offered ancestors above the parent, for eachdram_onlyancestor computes marginal pages above nearest durable disk ancestor, canonicalizes voters viacanonicalize_voters, inserts the branch representative, and promotes whenfork_dedup_profitableholds (composite.rs:851-907).- On a skipped spill (
!eligible) the record is still indexed (so DRAM keeps a warm copy) viadisk.reserve_capture(...,/*?*/)thendram_only.insert(key)+memory.mark_durable(&key), and the skip is counted:stats.spill_skipped_unprofitable[0] += 1,..._bytes[0] += packed_write_bytes.unwrap_or(layout.record_bytes_for(tail_pages,row))(composite.rs:986-1035). store_excluding_reclaiming_dram_onlyloops onRetry(Budget), callingevict_blocking_dram_only_for_disk(protected)to reclaim blockingdram_onlyshadows (composite.rs:535-567, 528).- Stats are summed across the inner disk+memory stores (composite.rs:2284-2292);
set_pool_spill_policyforwards (composite.rs:2473).
#4 [high] Change: helios publication of prefill_saved_ns, compaction lineage forwarding, and metrics
helios side of the top commit (files verified at pr/694 head d74e810):
- Publisher:
helios/src/server/runtime.rs:2906-2924— for each publication,publication.prefill_saved_ns = self.scheduler.estimate_prefill_delta_ns(c, 0, c, false, &[], &[]).unwrap_or_else(|| ((c as f64 / self.prefill_rate.max(1.0)) * 1e9) as u64); i.e. full-prompt (0 → c tokens) GPU prefill delta, with a cold per-tokenprefill_ratefallback when the estimator has no measured capacities. Immediately afterwards it forwards GPU compaction lineage:for evicted in self.scheduler.compacted_ancestors(publication.id) { store.compacted(evicted, publication.key); }(runtime.rs:2922-2924). - Estimator:
helios/src/scheduler/checkpoints.rs:438-502estimate_prefill_delta_ns(prompt_tokens, resident_start, candidate_start, prompt_logprobs, prefill_spans, conditioned_inputs)— read-only pricing over prepared graph catalog +PrefillPredictor; returnsNonewhen capacities are unmeasured ("cold") or candidate <= resident. - Lineage source:
helios/src/scheduler/sharing.rs:137-156compacted_ancestors(id)walks up fromidcollecting compacted ancestors until it reaches an offered publication, dedups and sorts descending by consumed tokens. prefill_saved_nsis a new pub field onPublishedCheckpoint(selene/src/store.rs:42-45) and on indexNode<L>(selene/src/shared/index.rs:42-44), withprefill_saved_ns()/set_prefill_saved_ns()accessors (index.rs:76-78, 309-317) and0= unpriced/gate disabled.- New metrics in
helios/src/server/metrics.rs: statehost_spill_skipped_unprofitable: [AtomicU64; 2]and..._bytes(:287-288), populated fromStoreStatsinstore()(:632-635), rendered asflare_host_cache_spill_skipped_unprofitable_total{tier="nvme"|"pool"}andflare_host_cache_spill_skipped_unprofitable_bytes_total{tier=...}(:872-885), with a render unit test at :2050-2065. StoreOutcome::Unprofitableis handled in the store loop: it unpins without deferring and does not count as a retry success (runtime.rs:2940-2971); phase testunprofitable_store_outcome_unpins_without_deferring_and_populates_prefill_saved_nsat helios/src/server/runtime/phase_tests.rs:7117-7140.
#5 [high] Change: selene memory.rs pool gate (PoolCoverage, dram_only shadows, remove_nodes, cascade)
selene/src/memory.rs (top commit):
PoolCoverage { eligible, covered_pages, has_row_ancestor }cached per key inCore::pool_coverage, populated only whenpool_spill_policy.is_some()(memory.rs:341-352, 403-406, insert at 769-775).eval_node_coverage(memory.rs:1137-1171):has_row_ancestor = parent || node.row || persisted_in_pool;eligiblerequireshas_row_ancestorAND (memory_pool_standalone_profitableOR fork dedup:children >= 2 && fork_dedup_profitable(self_pages - parent_covered_pages, children, page_record_bytes, row_record_bytes)); covered pages propagate the node's own pages only when eligible or persisted ("anchor"), else the parent's — so nested forks credit only marginal pages above a covered ancestor; rowless unanchorable nodes are ineligible.memory_pool_standalone_profitable(memory.rs:429-444):prefill_saved_ns == 0→ true (unpriced); elsestandalone_spill_profitable(chain_bytes / policy.rate.max(1.0), saved_ns)withchain_bytes = layout.record_bytes_for(pages, row)(memory.rs:422-427).- Eviction accounting: when DRAM must free slots, announced-but-unpersisted records that are not profitable are pruned and counted
spill_skipped_unprofitable[1] += 1/_bytes[1] += record_bytes_for(tail_pages,row)(memory.rs:818-853, also 960-1053, 1804-1863). clean_slots(node)is O(1) (locally_evictable ? node.location.slots() : 0, memory.rs:1695-1701) with a maintainedreclaimable_clean_slotsfor spill mode (1703-1710) and debug/test invariant assertions (1712-1727, assert at 1680-1693).- Fork promotion in memory store when children >= 2 (memory.rs:1153);
set_pool_spill_policyat 1299, 4347. backfill_prefill_saved_ns(memory.rs:3694, composite.rs:810-825) fillsprefill_saved_nson records recovered from disk before republishing.- Batch removal:
selene/src/shared/index.rs:523remove_nodes(&mut self, keys: &[PrefixKey]) -> Result<Vec<Node<L>>>(single-pass bucket/child cleanup), testsremove_nodes_prunes_closed_batch_and_rejects_invalid_batch_atomically(index.rs:1542) andremove_nodes_prunes_flat_shared_bucket_in_one_pass(index.rs:1587). - disk_store.rs adds the matching top-down coverage computation for the standalone NVMe store (disk_store.rs:2218-2260,
covered_pages/has_row_ancestorthenfork_dedup_profitable), policy storage at 2174/2193/2210, skip counting at 3224-3225 and 3620-3621,set_pool_spill_policyat 4169. - pool/cascade.rs holds the pool-side gate tests and behaviors (cascade.rs:1191, 3178-3250, 3260, 3342-3371, 3402-3424, 3622-3785): unprofitable interior checkpoints skipped on homogeneous cascades, nearest chain-starting ancestor retained when a profitable rowless record cascades; only strip evidence is test comment lines such as
prefill_saved_ns: 5_000, // unprofitable: transfer ~4 us >= 2.5 us(cascade.rs:1220).
#6 [high] Related work and recent activity: searches, stacked parent, and unavailable git history
Attempted searches (search_items over PRs/issues, 30-day window) against the new terminology returned only #694 itself: "profitability spill unprofitable NVMe", "prefix cache hybrid attention recurrent state rows NVMe", "fork dedup shared prefix promotion", "worth_restore prefill pricing restore" (this last also surfaced #674, whose description mentions estimate_prefill_delta_ns + RowRestoreLatency). No separate issue or PR asks for a write-side spill profitability gate, and no issue tracks the "hybrid-attention recurrent row makes short prompts unprofitable to persist" problem. The problem is stated only in #694's own summary; the only prior art is #674 (same author, same day, stacked parent) and the restore-side pricing it introduced.
Issue #451 (GPU KV pages excluded under handle-count limits) belongs to #674, not #694; #694 inherits it through the stack.
Earlier same-author PRs on this exact code path (orientation packet related list): #429 "Link host-cache records under any offered ancestor, not only the nearest" (merged), #415 "Keep Selene rows by role and write pool records back on eviction" (merged), #413 "Link Selene pool puts to held ancestors and store each page once" (merged), #497 "Reduce disk offload restore latency…" (merged), #504 lossless KV compression (merged), #496 coalesced disk fetches (merged), #607/#610/#611 (merged, hardening), #665 (merged, helios scan-resistant dual-turnover eviction), #659 and #655 (open, same author). #674's own body names #665 (helios/src/cache.rs, docs/prefix-cache-offload.md) and #659 (helios/src/runtime_core/cache_memory.rs) as editing the same regions as the stack, so that merge-order coordination carries over to #694, which touches both files.
items_touching/related_items/search_history are unusable here: the local copy is missing objects (Could not read c513e46a…), so no commit-level "recent activity" data could be gathered; the orientation packet records the same failure for every area.