Recommendation: Changes Requested
The 19ce4a7b refresh cleanly resolved all five Round-1 Subtract / Simplify items (TierStore::retired consolidation, filter_writeback_waiters unification, direct scalar Metrics::host_lookup_cost, Incoming::clear_pool_lookup, and helios/src/cache.rs + check.py cleanup) and rewrote the PR body into the charter's four-part format. Deeper system-level inspection confirms the core mechanisms (GPU midpoint half-width alias packing, pressure-aware eviction, O_DIRECT packed writes, clean L1 DRAM retention, clean manager arena buddy coalescing, and event-driven waiter wakeups) are sound—several upstream alarms (including a claimed spin loop in selene-manager's pump()) were verified false. One verified correctness bug carried over from Round 1 remains unfixed (RowRestoreLatency::start resets its decay clock on failed fetches, resurrecting stale latency spikes), alongside the Round-1 baseline/disclosure carry-over (5d53040e vs base 1fbcc3c9, no benchmark/CI report on 19ce4a7b, and three omitted compatibility items).
Merge Risk
Level: Medium
- Large cross-crate cache-core footprint (
+10,035 / -1,142across 41 files): Touches GPU VMM alias planning (helios/src/runtime_core/cache_memory.rs), scheduler eviction/pricing (helios/src/scheduler/), host offload/sharding/direct I/O (selene/), and manager arena/waiter scheduling (selene-manager/src/store.rs); core state-machine invariants are backed by unit/integration tests and debug assertions. - Wire, startup, and API compatibility surface: Adds rank-relay event code
Kind::StoreInvalidated = 4(selene/src/shard.rs:470, 484), fails startup cleanly on sub-page memory-only budgets (selene/src/offload.rs:706-712), separates committed vs reserved disk gauges (docs/api.md:390-394), and updatesHostStore::begin_lookup,TierStore::retired,TierStore::pending_pool_drain,HostHit, andStoreStats(selene/src/store.rs:100-103, 248-256, 377, 401-404, 433-440). - Concurrent PR overlap: Open PRs
#665(helios/src/cache.rs,docs/prefix-cache-offload.md(not opened)) and#659(helios/src/runtime_core/cache_memory.rs) modify the same regions; merge ordering should be coordinated.
Walkthrough
- Resident-aware lookup, diskless intake sizing & metric split (
helios/src/server/runtime.rs,metrics.rs,selene/src/offload.rs,pool/lookup.rs,pool/store.rs,disk_store.rs): Passes GPU-resident token offsets intobegin_lookupwith a once-per-episode stale-ticket reissue (runtime.rs:3210-3218), allocates zero local intake slots when local disk is disabled (offload.rs:676-680), separates ready on-disk records/bytes from uncommitted reservations (disk_store.rs:2784-2920), and exports per-levelflare_host_cache_pool_inbound_bytes_per_second{level}(metrics.rs:1409-1430). - L1 DRAM clean retention & non-blocking shutdown drain (
selene/src/memory.rs,composite.rs,pool/local.rs,pool/cascade.rs,pool/store.rs): Retainspersisted_in_poolrecords in L1 DRAM with invariant-checkedclean_slots/reclaimable_clean_slotstracking (memory.rs:923-1204) and narrows shutdown drain topending_pool_drain()(memory.rs:3517-3527,pool/store.rs:309-351). - GPU snapshot-alias packing, pressure eviction & restore pricing (
helios/src/runtime_core/cache_memory.rs,scheduler/cache_memory.rs,scheduler/checkpoints.rs,scheduler.rs,cache.rs,server/runtime.rs): Admits half-width alias planes with midpoint-ordered chunks and symmetric exponential+binary handle budgeting (runtime_core/cache_memory.rs:67-101, 240-367, 655-770), addsevict_for_pressure(scheduler/cache_memory.rs:593-649,scheduler.rs:1258-1291), and prices restores via read-onlyestimate_prefill_delta_ns(checkpoints.rs:441-490) paired withRowRestoreLatency(runtime.rs:257-344) while excluding row-only fetches from bulk bandwidth medians (memory.rs:1715-1743,disk_store.rs:3425-3434,pool/store.rs:376-379). - Direct compressed I/O, event-driven waiters, clean arena retention & offer coalescing (
selene/src/disk.rs,shard.rs,selene-manager/src/store.rs,arena.rs,pool/claims.rs): Writes compressed v4 records via alignedO_DIRECT+ exactset_lentruncation (disk.rs:848-876, 1271-1447), propagatesStoreInvalidatedacross sharded ranks (shard.rs:470, 653-734), replaces tick-polled put waits with coalescedWindowReleaseSignalwakeups (store.rs:5309-5365), epoch-tracked rotating waiter scans (store.rs:1588-1666), andfilter_writeback_waiters(store.rs:1443-1475), retains clean manager RAM extents viaArena::coalescing_block(arena.rs:163-200,store.rs:2246-2269), and resolves covered waiting offers directly toPresent(store.rs:1481-1523, 5792-5836).
Pre-merge Checks
- [PASS] Security / malicious screen: No credential handling, external exfiltration, or prompt-injection vectors found;
unsafeslice construction inselene/src/disk.rs:1277, 1321, 1404is bounded by caller-pinned slab/buffer lifetimes. - [WARN] Charter & value fit: Directly serves the prefix-caching goal, stays model-agnostic, and addresses
#451; however, Tables A–C still compare against5d53040e(4 commits behind1fbcc3c9, before#663and#667), benchmarks ran on7d7dcdcbrather than19ce4a7b, and three compatibility items remain undisclosed in the PR body (charter#210,docs/design-review.md(not opened) Principles 12 & 16). - [WARN] Related / duplicate / conflict check: Addresses open issue
#451(still un-updated with the midpoint half-width conflict-span conclusion); overlaps open PRs#665(helios/src/cache.rs,docs/prefix-cache-offload.md(not opened)) and#659(helios/src/runtime_core/cache_memory.rs). - [WARN] Tests & verification evidence: Unit/integration tests and
verification/helios-lifecycle/check.py:515-528mutation guard are updated and well-isolated, but no CI status is yet reported for the force-pushed head19ce4a7b, andphase_tests.rs:8799-8801misses theRowRestoreLatency::startfailed-fetch regression.
Blockers
- Fix
RowRestoreLatency::startresetting the decay clock on failed fetches (helios/src/server/runtime.rs:301-303, carry-over from Round 1):start()unconditionally overwritesbucket.last_median's timestamp (*last = now) whenever a prior median exists. When a row-only fetch fails synchronously (runtime.rs:3401-3407) or asynchronously (StoreEvent::Fetched { result: Err(_) }atruntime.rs:2825-2826),finish(&key, false)decrementsbucket.in_flightto0and returns early without callingobserve()(runtime.rs:313-315), leaving*last = now.- As a result, a historical slow spike that had already decayed toward zero via the 10 s half-life (
runtime.rs:342) jumps back to 100% ofmedianon every failed fetch, causingworth_restore()(runtime.rs:3346-3355) to reject healthy row-only restores for another recovery window. The existing test (helios/src/server/runtime/phase_tests.rs:8799-8801) only exercisesstart+finish(false)whenlast_medianisNone. - Fix: Delete lines
301-303(if let Some((_, last)) = &mut bucket.last_median { *last = now; }) inRowRestoreLatency::start()—estimate_seconds()already holdsmedianundecayed whilebucket.in_flight > 0(runtime.rs:339-341), andobserve()updateslast_medianon successful completion. Add a regression test inphase_tests.rsthat observes a median, ageslast_median, runsstart+finish(false), and asserts the decayed estimate is preserved.
Should Fix
- Re-verify baseline A/B against
1fbcc3c9(on19ce4a7b) and disclose remaining compatibility changes in the PR body (carry-over from Round 1; charter#210,docs/design-review.md(not opened) Principles 12 & 16):- Headline Tables A–C compare against
5d53040e, four commits behind PR base1fbcc3c9(#657,#666,#663,#667), where#663(8489d504) changes scheduler latency pricing directly affecting Tables B/C and#667(1fbcc3c9) changes GB10/multi-host peer exports; hardware runs were also executed on pre-refactor7d7dcdcbrather than19ce4a7b. Re-baseline the headline A/B against1fbcc3c9(or confirm no baseline shift from#663/#667), confirm green CI on19ce4a7b, and post the midpoint half-width conflict-span conclusion on#451. - Add concise bullets under Compatibility and Limitations for the three still-omitted changes: (a) new internal rank-relay event
Kind::StoreInvalidated = 4(selene/src/shard.rs:470, 484-485), requiring matching rank builds in multi-host TP deployments; (b) sub-page warm memory budgets without local disk now failing startup cleanly (selene/src/offload.rs:706-712); and (c) publicflare-selenetrait/struct updates (HostStore::begin_lookup,TierStore::retired,TierStore::pending_pool_drain,HostHit.pooled,StoreStatsreserved/rate fields atselene/src/store.rs:100-103, 248-256, 377, 401-404, 433-440).
- Headline Tables A–C compare against
Subtract / Simplify
- Deduplicate the "half the prefill" restore predicate (
helios/src/server/runtime.rs:225-229,selene/src/store.rs:450-468):worth_restore(transfer_seconds, prefill_saved_seconds)in Helios duplicates the0.5 *+is_finite()policy fromselene::worth_transfer, which now has only test callers left. Exposeworth_restoreinselene/src/store.rs, expressworth_transferthrough it, and delete the duplicate inhelios/src/server/runtime.rs. - Group
admit_with_host_store's 15 positional arguments (helios/src/server/runtime.rs:3285-3302): Remove#[allow(clippy::too_many_arguments)]by passing a small request-probe struct (spec,prefill_spans,conditioned_images,core_parameter_defs,core_parameters), which can also eliminate the duplicatePreparedImageInput::conditioned_inputmapping atruntime.rs:1722-1725and:3324-3327.
Nits
- Windows
write_packedbuffered fallback (selene/src/disk.rs:1408-1438, 1774-1784;eos/src/windows.rs:104-109):eos::windows::check_alignmentreturnsio::ErrorKind::Unsupportedwhen sector size does not divide 4096, whileis_direct_unsupportedreturnsfalseon#[cfg(not(unix))], making the buffered fallback atdisk.rs:1423unreachable on Windows. MatchingErrorKind::Unsupported | ErrorKind::InvalidInputin the non-Unix arm restores parity. - Per-level row-restore bucketing (
helios/src/server/runtime.rs:257-268,selene/src/pool/store.rs:465, 479-480):RowRestoreSourcekeys on(pooled, Tier), which isolates local DRAM from pooled/NVMe sources as intended, but poolsHostNvmeandRemoteNvme(andNeighbourGpuandHostDram) together. CarryingLevelonHostHitwould separate all four pool levels. - Positional pool level ordering (
selene/src/levels.rs:121-128,helios/src/server/metrics.rs:1418-1423):Ranking::rates()returns[f64; 4]positionally whilemetrics.rshardcodes the matching label strings. Co-locating a shared(Level, &'static str)constant prevents silent index drift.
Dropped on verification
- Correctness F1 (Unbounded self-rearming spin loop in
selene-manager/src/store.rs:5067-5072&selene/src/disk.rs:533-535) — False: Verified inselene-manager/src/store.rs:1319-1329,:1749-2078,:3478-3570,:1610-1666, and:1668-1738thatbegin_putandbegin_getnever leave or re-enqueue blocked operations inpending_puts/pending_gets(blocked puts move intoinflight_waitersorwriteback_waiters, or are rejected; expired waiters hit immediate rejection checks at:1387-1398/:1407-1414),writeback_wake_remainingstrictly decreases by up toWRITEBACK_WAKE_SCAN(32) per pump to0, andcontrol.rs:203-227processes up to 64 client commands per pump beforestore.pump().on_replyinselene/src/disk.rs:355-390, 533-535is only enabled byselene-manager(DiskThread::start_with_wakeup), not by clientDiskThread::start, and fires once per NVMe job completion. - Correctness F7 (
has_pending_reclaimpermanently blackholes keys inselene/src/disk_store.rs:2516-2518) — Speculative / misread design:DiskThreadis an in-process thread that always replies to submitted jobs, synchronous submission errors immediately applyTransportEvent::Unlinked(disk_store.rs:3209-3217), and a broken peer inShardedpoisons the whole transport (shard.rs:589-671). Blocking re-capture while an unlink/truncate of the deterministicrecord::file_name(&key)path is in flight prevents file-path races, andmaintenanceis bounded byMAINTENANCE_IN_FLIGHT. - Correctness F8 (Unchecked
-=oncommitted_records/committed_bytesatselene/src/disk_store.rs:2788-2792) — Low-signal: Consistent with all other exact accounting updates acrossdisk_store.rs(:2846-2863,:2911-2912,:3154), guarded bywas_readyandassert_disk_accounting()(:3565-3584). - Correctness F9 (Undocumented span shift in
Metrics::host_lookup_cost) — Low-signal: The histograms are explicitly namedflare_host_cache_estimated_transfer_nsandflare_host_cache_estimated_prefill_ns(docs/api.md:293-294) and have always recorded admission cost estimates rather than measured execution times. - Simplicity S1 (Delete
RowRestoreLatencyand reuseselene::levels::Rate) — Inaccurate:Rate(selene/src/levels.rs:36-87) ispub(crate)inflare-selene, tracks upward-recovering bytes/sec toward a finiteseed, and itsstarted()has the same unconditionallastoverwrite without per-keyin_flightduration tracking. Deleting 3 lines atruntime.rs:301-303is far simpler than exporting and generalizingRateacross crates. - Simplicity S3 (Remove
plan_refreshed: booland move refresh out ofbegin_pool_lookup) — Inaccurate: Verified athelios/src/server/runtime.rs:3183-3240, 3303-3315that the retry path does not refresh twice (begin_pool_lookupreturnstrueafter:3222, so:3307is skipped), andbegin_pool_lookupneeds the refreshedplan.resident_tokens()beforeawaits_pool()(:1625) to decide stale-ticket reissue (:3210) and lookup necessity (:3235). - Simplicity S4 (Drop
free.clone()andSome((0, 0))inArena::coalescing_block) — False: Verified atselene-manager/src/arena.rs:163-200andselene-manager/src/store.rs:2246-2269, 5346that (1)free.clone()is required because buddy simulation mutatesfreein place (:183-198), and (2)Some((0, 0))handles concurrentArc<Extent>release fromWindowHoldon Tokio pool threads betweenallocate()andcoalescing_block(), avoiding needless eviction of clean records. - Prior Round-1 items already resolved in
19ce4a7b(verified closed):TierStore::retired/retired_offeredmerge,filter_writeback_waitersdeduplication (includingclose_operations), scalarMetrics::host_lookup_cost,Incoming::clear_pool_lookup, andhelios/src/cache.rs+verification/helios-lifecycle/check.py:515-528cleanup.