Case file — PR #674 selene,selene-manager,helios: improve prefix-cache hit rate, L1 retention, NVMe throughput, and GPU snapshot packing
Head 7d7dcdc, base main (1fbcc3c9), open, ready for review, opened and last updated 2026-12-02, 40 files, +11,210 / −704, no labels, no comments, no reviews, CI on head: passed.
Key findings
- The benchmarks are against
5d53040e, not against the PR's own base. Every A/B table (A–F) in the body — capacity 1,946 → 4,864 snapshots, 370.5 → 1,054.8 MB/s, 66.56% → 83.23% hit tokens, the 284-request fault matrix — compares to5d53040e, while main's tip is1fbcc3c9(#667) and8489d504(#663),5c0d9c67(#666),e8a3a7c7(#656),a3c80e19(#657),cd1daa3e(#638) all sit in between. The body says only compile/tests were "re-verified on rebased HEAD7d7dcdcbatop1fbcc3c9"; no benchmark was re-run against the base. The charter explicitly asks for "an actual speedup overmainon a served workload" (#210). - The change partly reverses the author's own position on open issue #451, five days later. In #451 (
shieldstar, 2026-11-21) yatesdr replied that the alias-plane eligibility rule (helios/src/runtime_core/cache_memory.rs:38-42on main) is deliberate, that "the cost is KV capacity and prefix retention, not correctness", and "Whether admitting the wider planes would help is not established". #674 now admits half-width planes (largest == 2 * unit,helios/src/runtime_core/cache_memory.rs:67-85) plus midpoint chunk ordering (:245-289). #451 stays open and is not updated by the PR. - A second, concurrent PR rewrites the same eviction victim-ordering code: #665 (open, FujitsuPolycom, 2026-12-01, also rebased onto
1fbcc3c9) changeseviction_candidate_within_budgetinhelios/src/cache.rsanddocs/prefix-cache-offload.md; #674 renames it toeviction_candidate_with_prioritywith a caller-supplied priority closure (helios/src/cache.rs:656-718) and addspage_pressure_victim_priorityinhelios/src/scheduler/cache_memory.rs. Neither references the other; #665 also has an expected conflict with open #549 in the sameCheckpointfields. - Several real behaviours are absent from the description: a once-per-episode stale pool-lookup ticket refresh, a changed prefill-rate EMA measurement (the description says restores are priced "instead of wall-clock prefill EMA", but the EMA is retained as the cold fallback and its sampling conditions changed),
AdmissionPlannowClone+refresh_admission_plan_in_place,backing_conflictinensure_resources, new error/Retry semantics inselene/src/composite.rs, a new startup failure for a sub-page memory budget (selene/src/offload.rs:711-717), a new on-the-wire rank event kindKind::StoreInvalidated = 4(selene/src/shard.rs:470,484,654), a new 338-line CPU-only fixture test modulehelios/src/runtime_core/memory/codec_layout_tests.rs, and rewritten expectations inselene-manager/tests/client.rs(memory_records == 3instead of0). - Zero engagement. No comments, reviews, labels, or linked reviewers on a +11k-line change touching the project's cache core, opened the same day. Neighbouring PRs #665 and #655 drew discussion within a day.
- Strong in-repo test evidence for the mechanism, none for the numbers. The diff carries targeted tests for each behaviour (packing invariants, fixture-geometry page-exclusion bound, waiter wraparound,
O_DIRECTpacked writes, L1 clean retention, pressure eviction), but every throughput/latency/capacity figure in the body rests on the author's own SM120 4× RTX PRO 6000 runs with no logs or CI artifact.
The change
40 files, +11,210/−704, single squashed commit. Largest hunks:
| File | ± |
|---|---|
selene-manager/src/store.rs |
+3228/−90 |
selene/src/memory.rs |
+1223/−128 |
selene/src/disk.rs |
+1087/−55 |
selene/src/disk_store.rs (not opened) |
+1063/−70 |
helios/src/server/runtime/phase_tests.rs (not opened) |
+674/−9 |
helios/src/scheduler/cache_memory.rs |
+563/−5 |
selene/src/composite.rs |
+413/−20 |
helios/src/scheduler/checkpoints.rs |
+386/−17 |
helios/src/runtime_core/cache_memory.rs |
+354/−84 |
helios/src/runtime_core/memory/codec_layout_tests.rs |
+338 (new) |
helios/src/server/runtime.rs |
+314/−55 |
helios/src/server/metrics.rs |
+96/−3 |
docs/prefix-cache-offload.md / runtime-core-design.md / api.md |
+97/−31, +17/−7, +12/−3 |
selene-manager/tests/client.rs |
+160/−22 |
In plain terms, four independent threads:
- Lookup & intake — keep host/pool lookup alive when a deeper checkpoint extends a partly GPU-resident prefix; allocate zero local intake slots when local disk is off (
selene/src/offload.rs:681-685:required_intake = if directory.is_some() { target_intake_slots(...) } else { 0 }); split ready on-disk inventory from uncommitted reservations in metrics (helios/src/server/metrics.rs:311-313, 654-660, 1372-1385); new per-level pool restore-rate gauge (flare_host_cache_pool_inbound_bytes_per_second{level},metrics.rs:1408-1422). - L1 DRAM retention & drain — clean
persisted_in_poolrecords stay resident after handover, tracked by an explicitclean_slotscounter with a debug invariant (selene/src/memory.rs:353, 1060-1131); shutdown drain waits only on records still lacking handover; newcapture_headroom_slotsdecouples capture headroom from intake sizing. - GPU snapshot packing & pricing — half-width alias planes (
helios/src/runtime_core/cache_memory.rs:67-85), midpoint-ordered chunk placement (:245-289), rewritten symmetric exponential+binaryplan_mapping_handles(early return under limit,Layout: Clone), pressure-aware evictionevict_for_pressureinhelios/src/scheduler/cache_memory.rs, and host-restore pricing viaestimate_prefill_delta_ns(helios/src/scheduler/checkpoints.rs:441) with measured per-level rates plus a separateRowRestoreLatency(helios/src/server/runtime.rs:285-290, 3323-3354). - Manager storage — aligned whole-record
O_DIRECTfor compressed v4 (selene/src/disk.rsWriteRecord/WritePacked, buffered fallback onEINVAL), event-driven put waiters (writeback_waiters,inflight_waiters,WindowReleaseSignalatselene-manager/src/store.rs:5540-5579,WRITEBACK_WAKE_SCAN = 32rotating epoch scan at:1690-1760), clean-record retention in manager RAM with buddy-coalescing eviction (selene-manager/src/arena.rs:163coalescing_block), and coalescing of identical in-flight put offers.
What the description does not say (verified in the diff, see Key findings) — eight items listed there plus: docs are changed but the description's "What" list never mentions them; admission plan refresh, backing_conflict = snapshot_unavailable && !free_snapshots.is_empty() (helios/src/scheduler.rs:1258-1281), and the selene/src/composite.rs Retry(StoreReason::Slabs) path and reserve_capture → Ok(None) error are efficiency/semantics changes with no declared behaviour change.
What the description says the change does and the diff does less of — "instead of wall-clock prefill EMA": the EMA survives as the cold fallback and its measurement was altered, not removed.
The why
- Direct antecedent: #451 (open,
area:caching/area:memory, shieldstar, 2026-11-21) "Snapshot aliasing admits only the largest cache plane, so a snapshot excludes ~3.16x its own page cost" — 99,959 excluded pages over 1,055 snapshots (94.75/ckpt vs 30 own cost). The PR body cites "#451" as its motivation and recovers 3,527 pages / 451K tokens on DeepSeek-V4.1-Flash TP4. - The rest of the "why" is the author's own production-qualification issues #347, #348, #349 (GLM-5.3-Flash NVFP4/PCIe multi-GPU production serving) — GLM-5.3-Flash TP2 is the workload in every table.
- Lineage of the problem: host-cache intake sizing (#497 cut it 7.3 GiB → 1.0 GiB on GB10; #674 cuts to 0 without local disk), pool-only pass-through capture and shutdown drain (#455), shared-ancestor disk read coalescing and rate estimation (#496), ancestry/role/row model (#429, #415, #413), compressed v4 records (#504, #523/#524), and the plane-granule/handle-budget work (#473, #391).
- No user-filed bug report other than #451; no issue asks for L1 retention or event-driven waiters — those are self-initiated performance work.
Related work
- #451 (open issue) — the bug this fixes; reply now partly contradicted (see Key findings).
- #665 (open PR, FujitsuPolycom) — competing rewrite of the same victim-ordering function and the same doc sections; conflicting edit region in
helios/src/cache.rs; #665 also expects a conflict with open #549 onCheckpoint/PrefixCheckpointCachefields andFixture::{fork,key}, which overlaps #674's region too. - #659 (open, lukealonso) — same file
helios/src/runtime_core/cache_memory.rs(null continuation row aliasing onto a zeroed VMM granule); potential overlap with #674's chunk planning. - #655 (open, same author) — adjacent helios cost-retention change; see "Recent activity".
- Merged predecessors it builds on and partly reverses: #455 (pool-only pass-through,
begin_pool_drain,PooledStore::drain_memory— #674 keeps pass-through but adds a retaining warm-memory mode and narrows drain topending_pool_drain()), #497 (disk/offload intake sizing, direct-I/O opens), #496 (shared-ancestor fetch coalescing,inbound_samplessemantics; #674 adds row-only restore tracking and gates rate training on bulk page transfers), #429/#415/#413 (ancestry, retention roles, row model thatPoolHandover/handover_valid()depend on), #504 (lossless v4 compression whose write path is nowO_DIRECT). - #473/#391 (merged) — origin of the alias-plane rule and
RM_HANDLE_RANGEbudget thatplan_mapping_handlesrevisits. - #314 (open) also touches
cache_memory.rs(diffusion feature; unrelated scope). - No PR closes #451 — the description cites it but the issue is left open.
Recent activity
- Base
1fbcc3c9(#667, Luke Alonso, 2026-12-01: Orbit payload integrity, multi-deployment TP seams, GB10 page-cache release, multi-host peer exports) is the immediate parent; #674 is rebased on top of it. - #674's benchmark baseline
5d53040e(#628, own author, offload Copy Engine gating) is six main commits behind the base (#663, #666, #657, #656, #638, #667), several of them in the helios offload/serving surface being benchmarked. - #674 continues the author's 2026-11-29 hardening series in the same files: #612 (selene-manager multi-rank packed handling, on which
WindowReleaseSignal/coalescing_blocksit), #611, #610, #609 (selene disk-store, shard, composite, memory). a4720050(#625) touchedeos::map_host, the host-pool registration path #674's intake change feeds.- In helios, #674 builds on #568 (demand-recency victim ordering), #285 (prefill cost retention), #473 (
select_snapshots), #391 (RM_HANDLE_RANGE) without reversing them; its only reversal of a prior decision is the #451 plane rule.
People
- yatesdr (COLLABORATOR; Discord
D-Rockper the PR body): 82 merged PRs in 180 days (helios/src 36, docs 35, selene/src 32, selene-manager/src 25, tests 20), 11 closed, 4 open (#655, plus issues #347/#348/#349). Ownsselene/selene-manager(36 and 30 commits vs Luke Alonso's 6 and 3). - helios/src is Luke Alonso's area (236 commits vs yatesdr's 49); this is yatesdr's largest helios change and the first to touch runtime-core memory layout.
- Other owners in the touched files: FujitsuPolycom (#496, #497, and competing #665), original-el8 (#473), voipmonitor (#391, #286), PCCessna, Martin Vit.
- No reviewer engaged on #674.
Community
Nothing found. Zero comments, zero reviews, no reactions recorded, no labels. For comparison #665 (a day older) had 5 discussion entries and two Autobot reviews; #655 had 6 entries plus a community confirmation from nepenth on 2× GB10 (SM121).
Project fit
- Aligns: charter line 24 — "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene" is exactly this area; description follows the four-part shape (Why/What/Compatibility/Measured Results/Verification) the charter asks for; no per-model branches or new model-specific code paths (models appear only as measurement scope), so the "keep the runtime model-agnostic" rule (line 12) holds.
- Tension: charter "Bring real evidence… an actual speedup over
mainon a served workload (#210)" — the A/B is over5d53040e, not main's tip. - Tension: charter line 42 "Check interactions across every supported model, cache scheme, parallel layout, multi-host setup, and hardware target named in the docs" — the PR explicitly excludes multi-process packed puts (
kvc=gpu/kvc=cpuTP≥2 through the manager) and memory-limited GPUs, and reports no SM121/GB10 numbers although those are named targets (neighbour #497 measured GB10). - No non-goal crossed.
Claims and evidence
Backed by artefacts in the diff
- Intake 0 without disk:
selene/src/offload.rs:681-685;selene-manager/tests/client.rs:3332-3356andoffload_startup_and_restore_cover_every_tier_combinationupdated. - Metric split:
helios/src/server/metrics.rs:311-313, 1372-1385, 1838-1870, 2022-2036;tests/server/test_conditioned_input_cache.py:141-150now addsflare_host_cache_disk_reserved_bytesto its budget assertion (an existing Python test had to change). - L1 retention:
selene/src/memory.rs:1060-1131invariant + tests at:6020-6158,:7097-7234(pin/promote/fork/thin/blocked-ancestor); manager-sidewarm_dram_retains_clean_l1_copies_as_local_ancestors_and_drains_promptly. - Event-driven waiters:
selene-manager/src/store.rs:1690-1760scan, tests at:11819-11867, 11991-12010, 12444-12535;arena.rs:360-390. O_DIRECTpacked writes:selene/src/disk.rsWritePacked+write_packed_uses_direct_io_and_truncates_unaligned_v4_records.- Packing:
alias_plane/verify_physical_invariants/row_conflicts(helios/src/runtime_core/cache_memory.rs:101-110), andhelios/src/runtime_core/memory/codec_layout_tests.rs:190-465pinning deepseek41 @2 MiB to 4 eligible planes (1 before),expected_slots: 4_753, and "old 1-plane layout excluded 131,413 pages; midpoint-aligned 4-plane layout excludes <= 53,000 pages" — a CPU-side, GPU-free demonstration of the claim's direction. - Pricing:
estimate_prefill_delta_ns(helios/src/scheduler/checkpoints.rs:441) with 15+ unit tests at:4196-4473. - Pressure eviction: three new scheduler tests (zero-release skip, recency + role-preserving compaction, progress with only an overlapping pair).
Not backed in-repo: all of tables A–F (capacity 1,946 → 4,864; 5,917 → 2,390 backing pages; 2,151 store_skipped; 806.6/1,043.1/1,054.8 MB/s; 66.56% → 83.23% hit tokens; 0.5449→0.3907 s mean; the 284-request / 10-phase fault matrix incl. SIGKILL and chmod -R a-w; cross-node aarch64 TCP run; "5.1× faster than cold prefill"). No logs, scripts, or CI job referenced; single-machine, single-author measurement.
Test-count claims (selene 586; selene-manager 205 lib + 131 integration; helios runtime_core 191 / cache 44 / scheduler 419 / server 340; flare 246; check.py (not opened) --mutations 8/8; RUSTFLAGS="-D warnings" cargo check --locked --all-targets) are plausible given the added tests but were run on Linux only and cannot be re-derived from the diff.
Reach
- Users/operators: defaults change. Zero intake slots whenever local disk is off — less pinned RAM and faster init (claimed 12.7 s → 0.6 s), but different memory accounting (
flare_host_cache_intake_slots == 0) that dashboards/alerts keyed on intake may read as "broken". Documented inselene-manager/docs/operating.md:173-187anddocs/api.md:385-400. - Metric consumers:
flare_host_cache_disk_records/disk_bytesnarrowed to ready indexed records; newdisk_reserved_*gauges; newflare_host_cache_pool_inbound_bytes_per_second{level}; existingflare_host_cache_inbound_bytes_per_secondnow means the local store only.tests/server/test_conditioned_input_cache.pyneeded updating for this. - Compatibility: no Protobuf change, no core re-export; compressed v4 remains readable across
kvc=off|cpu|gpu; butselene/src/shard.rsadds an on-the-wire rank eventKind::StoreInvalidated = 4whose decoder rejects unknown codes, so mixed-version rank processes cannot interoperate. - Behavioural: after restart, local-disk reads bypass the kernel page cache (
O_DIRECTwithout page-cache population) — cold reads go to NVMe; manager RAM now holds clean records (memory footprint up: 220 MiB → 439 MiB in table B, by design). - Deployment scope: multi-process packed puts TP≥2 still unsupported by the manager protocol; memory-limited GPUs (GLM-5.3 TP2, 87.6 GiB weights) gain nothing from the packing change; no SM121/GB10/SM103 numbers.
- Documentation:
docs/prefix-cache-offload.md,docs/runtime-core-design.md,docs/api.md,selene-manager/docs/operating.mdall updated consistently — though the description omits docs entirely.
Process
Not a draft; "open, ready for review"; CI passed on 7d7dcdc; no reviews requested or given; no labels; one squashed commit; age under a day at case-file time. Two concurrent open PRs (#665, #659) touch the same helios files and one (#665) the same function, so merge order matters and no one has sequenced them.
Open questions / not found
- Whether the benchmarked gains hold against main's tip
1fbcc3c9rather than5d53040e— especially since #628 (the baseline commit) and #667 (the base) both change offload/peer-copy paths being measured. Not answerable from the repo. - Whether #451's open question ("do wider planes widen each snapshot's conflict range?") is answered: the diff asserts midpoint pairing does not widen any row's conflict span (
helios/src/runtime_core/cache_memory.rs:77-80) and addsrow_conflicts/verify_physical_invariantstests, but the issue thread is not updated and the assertion is not benchmarked against a conflict-pressure workload. - No SM121/GB10/SM103 evidence, although the charter names those targets and the closest neighbour (#497) measured GB10.
- No commentary at all from the helios area owner or any reviewer; no maintainer request or roadmap item is cited for the L1-retention, waiter, or
O_DIRECTthreads. - Discord handle
D-Rockis given in the body; no linked Discord thread found.