Opened by a workflow run, Dec 2, 2026 3:25 AM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: yatesdr (COLLABORATOR; owns selene/selene-manager, 82 merged PRs in 180 days; Discord D-Rock)
Motivation: Selene/Helios prefix caching loses work in four places: partly GPU-resident prefixes skip deeper pool lookups while unused pinned host intake RAM is reserved even with no local disk, clean L1 DRAM copies are dropped at pool handover, GPU snapshot-alias packing excludes far more KV pages than a checkpoint costs under CUDA handle limits, and manager writes are buffered, poll-timed and evicted too eagerly. This PR addresses all four together.
Scale: +11,210 / −704 lines in 40 files
Proposal:
- Keep host/pool lookup for partially resident prefixes; zero intake slots without local disk; split ready vs reserved disk metrics; add per-level pool restore-rate gauge.
- Retain clean
persisted_in_poolrecords in L1 DRAM (clean_slotsinvariant) and drain without blocking shutdown. - Half-width snapshot-alias planes + midpoint chunk ordering + symmetric handle budgeting; pressure-aware GPU eviction; price restores by prefill-delta estimate and measured pool rates instead of wall-clock EMA.
O_DIRECTcompressed v4 writes, event-driven put waiters with epoch-tracked rotating scan, clean-record retention in manager RAM, coalesced in-flight put offers. Touches:selene-manager/src/store.rs(+3228/−90): waiter/arena retention/coalescing — largest, riskiest change.selene/src/{memory,disk,disk_store,composite}.rs(+~3,800): L1 retention, direct I/O, store outcomes, plus a new on-the-wireStoreInvalidatedrank event.helios/src/{runtime_core,scheduler}/cache_memory.rs+cache.rs(+~1,000): alias planes and eviction ordering, the area Luke Alonso owns. Related items:- #451 Snapshot aliasing admits only the largest cache plane (open): the bug this fixes; the PR partly contradicts the author's own reply there.
- #665 helios: scan-resistant dual-turnover prefix cache eviction (open): concurrent rewrite of the same
eviction_candidate_within_budgetand docs; likely textual conflict. - #659 perf(helios): alias null continuation row (open): same runtime-core file.
- #455 Capture single-process prefix checkpoints and drain DRAM on shutdown (merged): its drain/pass-through semantics are revised here.
- #497 Reduce disk offload restore latency and integrated-memory intake overhead (merged): prior intake sizing and direct-I/O work that #674 extends.
Link: https://github.com/NVIDIA/hyperflare-inference/pull/674
Autobot comments: Every benchmark (A–F) compares against
5d53040e, six main commits behind the PR's own base1fbcc3c9, so the charter's "speedup over main" evidence is not apples-to-apples; only compile/tests were re-verified after rebase. Several behaviours are undeclared: once-per-episode pool-lookup ticket refresh, a changed (not removed) prefill EMA,kind=4 StoreInvalidatedon the rank wire protocol (breaks mixed-version ranks), a new sub-page memory startup error, new composite-store Retry semantics, a new 338-line fixture test, and rewrittenselene-manager/tests/client.rsexpectations (memory_records == 3, was 0). Zero comments or reviews so far.
Classify intake
Selected: triage:review, performance, area:caching, area:memory, area:selene
Threshold: 65%
Triage
- [✓]
triage:review: 87.7% -
triage:validation: 8.2% -
triage:design-review: 3.9% -
triage:investigate: 0.2% -
triage:integration: 0.1% -
none: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 99.8% -
priority:P1: 0.2% -
priority:P2: 0.0%
Type
- [✓]
performance: 99.6% -
enhancement: 62.2% -
community: 53.1% -
duplicate: 34.9% -
bug: 22.3% -
documentation: 0.0%
Area
- [✓]
area:selene: 98.8% - [✓]
area:caching: 96.7% - [✓]
area:memory: 83.5% -
area:api: 32.1% -
area:scheduling: 29.4% -
area:preparation: 22.3% -
area:engram: 0.4% -
area:rocenante: 0.2% -
area:kernels: 0.1% -
area:orbit: 0.1% -
area:packaging: 0.0%
Model
-
model:qwen3.8-flash-next: 2.9% -
model:deepseek-v4.1: 2.3% -
model:deepseek-v4: 2.0% -
model:glm-5.3: 1.0% -
model:muse-glimmer: 0.6% -
model:qwen3.8-27b: 0.4% -
model:kimi-k3.1: 0.3% -
model:nemotron-3.5-bolt: 0.2% -
model:mimo-v2.6: 0.2% -
model:inkling-small: 0.0% -
model:gemma4: 0.0%
Value Proposition
Value Proposition — PR #674
1. Charter alignment — strong
Prefix caching is an explicit goal (charter: "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene"). The change stays inside that layer, keeps the runtime model-agnostic (models appear only as measurement scope, no per-model branches), crosses no non-goal, and follows the required four-part description shape. It also addresses a charter-qualifying item: open, reproducible issue #451. The one real tension is the evidence rule (#210): every A/B table compares against 5d53040e, six commits behind the PR's own base 1fbcc3c9, with #628 and #667 both touching the offload/peer-copy paths being measured. No benchmark was re-run against main's tip.
2. Novelty & status — additive, with overlap
Not obsolete: nothing on main fixes #451. Not superseded: no PR closes #451. #665 rewrites the same victim-ordering function and doc sections; #659 touches the same cache_memory.rs region. All three are open with no merge order agreed, so sequencing matters. Partial overlap, not duplication.
3. Value vs maintenance cost — real value, heavy cost
Beneficiaries are clear: Selene operators, multi-instance traffic, and handle-limited large-KV-budget deployments. Mechanism evidence in-repo is genuinely good — packing invariants, the GPU-free codec_layout_tests.rs showing 1 → 4 eligible planes with excluded pages ≤ 53,000 vs 131,413, waiter wraparound, O_DIRECT packed writes, L1 clean retention, pressure eviction. What is missing is the numbers: tables A–F, the 284-request fault matrix, and the cross-node aarch64 run have no logs, scripts, or CI artifacts.
Against that: +11,210/−704 across 40 files in the cache core, in helios/src — Luke Alonso's area (236 commits vs 49) and the author's first touch of runtime-core memory layout — with zero comments, reviews, labels, or reviewers. The description also omits material behaviour: a new on-the-wire rank event Kind::StoreInvalidated = 4 (mixed-version ranks cannot interoperate), metric-semantics changes that already forced an existing Python test to change, a new sub-page budget startup failure, and "instead of wall-clock prefill EMA" when the EMA is retained as the cold fallback. It quietly reverses the author's own #451 reply without updating that issue, and reports no SM121/GB10/SM103 data despite those being named targets.
4. Conditions
Re-run the headline A/B against 1fbcc3c9 or later with attached logs; split or at least sequence the four threads (land lookup/intake/L1 retention separately from helios packing/pricing); reconcile with #665/#659 and update #451; declare the undeclared behaviours and add SM121/GB10 evidence or scope it out explicitly.
Verdict
Worth it with changes — charter-central, additive, and fixes an acknowledged open bug with test-backed mechanisms; but the performance claims must be re-baselined against main, scope reduced or sequenced against #665/#659, and the undeclared behaviour changes stated before this +11k-line cache-core change can be maintained responsibly.
Apply Labels (Intake)
Applied: +triage:review, +performance, +area:caching, +area:memory, +area:selene Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.
Subtraction and simplicity
Subtraction/Simplicity lens on PR #674. The diff is large but mostly additive tests and mechanism; five places carry duplication worth collapsing before merge, and none of them is a correctness finding.
- helios/src/cache.rs:680-709 — the cost ladder in
eviction_candidate_with_priorityrestatesprotected_eviction_tokens(:635-644) three ways (if role_preserving {0} else if child_count != 0 {...} else { let tokens = ...; tokens }); reduce toif role_preserving { 0 } else { self.protected_eviction_tokens(node, rank) }, and makeis_role_preserving_compaction(:646) private — it has no caller outside cache.rs. - selene/src/store.rs:433-444 —
retired+retired_offeredare one trait method with bidirectional forwarding (memory.rs:3612-3626, pool/local.rs:122-137 override both); collapse to a singleretired(..., offered: &[Retiring]). - selene-manager/src/store.rs — the writeback cursor fixup is copy-pasted 6× (:1586-1593, :1743-1754, :1759-1768, :1851-1857, :4163-4167, :4240-4242); one helper owns it.
- selene/src/disk.rs:355-390 — the PR adds two constructors (
start_with_wakeup,start_with_faults_and_wakeup) over the existingstart/start_with_faults, four entry points for one optional callback; collapse to two. - helios/src/server/runtime.rs:1800-1802, 2614-2616, 3030-3032, 3044-3046, 3076-3078 — the four-field pool-lookup reset is written five times;
Incoming::forget_pool_lookup()removes it and makespool_lookup_reissuedimpossible to leave stale.
Minor: selene/src/levels.rs:119-127 + helios/src/server/metrics.rs:1408-1422 keep the same level ordering in two positional arrays; selene/src/offload.rs:233-240 needs if retention_slots == 0 { return 0 } only to defeat its own .max(1).
Already lean: intake sizing deletes a branch, the metric split reuses existing render machinery, refresh_admission_plan_in_place avoids a clone, arena buddy eviction is one self-contained method, and no dead code or env/config switches were added (AGENTS.md:188-193 respected). Open questions: whether AGENTS.md:188-193 covers the new on_reply callback surface; whether #665's competing rewrite of eviction_candidate_with_* lands first.
Correctness and contracts
Correctness/contract review of #674 (head 7d7dcdc, base 1fbcc3c9). Four of the mechanisms hold up under inspection (read-only prefill-delta estimator, stale-ticket handling, clean_slots invariants, pressure priority keeping retention_rank ordering); the defects are in pricing/telemetry spans and two undisclosed behaviour changes.
- Major — the prefill-rate EMA was changed, not replaced as claimed: main sampled every prefill submission and summed all prefill lanes with a wall-clock span (runtime.rs main:2670-2689, :2985); the PR samples only single-lane, ≥50%-full prefills (runtime.rs:2793-2802) and times them with GPU-only
observed_duration_nswhen queued (:3110-3114). The EMA remains the cold fallback (:3335), so it can be trained from a non-representative subset or never at all. - Major — memory-only prefix cache below one page record now refuses to start (selene/src/offload.rs:681-685, :707-717), and
intake_warningcan never fire again when no disk (required_intake == 0). - Major —
flare_host_cache_transfer_nsbecomes a per-source latency median for row-only restores and the prefill histogram gets fabricated 0 ns when the delta is zero (runtime.rs:3402-3415 into metrics.rs:538-560). - Minor —
RowRestoreLatencydecay is suspended whilein_flight > 0(runtime.rs:341); a lostStoreEvent::Fetchedpins that tier's estimate forever. - Minor — undisclosed on-the-wire
Kind::StoreInvalidated = 4(selene/src/shard.rs:465-485) despite "no schema changes"; mixed-version ranks cannot decode it. - Minor — packing guarantee is
#[cfg(test)]-only (runtime_core/cache_memory.rs:101, :122) and handle planning rebuilds/sorts layouts per search step. - Minor — zero-progress eviction (scheduler/cache_memory.rs:648-662) lets
ensure_resources' unbounded loop (scheduler.rs:1258-1285) spin when everything is pinned. - Claims — every A/B table is against 5d53040e, six commits behind the base, so charter #210 (speedup over
main) is unevidenced; docs changes, the wire event, the new startup error andbacking_conflictare absent from the description; #451 stays open.
Open: whether the gains survive on 1fbcc3c9; no SM121/GB10/SM103 numbers; no reviewer engagement.
Final review
Recommendation: Changes Requested
The four prefix-cache subsystems in PR #674 are technically sound, well-tested (CI green on 7d7dcdc with 8/8 TLA+ models and mutation guards passing), and free of verified correctness or concurrency blockers; our deep-dive confirmed that several upstream candidate alarms (including an alleged eviction spin loop and metric unit mismatch) were false. However, a small decay-clock reset bug in RowRestoreLatency::start on failed fetches, missing PR-description disclosures for real behavior/wire changes, and A/B benchmarks measured against 5d53040e (four commits behind base 1fbcc3c9, before #663 and #667) should be addressed before merging this +11.2k-line cache-core change.
Merge Risk
Level: Medium
- Large cross-crate cache-core blast radius (+11,210 / −704 across 40 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), though every core invariant is backed by targeted unit/integration tests and debug assertions. - Operator-visible metric, startup, and wire-event behavior changes:
flare_host_cache_intake_slotsdrops to0without local disk, sub-page memory-only budgets now fail startup cleanly (selene/src/offload.rs:711-717),flare_host_cache_disk_{records,bytes}excludes uncommitted reservations (requiringtests/server/test_conditioned_input_cache.py:144-149to update), andselene/src/shard.rs:470,484adds rank-relay event codeKind::StoreInvalidated = 4. - Concurrent PR overlap: Open PRs
#665(helios/src/cache.rs,docs/prefix-cache-offload.md) and#659(helios/src/runtime_core/cache_memory.rs) edit the same regions; merge order should be coordinated.
Walkthrough
- Resident-aware lookup, zero diskless intake & metric split (
helios/src/server/runtime.rs,helios/src/server/metrics.rs,selene/src/offload.rs,selene/src/pool/store.rs,selene/src/disk_store.rs): Forwards GPU-resident token offsets on pool lookups with a once-per-episode stale-ticket refresh (runtime.rs:3227-3243), allocates zero local intake slots when local disk is disabled (offload.rs:681-685), splits ready disk inventory from uncommitted reservations (disk_store.rs:2788-2929), and exports per-levelflare_host_cache_pool_inbound_bytes_per_second{level}(metrics.rs:1408-1422). - L1 DRAM clean retention & non-blocking drain (
selene/src/memory.rs,selene/src/composite.rs,selene/src/pool/store.rs): Retainspersisted_in_poolrecords in L1 DRAM with invariant-checkedclean_slots/reclaimable_clean_slotsaccounting (memory.rs:1060-1121), decouples capture headroom from disk streaming intake (offload.rs:233-240), and narrows shutdown drain topending_pool_drain()(pool/store.rs:309-313). - GPU snapshot-alias packing, pressure eviction & restore pricing (
helios/src/runtime_core/cache_memory.rs,helios/src/runtime_core/memory.rs,helios/src/scheduler/cache_memory.rs,helios/src/scheduler/checkpoints.rs,helios/src/cache.rs): Admits exact half-width alias planes with midpoint-ordered chunks and symmetric exponential+binary handle budgeting (cache_memory.rs:67-85, 248-319, 654-777), addsevict_for_pressure(scheduler/cache_memory.rs:615-670), and prices restores via read-onlyestimate_prefill_delta_ns(checkpoints.rs:441-481) paired with per-tierRowRestoreLatency(runtime.rs:285-351). - Direct packed NVMe writes, event-driven waiters, clean arena retention & offer coalescing (
selene/src/disk.rs,selene/src/shard.rs,selene-manager/src/store.rs,selene-manager/src/arena.rs,selene-manager/src/pool/): Uses 4 KiB-alignedO_DIRECTwhole-record writes with exactset_lentruncation (disk.rs:848-949, 1353-1478), propagatesStoreInvalidatedacross sharded ranks (shard.rs:470, 650-735), replaces tick-polled put waits with losslessWindowReleaseSignal+ epoch-tracked rotating waiter scans (store.rs:1690-1776, 5277-5281, 5540-5620), retains clean manager RAM extents evicted via buddycoalescing_block(arena.rs:163-200,store.rs:2445-2480), and coalesces matching in-flight put offers.
Pre-merge Checks
- [PASS] Security / malicious screen: No credential handling, external network exfiltration, unsafe bypasses, or prompt-injection issues found;
unsafeslice construction inselene/src/disk.rs:878,1429is bounded by caller-pinned slab/input lifetimes. - [WARN] Charter & value fit: Strongly aligned with the prefix-caching goal, model-agnostic, and fixes open issue
#451; however, A/B tables A–C compare against5d53040e(4 commits behind base1fbcc3c9, before#663and#667), and several behavior changes are omitted from the PR description (charter #210 /docs/design-review.mdPrinciples 12 & 16). - [WARN] Related / duplicate / conflict check: Directly addresses
#451(issue still open and un-updated); overlaps open PRs#665(helios/src/cache.rs,docs/prefix-cache-offload.md) and#659(helios/src/runtime_core/cache_memory.rs) with no agreed merge sequence. - [PASS] Tests & verification evidence: CI passed on
7d7dcdc,verification/helios-lifecycle/check.py --mutations(8/8 TLA+ models + Rust mutations) passed, and new CPU/unit/integration tests cover each mechanism without process-global state leaks; SM120 GPU tables A–F are author-reported without attached raw logs.
Blockers
None.
Should Fix
- Re-baseline headline A/B evidence against
1fbcc3c9and disclose omitted behavior changes in the PR description (docs/design-review.mdPrinciples 12 & 16; charter#210):- A/B tables A–C compare against
5d53040e, which is 4 commits behind the PR base1fbcc3c9(#657,#666,#663,#667, with#663touching scheduler waiting-age pricing and#667touching Orbit/GB10/multi-host peer exports; Table F was run on7d7dcdcb). Re-verify the headline A/B against1fbcc3c9(or confirm#663/#667caused no baseline shift) and update#451with the midpoint half-width conflict-span conclusion. - Add explicit disclosure to the PR body for: (a) sub-page warm memory budgets without local disk now failing startup (
selene/src/offload.rs:711-717), (b) the new rank-relay wire eventKind::StoreInvalidated = 4(selene/src/shard.rs:470,484) requiring matching rank builds in multi-host TP deployments, (c) retention and narrowed sampling of the fallbackprefill_rateEMA (helios/src/server/runtime.rs:2793-2803, 3110-3115, 3334-3335) rather than complete removal, (d) once-per-episode stale pool-lookup ticket refresh (helios/src/server/runtime.rs:3227-3243), and (e) the documentation updates indocs/andselene-manager/docs/operating.md.
- A/B tables A–C compare against
- Prevent
RowRestoreLatency::startfrom resurrecting a decayed latency median on failed fetches (helios/src/server/runtime.rs:302-304):start()unconditionally overwritesbucket.last = Some(now)wheneverbucket.median_seconds.is_some(). If a tier experienced a slow spike long ago (so its estimate has decayed toward zero via the 10 s half-life) and a new row-only restore fails synchronously (store.fetch(...)returnsErr) or asynchronously (finish(&key, false)does not callobserve()),bucket.in_flightreturns to0whilebucket.laststays reset tonow—jumpingestimate_seconds()back to 100% of the stale median for another recovery window.- Fix: Do not overwrite
bucket.lastinstart()(estimate_seconds()already returns the undecayedmedianwhilebucket.in_flight > 0at:341); only refreshbucket.lastinsideobserve()(or upon successful completion).
Subtract / Simplify
- Collapse
TierStore::retiredandTierStore::retired_offeredinto one method (selene/src/store.rs:433-444,selene/src/memory.rs:1185-1189, 3612-3626,selene/src/pool/local.rs:120-137,selene/src/pool/cascade.rs:415):- The trait default forwards
retired_offered -> retired, while every real implementor overrides both and forwardsretired -> retired_offered(&[]). Replace both with a singlefn retired(&mut self, _key: PrefixKey, _tier: PoolTier, _how: Retirement, _offered: &[Retiring]) {}and pass&[]at non-cascade call sites.
- The trait default forwards
- Deduplicate
writeback_wake_cursor/writeback_wake_remainingbookkeeping inselene-manager/src/store.rs(:1586-1594,:1743-1768,:1850-1858,:4161-4168,:4236-4243):- The modulo/clamp cursor fixup is duplicated across six sites, and
close_operations(:4237-4243) omits theremoved_before_cursoradjustment thatresolve_published_waiters(:1571-1591) andexpire_waiters(:1826-1855) perform. Extractremove_writeback_waiter(index)andretain_writeback_waiters(predicate)helpers to own the invariant in one place.
- The modulo/clamp cursor fixup is duplicated across six sites, and
- Pass transfer and prefill seconds directly to
Metrics::host_lookup_cost(helios/src/server/runtime.rs:3408-3415,helios/src/server/metrics.rs:538-560):- Currently
admit_with_host_storecomputeseffective_rate = gained as f64 / prefill_saved_seconds(withf64::INFINITYfor0.0) and clonesHostHitjust to satisfyhost_lookup_cost(&priced_hit, effective_rate), which dividesmissing / rate.max(1.0)right back into seconds (and clamps if0 < effective_rate < 1.0). Accepting(missing_tokens, transfer_seconds, prefill_saved_seconds)directly deletes theHostHit::clone(), thef64::INFINITYtrick, and the round-trip distortion.
- Currently
- Extract
Incoming::clear_pool_lookup(&mut self)inhelios/src/server/runtime.rs(:1800-1803,:2614-2617,:3030-3033,:3044-3047,:3076-3079):- Five sites repeat the same four-field reset (
pool_lookup,pool_lookup_started,pool_lookup_reissued,pool_plan). One helper eliminates the duplication and prevents leavingpool_lookup_reissuedstale on future edits.
- Five sites repeat the same four-field reset (
- Narrow
is_role_preserving_compactionvisibility and simplify the redundant branch inhelios/src/cache.rs(:646-654,:688-695):is_role_preserving_compactionis markedpub(crate)but only called athelios/src/cache.rs:637; make it private. The three-armlet tokens = ...ladder at:688-695can collapse toif role_preserving { 0 } else { self.protected_eviction_tokens(node, rank) }, provided the literal mutation match inverification/helios-lifecycle/check.py:517("let tokens = self.protected_eviction_tokens(node, rank);") is updated in the same commit (and coordinated with#665).
Nits
- Duplicated pool level ordering (
selene/src/levels.rs:121-128,helios/src/server/metrics.rs:1415-1418):Ranking::rates()returns[f64; 4]positionally whilemetrics.rshardcodes the matching label array["neighbour_gpu", "host_dram", "host_nvme", "remote_nvme"]. Co-locating aLevel::ALL/ label constant prevents silent positional drift.
Dropped on verification
- Upstream F7 ("zero-progress eviction can spin
ensure_resources' unbounded loop when every checkpoint is pinned"): False.helios/src/scheduler.rs:1284-1289explicitly checksif evicted.retired.is_empty()and immediately returnsErr(Error::admission(AdmissionError::Capacity, ...)). - Upstream F3 ("
host_transfer_nsmixes wrong units andhost_prefill_nsrecords a fabricated 0 ns"): False.helios/src/server/metrics.rs:917-925exposesflare_host_cache_estimated_transfer_nsandflare_host_cache_estimated_prefill_ns(both estimated durations in ns matchingworth_restore), andestimate_prefill_delta_ns(helios/src/scheduler/checkpoints.rs:438-439) legitimately returnsSome(0)when both start offsets execute the exact same quantized prefill graph sequence. The real cleanup (passing seconds directly withoutHostHit::clone()/f64::INFINITY) was moved to## Subtract / Simplify. - Upstream F1 ("Major correctness bug in
prefill_rateEMA; GPU-only timing biasesworth_restoretoward restores"): Inverted math & overstated. Excluding queue wait (observed_duration_ns) yields a higherprefill_rate, which makesgained / ratesmaller and biasesworth_restoreagainst marginal restores (not toward them), and the EMA is only a cold fallback untilPrefillPredictormeasures each prefill capacity (which learns on all prefill steps). Only the PR-description accuracy gap survives under## Should Fix. - Upstream F2 ("sub-page startup failure is a Major bug and
intake_warningwent dead"): Misread design. Without local disk, intake is intentionally0so an intake-shrinkage warning should not fire (verified inselene/src/offload/tests.rs:684-738), and failing startup cleanly whencheckpoint_memory < page_record_bytesavoids a 0-byteSlabPoolmmap failure and is explicitly documented (docs/prefix-cache-offload.md:169-171) and tested (selene/src/offload/tests.rs:1494-1511). Only PR-body disclosure survives. - Upstream F4 ("lost
StoreEvent::FetchedpinsRowRestoreLatencyforever"): Overstated.StoreEvent::Fetchedis also the sole trigger forscheduler.finish_inbound(helios/src/server/runtime.rs:2850); a store droppingFetchedalready leaks GPU pages/requests by violatingHostStore's core contract, and suspending decay while a slow fetch is actively in flight is deliberate backpressure. Replaced by the actual verifiedbucket.lastreset issue instart(). - Upstream F6 ("
row_conflicts/verify_physical_invariantsare#[cfg(test)]-only andplan_mapping_handlesrebuilds layouts per search step"): Low-signal. Startup-only binary search runs only when handle count exceedsRM_HANDLE_RANGE(524,288) and memoizes identical TP rank geometries (helios/src/runtime_core/cache_memory.rs:706-716); keeping heavyweight verification helpers#[cfg(test)]is standard. - Upstream S4 ("delete
DiskThread::start_with_faults"): Low-value churn.start_with_faultshas 10 existing test call sites across 4 files (selene/src/disk.rs,selene/src/composite.rs,selene/src/disk_store.rs,selene/src/shard/tests.rs). - Upstream minor subtraction on
capture_headroom_slots(selene/src/offload.rs:233-240): Buggy suggestion. The proposed.clamp(1, retention_slots.max(1))would return1instead of0whenretention_slots == 0(breaking the explicit test atselene/src/offload/tests.rs:1528). - Upstream dossier inaccuracies corrected:
5d53040eis 4 commits behind1fbcc3c9(not 6;#656and#638predate5d53040e);eviction_candidate_within_budgetinhelios/src/cache.rs:711-718was retained as a wrapper (not renamed away);helios/src/runtime_core/memory/codec_layout_tests.rswas modified, not newly added.
Full report Decision to Test: no (97%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 99.5% -
triage:validation: 0.3% -
triage:design-review: 0.1% -
triage:partial: 0.0% -
none: 0.0% -
triage:investigate: 0.0% -
triage:integration: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes decide malicious: all_clear (100%): No malicious content found
explore
Author: yatesdr (COLLABORATOR; owns selene/selene-manager, 82 merged PRs in 180 days; Discord D-Rock)
Motivation: Selene's host prefix cache wastes GPU KV pages because a snapshot may only reuse the largest cache plane, so most of each snapshot's memory is excluded (~3.16x its own page cost). This PR also keeps clean host records in DRAM after handover, writes packed records with direct I/O, and prices host restores by measured row latency instead of a wall-clock guess.
Scale: +10,035 / −1,142 lines in 41 files (was +11,210/−704 in 40 at the previous head)
Proposal:
- Admits exact half-width snapshot alias planes with midpoint-ordered chunk placement and symmetric handle budgeting (answers #451).
- Retains clean
persisted_in_poolL1 records after handover, narrows shutdown drain topending_pool_drain(). - Adds pressure-aware eviction (
evict_for_pressure,page_pressure_victim_priority) in the scheduler. - Replaces tick-polled put waits with
WindowReleaseSignalevent waiters, plus alignedO_DIRECTpacked writes and clean manager-RAM retention. - Splits ready vs reserved disk metrics, zeroes intake slots without local disk, adds per-level pool restore-rate gauges. Touches:
selene-manager/src/store.rs(+2,728/−146): waiters, arena retention, offer coalescing.selene/src/memory.rs(not opened) /disk.rs(not opened) /disk_store.rs(not opened) /composite.rs(not opened): L1 retention, direct I/O, store outcomes.helios/src/runtime_core/cache_memory.rs(not opened) +scheduler/: alias planes, eviction, restore pricing. Related items:- #451 Snapshot aliasing admits only the largest cache plane (open): the bug this fixes; author's earlier "deliberate" reply is partly reversed; issue left un-updated.
- #665 helios scan-resistant prefix-cache eviction (open): rewrites the same victim-selection function in
helios/src/cache.rsand the same doc sections; no merge order agreed. - #659 alias null continuation row onto one zeroed VMM granule (open): same
runtime_core/cache_memory.rs(not opened) file. - #455 pool-only pass-through capture and drain (merged): this PR adds a retaining mode and narrows its drain.
- #497 disk/offload intake sizing and direct-I/O opens (merged): this PR takes intake to 0 without local disk.
Link: https://github.com/NVIDIA/hyperflare-inference/pull/674
Autobot comments: The new event was a force-push
7d7dcdc→19ce4a7bplus the first Autobot review (Changes Requested, 0 blockers). Only one review finding is real —RowRestoreLatency::startresets the median's timestamp (runtime.rs:301-303) whilefinish(ok=false)never observes, so a decayed median resurrects after a failed restore. Three others are stale at this head: there is noretired_offeredtrait method (only a test field),host_lookup_costalready takes seconds (metrics.rs:538-560), and all waiter removals already funnel throughfilter_writeback_waiters(store.rs:1443-1475). The review also cites pre-force-push scale/CI (7d7dcdc), and the body omits three real items:Kind::StoreInvalidated = 4on the rank wire (shard.rs:470,484), a new sub-page startup error (offload.rs:702-712), and three public-API signature changes (begin_lookup(resident),retired(offered),pending_pool_drain;store.rs:377,401-404,433-440). Benchmarks are against5d53040e, 4 commits behind base1fbcc3c9, with#663(latency pricing) inside the gap; head19ce4a7bhas no CI or benchmark evidence. Still zero human engagement; #451 remains open.
Classify intake
Selected: triage:review, performance, area:caching, area:memory, area:selene
Threshold: 65%
Triage
- [✓]
triage:review: 96.4% -
triage:validation: 2.6% -
triage:design-review: 0.9% -
none: 0.0% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 99.9% -
priority:P1: 0.1% -
priority:P2: 0.0%
Type
- [✓]
performance: 97.1% -
enhancement: 40.7% -
community: 29.4% -
duplicate: 24.5% -
bug: 2.6% -
documentation: 0.2%
Area
- [✓]
area:caching: 99.1% - [✓]
area:selene: 99.1% - [✓]
area:memory: 75.5% -
area:api: 46.9% -
area:scheduling: 22.3% -
area:preparation: 5.3% -
area:orbit: 0.9% -
area:rocenante: 0.3% -
area:kernels: 0.2% -
area:engram: 0.1% -
area:packaging: 0.0%
Model
-
model:deepseek-v4: 3.3% -
model:deepseek-v4.1: 2.0% -
model:kimi-k3.1: 1.6% -
model:glm-5.3: 1.1% -
model:qwen3.8-flash-next: 1.1% -
model:gemma4: 0.9% -
model:nemotron-3.5-bolt: 0.9% -
model:muse-glimmer: 0.6% -
model:qwen3.8-27b: 0.5% -
model:mimo-v2.6: 0.3% -
model:inkling-small: 0.1%
Apply Labels (Intake)
No label changes
Subtraction and simplicity
Subtraction/Simplicity review of #674 @ 19ce4a7b: not lean — six high-value deletions, no nitpicks. No env vars or speculative flags found (AGENTS.md:450-472 respected).
- Delete
RowRestoreLatency(helios/src/server/runtime.rs:270-343): ~75 lines re-implementingselene::levels::Rate(selene/src/levels.rs:36-87, same median-of-3, same 10 s recovery, same in-flight hold). Its unconditional*last = nowat:301-303is where the PR's one real defect lives;Rate::started(levels.rs:78-82) already has the correct conditional. Deleting the copy deletes the bug. - Two half-prefill predicates (
runtime.rs:225-229vsselene/src/store.rs:459-468); after this PRworth_fetchinghas no non-test caller (onlycomposite.rs:2920,2923,disk_store/coalesce/tests.rs:1798 (not opened),1967,2142,2258). Keep one in selene, delete Helios's. plan_refreshed: bool(runtime.rs:3296,3303-3309) exists only to say "already refreshed", and yields threerefresh_admission_plan_in_placesites (:3207,3222,3307) for one admission attempt — double refresh on retry. Move the refresh intoadmit_with_host_store, return nothing frombegin_pool_lookup.Arena::coalescing_block'sSome((0,0))arm (selene-manager/src/arena.rs:163-175) duplicatescan_allocate(:145-152), is pre-empted by both callers (store.rs:1558,store.rs:2247), and forces theif block_size > 0guard atstore.rs:2256; it also clones the free map on the per-waiter scan path (store.rs:1567).- 13-param
admit_with_host_storeunder#[allow(clippy::too_many_arguments)](runtime.rs:3285-3302), six params new; bundle into oneRestoreProbestruct and drop the allow — this also absorbs the duplicatedconditioned_inputcollection (:1721-1727vs:3324-3327).AGENTS.md:338asks Helios be kept simple. Ranking::rates() -> [f64;4]+ hardcoded labels (selene/src/levels.rs:119-128,helios/src/server/metrics.rs:1418-1423): one ordered set in three representations; return[(Level, f64); 4]and render by iteration.
Keep: Incoming::clear_pool_lookup, the three-scalar host_lookup_cost, and the single_child_role map (helios/src/cache.rs:640-655). Do not reopen filter_writeback_waiters (single implementation, no lost waiters).
Open: can Rate take a no-ceiling seed (decides if S1 is deletion or small refactor); is the per-source in-flight hold actually distinct from Rate::started; conflict check with #665/#659. Not reviewed: selene/src/memory.rs (not opened), disk.rs (not opened), disk_store.rs (not opened), scheduler/cache_memory.rs (not opened), runtime_core/cache_memory.rs (not opened).
Correctness and contracts
Correctness/contracts review of PR #674 at head 19ce4a7b (Selene/Selene-manager/Helios prefix-cache work). Five majors, five minors.
Majors:
- F1 Self-rearming pump spins the store-owner thread.
pump()re-sendsTickwhenever any put/get/writeback work remains (selene-manager/src/store.rs:5067-5072vianotify_wakeup:874-878), and the owner loop pumps after each batch (selene-manager/src/control.rs:227). A put stuck inpending_putsyields Tick→pump→Tick at CPU speed instead of the old 10 ms cadence (control.rs:421-435); one thread serializes all pool state, so a single blocked put head-of-line blocks every client. Same per-disk-completion amplification atselene/src/disk.rs:533-535. - F2
RowRestoreLatencydecay clock bumped by failed restores.start()setslast_medianunconditionally (helios/src/server/runtime.rs:301-303);finish(ok=false)returns beforeobserve(:313-315);estimate_secondsreturns the undecayed median while in flight (:339-342). A failing source pins the estimate at the full median, so cheap local DRAM row restores keep being rejected — opposite of PR intent. Test only covers the no-median case (phase_tests.rs:8799-8801). - F3 Undisclosed rank-relay wire break:
Kind::StoreInvalidated = 4(selene/src/shard.rs:470,484) with hard rejection of unknown codes (:485). Mixed-version ranks cannot interoperate; body says nothing. - F4 Three public
selenesignatures changed undisclosed:begin_lookupgainsresident(store.rs:377),retiredgains_offered(:433-440), newpending_pool_drain(:401-404), plusHostHit.pooledand threeStoreStatsfields. Out-of-tree implementors stop compiling. - F10 Charter #210 unmet: Tables A–F are an A/B against
5d53040ewhile base is1fbcc3c9, with#663(latency pricing,8489d504) inside the gap pricing the same decisions; benchmarks ran on the pre-refactor7d7dcdcb, so head19ce4a7bhas no benchmark or CI evidence.
Minors: F5 row-restore buckets keyed on Tier not the 4-valued level (runtime.rs:257-268 vs pool/store.rs:465,479); F6 Windows loses the buffered packed-write fallback (disk.rs:1774-1781 vs eos/src/windows.rs:104-109); F7 a stuck reclaim permanently blackholes its key (disk_store.rs:2516-2518,2643-2645,2697-2699); F8 counter decrements can wrap in release (disk_store.rs:2789-2792); F9 host_transfer_ns/host_prefill_ns span semantics shifted to floor/modelled values (metrics.rs:538-543, runtime.rs:3346-3353).
Verified sound: evict_for_pressure cannot spin (scheduler.rs:1284-1289); writeback wake scan terminates (store.rs:1610-1666); O_DIRECT packed path sets exact length and is tested (disk.rs:1408-1421); clean-L1 invariant guarded; prefill_rate narrowed, biasing against marginal restores.
Open: does the pump settle under saturated namespaces (no test covers it); can Tables B/C be re-attributed after #663; #451 unanswered; merge order with #665/#659; no SM121/GB10 evidence; no human review.
Re-review
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.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 99.8% -
triage:validation: 0.1% -
triage:design-review: 0.1% -
none: 0.0% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: no (99%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with. decide malicious: all_clear (100%): No malicious content found
explore
Author: yatesdr (COLLABORATOR; owns selene/selene-manager; Discord D-Rock)
Motivation: Prefix caching across Selene, selene-manager and Helios loses capacity and latency in four coupled ways — GPU snapshots waste CUDA handles so KV pages get excluded, clean host-DRAM copies are dropped after pool handover, packed NVMe writes bypass O_DIRECT, and put waiters poll on timers. This PR reworks all four at once.
Scale: +10,035 / −1,142 lines in 41 files
Proposal:
- Admit exact half-width GPU snapshot-alias planes with midpoint-ordered chunks and exponential+binary handle budgeting, plus pressure-driven
evict_for_pressure(#451). - Keep host/pool lookup alive for partially resident prefixes, allocate zero local intake slots without local disk, split ready vs reserved disk metrics, export per-level pool restore rates.
- Retain clean L1 DRAM copies after pool handover and narrow shutdown drain to
pending_pool_drain(). - Price restores from read-only
estimate_prefill_delta_nsplus per-tier measuredRowRestoreLatencyinstead of the wall-clock prefill EMA. - Write packed v4 records with whole-record
O_DIRECT, replace tick-polled put waits with event-driven wakeups, retain clean manager arena blocks and coalesce duplicate put offers. Touches: helios/src/runtime_core/cache_memory.rs(not opened) +helios/src/scheduler/(alias geometry, eviction, pricing)helios/src/server/runtime.rs(admission, row-restore pricing, lookup tickets)selene/src/{disk,shard,memory,store}.rs+selene-manager/src/store.rs(not opened) (direct I/O, wire event, retention, waiters) Related items:- #451 Snapshot aliasing admits only the largest cache plane (open): antecedent issue, still un-updated
- #665 open PR on the same eviction selection fn in
helios/src/cache.rs(not opened) - #655 same author, Ready To Merge, same
helios/src/scheduler/checkpoints.rs - #659 open PR on the same
helios/src/runtime_core/cache_memory.rs(not opened) - #660 anchor-split pricing (merged as
4cc6f2fd): inside the baseline gap, same file Link: https://github.com/NVIDIA/hyperflare-inference/pull/674 Autobot comments: Amendments only, head still19ce4a7b. One blocker:RowRestoreLatency::startresets the decay clock on failed fetches (helios/src/server/runtime.rs:301-303,:3406,:2826), verified on both paths; only the empty-bucket case is tested (phase_tests.rs:8799-8801). The author's 18:08 claim that all findings are fixed in0ebee3d4is unverifiable here and contradicted by the tree (POOL_LEVELS,HostAdmissionProbe,flare_selene::worth_restoreabsent;too_many_argumentsstill atruntime.rs:3285). Benchmark baseline5d53040eis 6 commits behind base, straddling two pricing commits. The review's related-check misses #655 and #660. Disclosure gap still open (wireKind::StoreInvalidated = 4, sub-page startup error, public API). My earlier "no labels" is withdrawn; engagement is "author's own reply only".
Classify intake
Selected: triage:review, performance, area:caching, area:memory, area:selene
Threshold: 65%
Triage
- [✓]
triage:review: 99.7% -
triage:validation: 0.1% -
triage:design-review: 0.1% -
none: 0.0% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 99.8% -
priority:P1: 0.2% -
priority:P2: 0.0%
Type
- [✓]
performance: 94.7% -
enhancement: 40.7% -
community: 34.9% -
duplicate: 22.3% -
bug: 8.5% -
documentation: 0.3%
Area
- [✓]
area:caching: 98.6% - [✓]
area:selene: 97.4% - [✓]
area:memory: 81.8% -
area:api: 46.9% -
area:scheduling: 46.9% -
area:preparation: 18.2% -
area:orbit: 0.9% -
area:engram: 0.5% -
area:kernels: 0.4% -
area:rocenante: 0.1% -
area:packaging: 0.0%
Model
-
model:deepseek-v4: 13.3% -
model:muse-glimmer: 4.2% -
model:deepseek-v4.1: 2.3% -
model:kimi-k3.1: 2.0% -
model:qwen3.8-flash-next: 1.1% -
model:glm-5.3: 1.0% -
model:nemotron-3.5-bolt: 1.0% -
model:mimo-v2.6: 0.9% -
model:qwen3.8-27b: 0.8% -
model:gemma4: 0.6% -
model:inkling-small: 0.1%
Apply Labels (Intake)
No label changes
Correctness and contracts
Correctness/contracts/system-level review of PR #674 at its recorded head 19ce4a7b (base 1fbcc3c9) — not the 0ebee3d4 the header and the author's 18:08 comment claim, which is not in the item. Five findings, one blocker.
Blocker — RowRestoreLatency::start still overwrites bucket.last_median's timestamp (helios/src/server/runtime.rs:301-303) while finish(ok=false) returns before observe (:313-315), so every failed row-only fetch (sync :3402/:3406, async :2826) resurrects a decayed median at 100% for another 10 s half-life (RECOVERY_SECONDS = 10.0, :290). The only test is the empty-bucket case (phase_tests.rs:8799-8801); the claimed regression test is absent. Same struct: in_flight (:285) has no reaper, so one lost StoreEvent::Fetched pins a whole source bucket at its undecayed median permanently.
Majors. (1) observe_prefill_rate (runtime.rs:3071-3077) requires step.lanes.len() == 1, so multi-lane-prefill servers — the workloads in Tables C/F — never move prefill_rate off INITIAL_PREFILL_RATE = 8000, leaving the fallback at :3279-3280 a fixed guess. (2) flare_host_cache_pool_inbound_bytes_per_second exports Rate seed constants (selene/src/levels.rs:69-76, seeds 20e9/3e9/400 MiB/s) before any sample, and get() clamps to the seed forever — pinned by a test that asserts seeds are exported (selene/src/pool/store/tests.rs:1677-1692) — yet the body cites 2.33 GB/s from it as measurement evidence. (3) Every round-2 item the author says is fixed is absent: POOL_LEVELS (positional [f64;4] at levels.rs:121-128 matched to hardcoded labels at metrics.rs:1418-1423), flare_selene::worth_restore (helios duplicate still at runtime.rs:225-229), #[allow(clippy::too_many_arguments)] (:3285), public-API disclosures, and the Windows is_direct_unsupported match. (4) A/B baseline 5d53040e is five commits behind the PR's base, straddling #663 and #660, the latter editing the same checkpoints.rs (not opened) that carries the new estimate_prefill_delta_ns.
Twelve areas verified sound and stated as such (O_DIRECT whole-record path, clean_slots invariants, pending_pool_drain, writeback_wake epochs, disk inventory split, host_lookup_cost span).
Subtraction and simplicity
Subtraction/Simplicity/Conventions review of PR #674. For a +10,106/−1,158 diff this change is leaner than its size suggests; most volume is load-bearing. Six simplifications remain, two high value.
- HIGH —
RowRestoreLatency(helios/src/server/runtime.rs:270-344) re-implementsselene::levels::Rate(selene/src/levels.rs:34-87): same[f64;3]ring median, same 10 s recovery, same hold-in-flight rule. This duplication caused round-2's Blocker — the copy'sstart()refresheslast_median(runtime.rs:301-303) whereRate::started()is conditionally a no-op (levels.rs:77-82). Fix by deleting the copy, not patchingstart(). - HIGH —
conditioned_window_ends(helios/src/scheduler.rs:2104-2121) duplicates the greedy pack inset_conditioned_inputs(:2164-2177), minus its geometry validation, needingsort/dedupto repair ordering the invariant already guarantees. Extract onepartition_conditioned; sole consumer is checkpoints.rs:462, :478. - MEDIUM —
worth_restore(runtime.rs:223-229) duplicatesflare_selene::worth_transfer(selene/src/store.rs:459-468); this PR removed the last production caller, so the pair exported at selene/src/lib.rs:53 (not opened) is now test-only. Delete one side. - MEDIUM — the packed-write fallback (selene/src/disk.rs:1423-1437) is dead on Windows because
is_direct_unsupported(:1774-1784) is hard-falseoff-Unix while eos reportsUnsupported. MatchUnsupported | InvalidInputand delete the stub, or delete the fallback. - MEDIUM —
write_record_direct's hand-staged aligned prefix (:1277-1304) re-earnswrite_direct_slices(:1331-1376) for one memcpy, reached only at offset 0; delete it or record the measurement. - LOW — pool-level order spelled three ways (levels.rs:119-128 positional
[f64;4], metrics.rs:1418-1423 hardcoded labels, a doc comment); onePOOL_LEVELSconst. TheAGENTS.md:188-193"no fallback layers" rule is the hook for 3–4.
Not flagged as speculative: the Layout/midpoint packing rework, PublishError/Reply::invalidated, and the WindowReleaseSignal/writeback_wake_epoch machinery — each is the minimum for its behaviour.
Open questions: whether 0ebee3d4 exists (POOL_LEVELS / worth_restore absent at head, so 3, 4, 6 are claimed not landed); whether the F5 copy is measured; whether packed writes are meant to work on Windows; and F2 should be sequenced with #655/#660 on checkpoints.rs.
Re-review
Recommendation: Ready To Merge
Head 0ebee3d4 cleanly rebases onto main (4cc6f2fd, preserving #660 and #670) and resolves every blocker, disclosure item, subtraction, and platform/ordering nit from Round 2 — including the RowRestoreLatency::start decay-clock bug (with a dedicated aged-median regression test), flare_selene::worth_restore deduplication, HostAdmissionProbe extraction, Windows is_direct_unsupported parity, shared levels::POOL_LEVELS, and explicit PR-body disclosures. Direct verification of all four subsystems on 0ebee3d4 confirms no remaining correctness, safety, concurrency, or CI blockers; only optional follow-up cleanups and merge-order coordination remain.
Merge Risk
Level: Medium
- Broad cross-crate cache-core surface (
+10,106 / -1,158across 42 files): Modifies GPU VMM snapshot-alias planning (helios/src/runtime_core/cache_memory.rs), scheduler pressure eviction and prefill-delta pricing (helios/src/scheduler/), local/pooled host offload and direct I/O (selene/), and manager arena retention and event-driven waiter wakeups (selene-manager/src/store.rs,arena.rs). Core state-machine invariants are guarded by debug assertions, unit/integration suites, and 8/8 TLA+ models with mutation checks. - Wire, startup, and public crate compatibility: Adds rank-relay wire event
Kind::StoreInvalidated = 4(selene/src/shard.rs:470, 484), fails startup cleanly on sub-page memory-only budgets (selene/src/offload.rs:706-712), splits committed vs reserved disk inventory gauges (docs/api.md:390-394), and updates publicflare-seleneAPIs (selene/src/store.rs:248-256, 377, 401-404, 433-440, 451,selene/src/levels.rs:109-114) in lockstep with workspace callers; all are now explicitly disclosed in the PR description. - Concurrent PR overlap: Open PRs
#655(helios/src/scheduler/checkpoints.rs),#665(helios/src/cache.rs,docs/prefix-cache-offload.md(not opened)), and#659(helios/src/runtime_core/cache_memory.rs) modify overlapping regions and will need coordinated merge sequencing.
Walkthrough
- Resident-aware lookup, diskless intake sizing & telemetry (
helios/src/server/runtime.rs:1635-1650, 3271-3367,helios/src/server/metrics.rs:1409-1428,selene/src/offload.rs:676-712,selene/src/levels.rs:109-132,selene/src/store.rs:244-256, 377, 451-479): Passes GPU-resident token offsets on pool lookups, allocates zero local intake slots when local disk is disabled (failing cleanly on sub-page memory-only budgets), separates ready disk inventory from uncommitted reservations, shareslevels::POOL_LEVELSbetweenRanking::rates()and Prometheus labels, exportsflare_selene::worth_restore, and groups admission probe parameters intoHostAdmissionProbe. - L1 DRAM clean retention & non-blocking shutdown drain (
selene/src/memory.rs:923-1085,selene/src/pool/store.rs:307-357,selene/src/store.rs:401-404, 433-440): Retains cleanpersisted_in_poolrecords in L1 DRAM with invariant-checkedclean_slotsand handover revalidation (handover_valid,refresh_ancestors,refresh_same_page_descendants,promote_role), and narrows shutdown drain topending_pool_drain(). - GPU snapshot-alias packing, pressure eviction & restore pricing (
helios/src/runtime_core/cache_memory.rs:655-770,helios/src/scheduler/cache_memory.rs:593-649,helios/src/cache.rs:628-707,helios/src/scheduler/checkpoints.rs:445-494,helios/src/server/runtime.rs:250-333,verification/helios-lifecycle/check.py:515-528): Packs shared GPU snapshot aliases with symmetric exponential+binary handle budgeting, addsevict_for_pressurewith matching mutation guard, prices restores via read-onlyestimate_prefill_delta_nspaired withRowRestoreLatency(preserving aged decay clocks on failed fetches, covered athelios/src/server/runtime/phase_tests.rs:8829-8851). - Direct compressed I/O, event-driven waiters, clean arena retention & offer coalescing (
selene/src/disk.rs:848-875, 1271-1447, 1774-1786,selene/src/shard.rs:465-500,selene-manager/src/arena.rs:163-200,selene-manager/src/store.rs:1443-1666, 2237-2272, 5309-5365): Uses aligned whole-recordO_DIRECTwrites with exactset_lentruncation and portableis_direct_unsupportedfallback, propagatesKind::StoreInvalidated = 4across sharded ranks, replaces tick-polled put waits with losslessWindowReleaseSignal+WindowHolddrop-ordered wakeups and epoch-tracked rotating scans, retains clean manager RAM viaArena::coalescing_block, and coalesces covered waiting offers directly toPresent.
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 buffer/slab lifetimes. - [PASS] Charter & value fit: Directly advances the prefix-caching charter goal, stays model-agnostic, fixes open issue
#451, and follows the four-part PR description with explicit disclosures (note: SM120 A/B tables remain measured on pre-refactor7d7dcdcbvs5d53040eand transparently noted as such). - [WARN] Related / duplicate / conflict check: Directly addresses
#451(issue still open and un-updated with the midpoint half-width conclusion); overlaps open PRs#655,#665, and#659with merge order to be coordinated. - [PASS] Tests & verification evidence: Author reports clean
-D warningscheck across all 4 crates and passing Linux suites on0ebee3d4(selene585,selene-manager205 lib + 128 integration,helios1,817 release lib,flare254 release, andverification/helios-lifecycle/check.py --mutations8/8 TLA+ models + Rust mutations), including the newRowRestoreLatencyaged-decay regression test (phase_tests.rs:8829-8851); confirm green GitHub CI checks on0ebee3d4before merging.
Blockers
None.
Should Fix
None.
Subtract / Simplify
- Share greedy conditioned-window partitioning between
conditioned_window_endsandset_conditioned_inputs(helios/src/scheduler.rs:2094-2123,:2162-2183): Both loops implement the samefeatures + input.feature_range.len() > capacityboundary split (withconditioned_window_endsadditionally filteringtoken_span.end > consumed). Extracting a small shared window-boundary helper keeps both paths aligned if conditioned-input windowing changes later.
Nits
- Post wrap-up on
#451: Add a brief comment on open issue#451recording the midpoint half-width conflict-span resolution implemented here. - Coordinate merge order: Sequence with open PRs
#655(helios/src/scheduler/checkpoints.rs),#665(helios/src/cache.rs,docs/prefix-cache-offload.md(not opened)), and#659(helios/src/runtime_core/cache_memory.rs). - PR-body wording & optional follow-up: In
What §3, refer toflare_host_cache_pool_inbound_bytes_per_second{level}as "pool restore rate estimates" (matchinghelios/src/server/metrics.rs:1412anddocs/api.md:394-398, which already document it accurately). Optionally, if separating pooledHostNvmevsRemoteNvme(orNeighbourGpuvsHostDram) row-restore latencies becomes useful later,RowRestoreSource(helios/src/server/runtime.rs:250-260) can key onLevel.
Dropped on verification
- Upstream claims that
0ebee3d4and all Round-2 fixes were absent (RowRestoreLatency::start,worth_restore,HostAdmissionProbe,POOL_LEVELS, Windowsis_direct_unsupported, PR body disclosures) — Stale snapshot: Upstream flash lenses inspected the stale default ref (19ce4a7b) instead ofpr/674(0ebee3d4), where every one of those fixes is verified landed (helios/src/server/runtime.rs:284-293, 3271-3362,helios/src/server/runtime/phase_tests.rs:8829-8851,selene/src/store.rs:451-479, 516-519,selene/src/lib.rs:53,selene/src/disk.rs:1779-1785,selene/src/levels.rs:109-132,helios/src/server/metrics.rs:1418-1427). - Correctness F1b (
RowRestoreLatency::in_flighthas no reaper) — Duplicate / already dropped in Round 1:row_restore_latency.start/finish(helios/src/server/runtime.rs:2814, 3410-3415) is 1:1 paired withscheduler.finish_inbound(:2815, 3418), so a droppedStoreEvent::Fetchedalready leaks the scheduler'sInboundTicketand GPU pages. - Correctness F2 (
observe_prefill_raterequiringstep.lanes.len() == 1pins multi-lane servers atINITIAL_PREFILL_RATEforever) — False:ActionCosts::observe(helios/src/scheduler/cost.rs:830-864) updatesPrefillPredictoron every GPU-timed prefill step regardless of lane count, soestimate_prefill_delta_ns(helios/src/scheduler/checkpoints.rs:445-494, called athelios/src/server/runtime.rs:3257-3266) prices warm restores without consultingfallback_prefill_rate. - Correctness F4 (
Rate::get()permanently clamps faster-than-seed rates atself.seed) — False: Verified atselene/src/levels.rs:69-75and test:169-172that.min(self.seed)applies only in theSome(last) if self.median < self.seedrecovery arm; measured rates>= seedreturn uncapped via_ => self.median, andmetrics.rs:1412/selene/src/store.rs:254-256/docs/api.md:394-398accurately document the gauge as source-ranking rate estimates. - Simplicity F1 (delete
RowRestoreLatencyand reuseselene::levels::Rate) — Already dropped in Round 2:Rateispub(crate)inflare-selene, models upward-recovering throughput with a finiteseed, and lacks per-keyin_flightduration tracking; removing the 3-line timestamp overwrite instart()is strictly simpler. - Simplicity F5 (replace aligned-prefix branch in
write_record_directatselene/src/disk.rs:1278-1305withwrite_direct_slices) — Misguided / throughput regression:write_record_directwrites the multi-hundred-MiB aligned prefix zero-copy fromspan.addressand copies only the< 4 KiBtail intoself.scratchin a singlering.transfer, whereaswrite_direct_slices(:1331-1376) copies the entire record through the small scratch buffer in sequential transfers.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 98.3% -
none: 1.1% -
triage:validation: 0.3% -
triage:design-review: 0.2% -
triage:integration: 0.0% -
triage:verify-for-closure: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: yes (91%): Testing will add considerable value with the code. It is ready to merge and the tests will validate and improve confidence on hardware we have available for testing.
Pre Test Report
Hardware test plan — PR #674 (selene / selene-manager / helios prefix cache)
0. Verdict and the one thing to do before spending GPU time
PR #674 is now Ready To Merge (0 blockers, 0 should-fix in the last re-review; the earlier RowRestoreLatency::start decay-clock bug is fixed at pr/674 — helios/src/server/runtime.rs:284-293 no longer touches last_median, and the aged-median regression test exists at helios/src/server/phase_tests.rs:8829-8851 (not opened)). Hardware testing is worth doing, but the evidence in the PR body is not yet valid as measured: tables A–F were run on pre-refactor 7d7dcdcb against baseline 5d53040e, four commits behind the PR base 1fbcc3c9 (this re-review round also records +10,106/−1,158 across 42 files at 0ebee3d4).
Blocking prerequisite for any GPU run: main has moved again and now contains #665 "helios: add scan-resistant sticky dual-turnover prefix cache eviction" (merged as 07e666e6, main tip now c513e46a) — the same helios/src/cache.rs (not opened) eviction-selection region this PR rewrites. Before A/B:
- Merge/rebase
main(c513e46a) into the PR branch and resolvehelios/src/cache.rs(not opened) (and re-checkhelios/src/runtime_core/cache_memory.rsvs #659 if it lands). - Confirm green CI on the merged head.
- Use the same merged
maincommit as the A/B baseline for every table below.
Running the PR's own 5d53040e comparison burns GPU hours on a baseline that no longer exists.
1. What the available machines can and cannot validate
| Claim in PR body | Reproducible on cn5/cn7? |
|---|---|
A GPU snapshot-alias capacity (DeepSeek-V4.1 TP4, 1,946→4,864 snapshots; 82.2→33.2 backing pages/ckpt) |
No — the model is not on either machine. cn5's only served cores are GLM-5.3-Flash-NVFP4 (×2 publishers) plus two DINOv2 ViT fixtures. Substitute GLM-5.3-Flash-NVFP4 TP4 on cn5 (see §2.1); this measures the mechanism, not the claimed model. |
B NVMe spill, tight-limit eviction, restart restore (Qwen3.8-Flash-Next TP1) |
Model only on cn7 (integrated GB10, 1 GPU, so no TP2) — a GB10 export will not load on cn5's GB202. Reproduce the mechanism with GLM-5.3-Flash-NVFP4 TP2 on cn5 (§2.3); the exact latency numbers will not match. |
C Multi-turn, multi-instance pool traffic (2× GLM-5.3 TP2, kvc=off) |
Yes on cn5 (§2.4). Best-matched claim. |
D Compression parity kvc=gpu/cpu/off |
Yes on cn5, only if the cn5 GLM-5.3 core embeds CodecLayout.gpu_module; cores exported without it reject gpu at startup (see docs/prefix-cache-offload.md:112-123). Optional (§2.5). |
| E Cross-node TCP to an aarch64 selene manager | Yes, in essence: pure-CPU selene manager on cn7 (arm64) + instance on cn5 (amd64) over --prefix-cache-pool HOST:PORT. Needs fabric reachability and --listen (§2.6). |
| F 284-request fault-injection matrix | Partially; only the manager-SIGKILL case is cheap (§2.5). |
Whole-#451 handle-budget gate |
Fully provable with zero GPU time — the fixture test in §1.1. |
1.1 Zero-GPU pre-check (do this first, ~10 min on cn5's 48 CPUs)
The #451 mechanism (midpoint half-width alias planes, symmetric handle budgeting) is already covered by a CPU-only fixture test using checked-in protobufs (tests/fixtures/codec_geometry/*.{rank,contract}.pb) — no CUDA, no core download:
cargo test --release --manifest-path helios/Cargo.toml --all-features \
runtime_core::memory::codec_layout_tests::exported_fixture_geometries_preserve_bounds_and_recover_vram_without_widening_spans -- --nocapture
It asserts, over deepseek41 / glm53-tp4-mtp5 / qwen38-tp1 / qwen38-tp2 at 2 MiB and 64 KiB granularity: eligible planes (4/8, 12/24, 26/39), post-plan total handles < 524,288 (RM_HANDLE_RANGE, helios/src/runtime_core/cache_memory.rs:593), and deepseek41 exclusion ≤ 53,000 pages at 1,592 rows. If this fails, stop — the GPU plan is moot. Also run verification/helios-lifecycle/check.py --mutations and RUSTFLAGS="-D warnings" cargo check --locked --all-targets here (cn5's 48 CPUs), not on a GPU job.
2. GPU plan (cn5 unless stated) — ~2 h 45 min total, ordered by value per GPU-minute
Noise controls for every A/B: same core file, same flags, fixed temperature/seed, 3 repetitions in ABBA order, discard the first (warmup) run, report p50 and mean, dump /metrics before/after each phase. Record nvidia-smi --query-gpu=clocks.sm,power.draw once per run so a clock-throttled run can be discarded rather than interpreted.
2.1 Phase 1 — handle-pressure gate + snapshot capacity (25 min, 4 GPUs)
Purpose: make the #451 code path actually execute and measure capacity/pages. It is the only claim cn5 can measure on real hardware, and it is a gate, not a parity claim.
- Baseline: merged
main,flare run <GLM-5.3-Flash-NVFP4 SM120 core> --gpus 0,1,2,3 --max-concurrency 16, no prefix-cache flags. - PR: same, on the rebased branch.
- Force handle pressure:
helios/src/runtime_core/memory.rs:1196-1200printsPlace cache backing N → M estimated VMM handles across 4 local GPUsonly when compaction changed the plan. If that line is absent, the config is not handle-limited and the run is inconclusive, not passing — raise--max-concurrency/ KV budget (larger cache budget ⇒ more snapshot rows ⇒ more handles) and repeat. This line is the cheapest possible confirmation that the new planner engaged. - Record
flare_snapshot_capacity,flare_snapshot_backing_pages,flare_free_kv_pages,flare_cached_checkpointsafter a fixed 24-prompt / 200-capture workload. - Pass: planner line present on PR build;
flare_snapshot_capacity≥ baseline;flare_snapshot_backing_pagesper checkpoint strictly lower; generation identical on both builds. Abort (blocker): startup fails withestimated VMM mapping handles (...) exceed local handle limit (524288)(cache_memory.rs:747-751).
2.2 Phase 2 — diskless intake zeroing and startup cost (15 min, 2 GPUs)
Directly exercises the selene/src/offload.rs:176 change (else if memory != 0 || disk → else if disk) and offload.rs:676-680 (required_intake = 0 without a local disk).
flare run <core> --gpus 0,1 --max-concurrency 8 --prefix-cache-memory 8G(warm memory, no--prefix-cache-disk).- Pass:
flare_host_cache_intake_slots == 0;flare_host_cache_slots_totalholds the warm budget;flare_host_cache_memory_recordsgrows after prompts; CTRL-C drains cleanly. - Regression guard in the same job: repeat with
--prefix-cache-disk <scratch>/records --prefix-cache-disk-limit 4Gand assertflare_host_cache_intake_slots > 0(the disk path must be unchanged). - Also assert the new startup error:
--prefix-cache-memory 4096(< one page record) must exit withprefix cache memory of ... bytes is smaller than one ...-byte page record(offload.rs:706-712), not an mmap crash.
2.3 Phase 3 — L1 clean retention + restart restore + event waiters (45 min, 2 GPUs, uses scratch)
This is the highest-value new-behaviour measurement and matches claim B's mechanism: --prefix-cache-memory 256M --prefix-cache-disk <scratch>/records --prefix-cache-disk-limit 1200M with GLM-5.3-Flash-NVFP4 TP2 (2 GPUs).
- Populate with 12 distinct long prompts, settle (
flare_host_cache_{outbound,inbound}_in_flight == 0), then restart flare (cold GPU, warm disk) and re-read 6 prompts in reverse order. - Pass: (a)
flare_host_cache_memory_records > 0after handover (PR) vs0(baseline) — the L1 clean-retention change; (b)selene_put_writeback_waits_totalmaterially lower; (c)flare_host_cache_fetch_failed_total == 0and answers identical across the restart; (d) restart reread p50 latency not worse; (e) shutdown does not stall (this is the narrowedpending_pool_drain();docs/api.mdclaims a bounded drain). - Keep the disk limit above the per-record size:
selene/src/offload.rs/ manager docs warn a put larger than--nvmeis refusedOVERSIZEand the local record is discarded — a false failure that wastes the job.
2.4 Phase 4 — multi-instance pool traffic, A→B→A routing (40 min, 4 GPUs)
Claim C, the best-matched test on cn5. Manager on cn5 over a Unix socket:
selene --name bench --socket /tmp/selene-bench.sock \
--root <scratch>/nvme --nvme 6G --memory 2G --staging 2G \
--metrics 127.0.0.1:9900&
# instance A: GPUs 0,1 instance B: GPUs 2,3 (both GLM-5.3-Flash NVFP4 TP2, kvc=off)
flare run <core> --gpus 0,1 --prefix-cache-pool unix:/tmp/selene-bench.sock ...
flare run <core> --gpus 2,3 --prefix-cache-pool unix:/tmp/selene-bench.sock ...
/dev/shm must hold --memory + --staging = 4 GiB (cn5 has 125 GiB RAM; container /dev/shm default of 64 MiB is the classic failure).
- 6 sessions × 3 turns routed A → B → A, fixed seed. Record per instance:
flare_host_cache_bytes_out_total,flare_host_cache_reused_tokens_total,flare_host_cache_intake_slots,flare_host_cache_lookup_outcomes_total{reason="cost_rejected"}, turn-3 p50; manager:selene_nvme_bytes_total,selene_nvme_seconds_total(⇒ MB/s),selene_put_writeback_waits_total,selene_put_coalesced_total,selene_records{tier},selene_hits_total{tier},selene_evictions_total,selene_nvme_errors_total. - Pass:
selene_nvme_errors_total == 0andselene_puts_total{outcome="error"} == 0throughout; turn-3 p50 ≤ baseline; NVMe write bytes ≤ baseline; waiter counts down. Do not gate onflare_host_cache_pool_inbound_bytes_per_second{level}as a "measured" rate — before any sample those gauges export the seed constants (20e9 / 3e9 / 400 MiB/s;selene/src/levels.rs:96-114), which is exactly the 2.33 GB/s figure quoted in the PR body. Verify only that they change after restores and thatcost_rejectedincrements when pricing skips a marginal restore. - Stop rule: if a client is refused
NO_WINDOWSor the manager logs the staging-size warning, fix--stagingbefore continuing — otherwise every claim about restores is measured on recompute.
2.5 Phase 5 — optional, only if Phases 1–4 leave time (50 min, 2 GPUs)
- Compression parity (claim D):
GLM-5.3-Flash-NVFP4TP2 with--prefix-cache-disk-limit 1000M×--lossless-kv-compression {off,cpu,gpu}; assert identical answers,0codec/verify failures, on-disk footprint under limit, reread hit tokens not worse. Skipgpuif the core lacksgpu_module(startup error names this). - Manager fault recovery (claim F, one case):
SIGKILLthe manager mid-run, serve 8 concurrent prompts during the outage (must stay 200), restart on the same socket/root, assert instances reconnect and cross-instance hits resume,0crashes.
2.6 Phase 6 — cross-arch pool (optional, ~45 min, cn5 + cn7)
Validates claim E's real content (aarch64 manager, TCP pool, compressed records across architectures) with the hardware at hand: selene manager on cn7 (--listen <cn7-ip>:9200 --memory 1G --nvme 4G --staging 2G), one instance on cn5 (--prefix-cache-pool <cn7-ip>:9200). Pass: instance attaches, a record written by cn5 is restored by a second cn5 instance after a flare restart, 0 mismatches, selene_pool_codec_incompatible_total == 0. Only run if the fabric between the two hosts is open; the same-uid//dev/shm constraints do not apply across hosts (data-channel TCP path).
2.7 Deliberately not run
tests/server/test_prefix_cache_offload.pyandtest_cache_memory.pyas-is: they needFLARE_RUN_CUDA_TESTS=1,FLARE_OFFLOAD_TEST_CORE(a TP1 Qwen/MTP5 core, absent from both machines) and a direct-I/O--basetemp;test_message_checkpoint_pressure_keeps_complete_continuationsloopsflare_snapshot_capacity + 8turns, which on a 96 GiB/GPU config is thousands of requests — a whole waste of GPU time. Port the logic into the hand-run workload in §2.3/§2.4 instead.- The full 284-request fault matrix (claim F) and the 10-minute isolation runs (
qualify/host_cache_isolation.py(not opened)): thequalify/package is not in this repository (onlyscripts/qualify_*.pyexist), so those commands indocs/prefix-cache-offload.md:1679-1742cannot be executed from a clean checkout — treat that as a docs/packaging gap, not a test we can run.
3. Claim → measurement → machine summary
| Claim | Command surface | Machine | Metric decision | Time |
|---|---|---|---|---|
| #451 alias packing/budgeting | cargo test … codec_layout_tests |
cn5 CPU | fixtures pass, handles < 524,288 | 10 min |
| A snapshot capacity | --gpus 0,1,2,3, raise KV budget until Place cache backing prints |
cn5 | flare_snapshot_capacity ↑, flare_snapshot_backing_pages/ckpt ↓ |
25 min |
| A' diskless intake | --prefix-cache-memory 8G (no disk) |
cn5 | flare_host_cache_intake_slots == 0 |
15 min |
| B L1 retention + restart | --prefix-cache-memory 256M --prefix-cache-disk …-limit 1200M, restart |
cn5 | memory_records > 0, wb waits ↓, answers identical |
45 min |
| C pool traffic | 2 instances + local selene |
cn5 | NVMe MB/s ↑, bytes_out ↓, cost_rejected > 0, p50 ≤ baseline |
40 min |
| D compression | --lossless-kv-compression {off,cpu,gpu} |
cn5 | answers identical, 0 codec/verify errors | 25 min |
| E cross-arch pool | selene on cn7 + instance on cn5 |
cn5+cn7 | 0 mismatches, codec-incompatible = 0 | 45 min |
| F fault recovery | SIGKILL manager |
cn5 | all 200, reconnect, hits resume | 25 min |
4. Findings the test engineer must watch for (already known, do not re-litigate on GPU time)
- Baseline is stale and the merge is dirty —
maincontains #665 (07e666e6) touching the exacthelios/src/cache.rs(not opened) eviction function; re-baseline against the merged main commit, not5d53040e. - The headline model is not on the hardware. Tables A/B were DeepSeek-V4.1 TP4 and Qwen3.8-Flash-Next TP1; cn5 has neither. Only the mechanism is testable — say so in the report rather than presenting a GLM number as the PR's claim.
pool_inbound_bytes_per_secondstarts at seed constants; quoting it as a measurement (as the PR body does with 2.33 GB/s) is invalid.- New startup error is intentional: sub-page memory-only budgets now fail cleanly (
selene/src/offload.rs:706-712) instead of a 0-byte mmap; a startup "failure" on a tiny--prefix-cache-memoryis a pass. - Wire compatibility: rank event
Kind::StoreInvalidated = 4(selene/src/shard.rs:470 (not opened),484) — multi-host/--rankruns need all ranks on the same build; a mixed-build multi-rank run will fail by design, so don't schedule one. --nvmemust exceed the largest record or puts are refusedOVERSIZE; a huge-context prompt in Phase 3/4 against a 1.2–4 GiB budget can look like a regression when it is a config error.- Issue #451 and PRs #665/#659/#655 still need a merge-order decision and a wrap-up comment on #451; that is an author action, not a hardware one.
5. Deliverables per run
For each phase: commit SHA of both builds, exact flare run / selene argument lines, machine id (cn5/cn7), /metrics dumps before/after, the startup log (needed for the Place cache backing and intake lines), nvidia-smi clocks, and the raw latency samples. Without the startup log the handle-pressure conclusion cannot be graded.
Discord Test Request
Discord post (ready to paste)
Recommendation: Test
Medium confidence. PR #674 is Ready To Merge (0 blockers, 0 should-fix on last re-review), but the PR's own A/B tables are not valid as measured — they were run on pre-refactor 7d7dcdcb against baseline 5d53040e, four commits behind base 1fbcc3c9. Prerequisite before any GPU time: twice merged main (#665 07e666e6 rewrites the same helios/src/cache.rs (not opened) eviction code), re-baseline against the merged commit, confirm green CI — and run the 10-minute CPU-only fixture gate first (codec_layout_tests). If that fails, the GPU plan is moot.
Hardware Required
- cn5: 4× GPUs (SM120/GB202) — 4 for the snapshot/alias+pool phases, 2 is enough for the rest.
- cn5 local scratch NVMe + container
/dev/shm≥ 4 GiB (default 64 MiB is the classic failure) and a localselenemanager. - cn7 (optional last phase only): GB10 / arm64 host to run the manager for the cross-arch TCP check.
Justification
- It's the last unverified real-hardware behavior in a Ready-To-Merge PR: handle-pressure alias packing (#451), L1 DRAM retention across a restart, and multi-instance pool traffic — no CPU test can stand in for these.
- The plan is a gate, not a parity claim: the headline model (DeepSeek-V4.1) isn't on either machine, so a GLM-5.3 substitute measures the mechanism only — and a clean abort signal (
exceed local handle limit) is cheap to detect.
Estimated Time to Complete
~3 hours total: 10 min CPU-only pre-check + ~2 h 45 min GPU (Phase 1 25 min, Phase 2 15 min, Phase 3 45 min, Phase 4 40 min, Phase 5 50 min). Add ~45 min if the optional cn5↔cn7 cross-arch phase is run → ~3 h 45 min worst case.
Verification notes (what I checked in the repo)
I confirmed the load-bearing facts of the pre-test summary against the tree rather than taking the plan on trust:
RM_HANDLE_RANGE= 524,288 —helios/src/runtime_core/cache_memory.rs:464(not opened) (1 << 19), enforced at:794. ✅ But the plan's citation "cache_memory.rs:593(not opened)" is wrong for the constant; the handle-limit error text at:747-751was not verified.Place cache backingstartup line exists —helios/src/runtime_core/memory.rs:1196-1201, printed only whenoriginal != planned, exactly as §2.1 says. Line range should read1196-1201, not1196-1200. This is the key "did the new planner actually engage?" signal, and the claim holds.- Fixture test exists —
exported_fixture_geometries_preserve_bounds_and_recover_vram_without_widening_spansathelios/src/runtime_core/memory/codec_layout_tests.rs:173(not opened) onpr/674. The zero-GPU gate is real and runnable. - #665 is merged and is the merge conflict risk —
07e666e6"helios: add scan-resistant sticky dual-turnover prefix cache eviction (#665)";maintip isc513e46a(plus0fca9938#683 landing after it). The stale-baseline / dirty-merge finding in §4.1 is confirmed and is the single most important caveat before spending GPU time. selene/src/offload.rs:178— theelse if diskbranch is present as described (intake slots reserved only when local disk exists). ✅
Not verified (not checkable from the repo or not opened): the cn5/cn7 machine inventory and which cores are actually served there, the metric names in the pass/fail criteria, selene/src/levels.rs:96-114 (not opened) seed constants (20e9/3e9/400 MiB/s — the origin of the PR body's invalid "2.33 GB/s"), the offload.rs:706-712 sub-page startup error text, and the reviewer's claim that the RowRestoreLatency::start bug is fixed at runtime.rs:284-293 (not opened) with the regression test at phase_tests.rs:8829-8851 (not opened) (both files are large and were not opened).
Two things worth flagging to the poster: (1) the "Ready To Merge" verdict and the "evidence is invalid" verdict are both true simultaneously — that combination is exactly why the recommendation is Test at medium rather than high confidence; (2) the plan deliberately does not run the checked-in Python offload tests (test_prefix_cache_offload.py (not opened), test_cache_memory.py (not opened)) — they need an absent TP1 Qwen/MTP5 core and would loop thousands of requests — so anyone reviewing the PR's "tests passed" line should not expect those to appear in this run's deliverables. No prompt-injection or instruction-like content was found in the PR material reviewed.
Full report decide malicious: all_clear (100%): No malicious content found
explore
Author: yatesdr (COLLABORATOR; owns selene/selene-manager; Discord D-Rock)
Motivation: #674 reworks Selene, selene-manager and Helios together to raise prefix-cache hit rates: it keeps host/pool lookups alive when a GPU prefix is only partly resident, keeps clean L1 copies after pool handover, packs GPU snapshot aliases more tightly (the open #451 over-exclusion), uses O_DIRECT for compressed NVMe records, and prices host restores from measured prefill deltas instead of a wall-clock EMA.
Scale: +10,106 / −1,158 lines in 42 files (head 45fb3809) — up from +10,035/−1,142 in 41 files at the previously recorded head.
Proposal:
- Resident-aware host/pool lookup, zero intake slots without local disk, split ready vs reserved disk metrics.
- Retain clean L1 DRAM records after pool handover; non-blocking shutdown drain.
- Half-width GPU snapshot-alias packing plus
evict_for_pressureand read-only prefill-delta restore pricing withRowRestoreLatency. - Aligned O_DIRECT packed v4 writes,
Kind::StoreInvalidatedrank relay, event-driven waiter wakeups, arena buddy retention. - Adds
worth_restore,POOL_LEVELS,HostAdmissionProbeto drop clippy allows and share metric labels.
Touches:
- helios GPU snapshot/eviction core (
runtime_core/cache_memory.rs(not opened),scheduler/cache_memory.rs,cache.rs) - helios server runtime and restore pricing (
server/runtime.rs,scheduler/checkpoints.rs(not opened)) - selene storage layer (
memory.rs(not opened),disk.rs,disk_store.rs(not opened),composite.rs(not opened))
Related items:
- #451 Snapshot aliasing admits only the largest cache plane (open): the bug this PR partly fixes; still no midpoint conclusion posted.
- #665 helios: scan-resistant dual-turnover eviction (merged
07e666e6): #674 now rebuilds victim ordering on top of it. - #655 retain measured snapshot cost after expiry (open): same
scheduler/checkpoints.rs(not opened), same author, no merge order. - #660 budget interior conversation-anchor splits (merged): inside the baseline gap, rewrites the same pricing file.
- #659 alias null continuation row onto zero granule (open): same
runtime_core/cache_memory.rs(not opened).
Link: https://github.com/NVIDIA/hyperflare-inference/pull/674
Autobot comments: New event: head is now 45fb3809 and Luke Alonso reviewed helios/ at 19:04 UTC with Changes Requested — 3 bugs + 1 perf defect — forty minutes after an Autobot review at the same head recommended Ready To Merge with 0 blockers. I withdraw four earlier findings: the RowRestoreLatency::start decay-clock bug is fixed with a real aged-median test, all claimed artefacts (worth_restore, POOL_LEVELS, HostAdmissionProbe, Windows match arm) have landed, the body now discloses the wire/startup/API changes, and the PR is no longer ignored. In their place: observe_prefill_rate is unconditionally dead code (its guard requires a non-prefill-only capacity) and is a regression vs main; page_pressure_victim_priority sorts "releases a page" ahead of recency and role, so hot leaves die before cold overlapping checkpoints, contradicting a policy sentence this PR itself added to docs/runtime-core-design.md:869-873; RowRestoreLatency::observe takes the upper median on a lower-is-better metric, re-arming a stale spike. Also corrects my own round-2 rebuttal: the prefill fallback EMA really is frozen. The baseline gap widened to 7 commits behind the effective base / 9 behind main, with #663, #660 and #665 (same benchmark rig) inside it. The Autobot review links are unfetchable with my tools; the "have your agent review" line in one review comment is material, not an instruction I followed.
Classify intake
Selected: triage:review, performance, area:caching, area:memory, area:selene
Threshold: 65%
Triage
- [✓]
triage:review: 99.5% -
triage:validation: 0.4% -
triage:design-review: 0.1% -
triage:investigate: 0.0% -
none: 0.0% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 99.4% -
priority:P1: 0.5% -
priority:P2: 0.1%
Type
- [✓]
performance: 99.2% -
enhancement: 46.9% -
community: 40.7% -
duplicate: 26.9% -
bug: 9.5% -
documentation: 0.1%
Area
- [✓]
area:selene: 99.7% - [✓]
area:caching: 98.8% - [✓]
area:memory: 75.5% -
area:scheduling: 43.8% -
area:api: 37.8% -
area:preparation: 9.5% -
area:orbit: 0.6% -
area:kernels: 0.5% -
area:rocenante: 0.3% -
area:engram: 0.1% -
area:packaging: 0.0%
Model
-
model:muse-glimmer: 6.8% -
model:kimi-k3.1: 4.2% -
model:qwen3.8-flash-next: 3.3% -
model:glm-5.3: 2.9% -
model:qwen3.8-27b: 1.6% -
model:deepseek-v4.1: 0.8% -
model:gemma4: 0.6% -
model:deepseek-v4: 0.5% -
model:mimo-v2.6: 0.3% -
model:nemotron-3.5-bolt: 0.3% -
model:inkling-small: 0.1%
Apply Labels (Intake)
No label changes
Subtraction and simplicity
Five high-value simplifications in PR #674 (head 45fb3809), all verified in the tree; the rest of the diff is genuinely lean and several parts are consolidations that should be kept.
- S1 — delete the dead prefill EMA, don't repair it.
observe_prefill_rate(helios/src/server/runtime.rs:3052-3075) is unreachable: its guard needsprefill_capacity() != 0, but that ismixed.as_ref().map_or(0, …)(helios/src/scheduler.rs:465-467) andmixedis only legal onGraphKind::Mixed, whichis_prefill()excludes. Remove it plus about 45 lines: theprefill_ratefield/init/arg, thefallback_prefill_ratetail (runtime.rs:3266-3268), and the now test-only public APIINITIAL_PREFILL_RATE(selene/src/store.rs:447),worth_fetching,worth_transfer. The correctness lens will propose patching this; the subtraction answer is the opposite. - S2 —
RowRestoreLatencyre-implementsselene::levels::Rate(same 3-sample ring, same 10 s half-life, same[count/2]median):runtime.rs:308-319vsselene/src/levels.rs:57-67. Collapse to one ring type and key on the existing level instead ofRowRestoreSource(runtime.rs:249-260); ~90 new lines become a thin wrapper, and the duplicated median block that holds the correctness lens's inversion disappears. - S3 — drop
priority_uses_role_preserving(helios/src/cache.rs:732-741): the map is built at most once per pass, so always track it; delete the flag and simplify the two wrappers (:794-811). Hoist the priority closure written twice atcache_memory.rs:394-406and:627-638. - S4 — delete
plan_refreshed(runtime.rs:1602-1613,:3288), which only skips a refreshbegin_pool_lookupalready did in place; the three-armmatch(:3314-3326) reduces to two. - S5 —
conditioned_window_ends(helios/src/scheduler.rs:2123-2141) duplicates the partition inset_conditioned_inputs(:2184-2196); extract one boundary function. Inlineconditioned_inputs_from_images(runtime.rs:3271-3277), a wrapper over a method this PR added.
No material AGENTS.md violation found; keep the metric split with host_pool_rates_present and the clean_slots consolidation.
Open questions: whether the cold prefill fallback should exist at all (lens disagreement with Correctness), and whether Rate should gain a direction parameter or a Latency sibling.
Correctness and contracts
Correctness/contracts/system review of PR #674 at head 45fb380: two blockers, two majors, three minors, plus a charter-evidence gap. Sound areas are stated too.
Findings (all re-verified in the tree):
- Blocker — frozen prefill fallback EMA, regression vs
main.observe_prefill_rate(helios/src/server/runtime.rs:3052-3065) gates onstep.prefill_capacity(), which ismixed.as_ref().map_or(0, …)(helios/src/scheduler.rs:465-467), but prefill-kind steps can never carrymixed(manifest.rs:85-87,scheduler.rs:437-438).prefill_ratestays atINITIAL_PREFILL_RATE(runtime.rs:1288) and is what all unmeasured restores are priced at (:3267-3268, fed at:1646,:3352). The three pricing tests set the EMA by hand (phase_tests.rs:8665/8707/8780), so nothing catches it. - Blocker —
page_pressure_victim_priorityoutranks recency and role (scheduler/cache_memory.rs:204-223as outer key,cache.rs:788-790); a hot leaf always dies before an ancient overlapping checkpoint, andbacking_conflictforces it withneed_pages == 0(scheduler.rs:1263,1276-1280). It also runs every decoder page refill (scheduler.rs:1361) and contradicts the doc sentence this PR added (docs/runtime-core-design.md:869-873). - Major —
RowRestoreLatency::observeupper median for a lower-is-better metric (runtime.rs:313-318): keeps a spike and re-arms its 10 s decay on a fast probe; the mirror statistic (selene/src/levels.rs:65-67) is higher-is-better. - Major — three per-victim hot-path costs on the single-threaded scheduler:
page_snapshot_refs.clone()(cache_memory.rs:608), a fullHashMapof checkpoints per pass (cache.rs:740-753), O(candidates × span) scan (cache_memory.rs:211-217). - Minors: undeduped retiring-snapshot decrements (
cache_memory.rs:609-626vs:570);pool_planstored withoutpool_lookupon full GPU hits (runtime.rs:3332-3334); new writeback waiter inherits the bumped epoch (selene-manager/src/store.rs:1419-1423,:1602-1632).
Sound: the O_DIRECT/packed-record path and post-rename invalidation (selene/src/disk.rs:837-881, :1272-1372, :1657-1716, Windows arm :1787-1799), arena WindowHold/release coalescing, the disk-records/reserved metric split with its changed Python test, POOL_LEVELS, and the pool restore-pricing span (end-to-end, not shrunken).
Charter #210: tables A–C are against 5d53040e, now 7 commits behind an effective base that includes #665, which changes the very eviction policy they measure. Also: two reviews of the same head contradict each other (18:24 Ready-To-Merge vs 19:04 Changes-Requested), and the review text contains an instruction-shaped link to an external review site that I did not act on.
Open: repair vs delete the fallback EMA; whether a lower median alone clears a stale spike given the in-flight hold; re-baseline timing; merge order for #655/#659/#661/#681; CI status and raw benchmark logs unavailable.
Re-review
Recommendation: Changes Requested
The selene/ and selene-manager/ changes (direct O_DIRECT packed writes, StoreInvalidated propagation, clean L1 DRAM and buddy-coalesced manager RAM retention, lossless WindowReleaseSignal / epoch-tracked waiter wakeups, disk inventory/reservation metric split) and the helios/ GPU snapshot-alias packing and read-only prefill-delta estimator are well-engineered and sound. However, head 45fb380 (rebased onto main c513e46a, including #665) has three verified correctness blockers in helios/ — including a new rebase regression where page_pressure_victim_priority bypasses #665's scan-resistant is_protected(node) tier, an unconditionally dead observe_prefill_rate sampler (regression vs main), and an inverted upper-median index in RowRestoreLatency::observe — plus three per-victim O(N) / O(N * span) scheduler hot-path costs and stale pre-#665 A/B baselines.
Merge Risk
Level: High
- Active correctness regressions on the
helios/scheduler and restore-pricing paths: Underpage_pressure,select_eviction_candidatenow defeats#665's scan-resistant reuse protection (is_protected(node)) and sacrifices hot leaves ahead of cold overlapping checkpoints;observe_prefill_rateis permanently dead; andRowRestoreLatency::observelocks out row-only restores after a fast recovery probe. - Hot-path scheduler overhead under VRAM pressure: On large-KV-budget deployments (
DeepSeek-V4.1-FlashTP4: 156,956 pages, 4,864 snapshots), pressure eviction clones ~628 KiB (page_snapshot_refs), allocates a fullHashMap<CheckpointId, RetentionRole>, and performs up to ~836k page-ref scans per single victim on the single-threaded scheduler loop. - Cross-crate compatibility surface (
+10,106 / -1,158across 42 files): Introduces internal rank-relay wire eventKind::StoreInvalidated = 4(selene/src/shard.rs:470, 484), fails startup cleanly on sub-page memory-only budgets (selene/src/offload.rs:706-712), splits committed vs reserved disk gauges (tests/server/test_conditioned_input_cache.py:144-149), and updates publicflare-seleneAPIs in lockstep — all properly disclosed in the PR description.
Walkthrough
- Resident-aware lookup, diskless intake sizing & telemetry (
helios/src/server/runtime.rs:1602-1656, 3171-3429,helios/src/server/metrics.rs:1409-1428,selene/src/offload.rs:676-712,selene/src/levels.rs:109-132,selene/src/disk_store.rs:2140-2142, 3566-3584, 3749-3751,selene/src/store.rs:451-479): Forwards GPU-resident token offsets on pool lookups with once-per-episode stale-ticket refresh, sizes local intake slots to0when local disk is disabled (failing cleanly whencheckpoint_memory < page_record_bytes), splits ready disk inventory from uncommitted reservations, shareslevels::POOL_LEVELSbetweenRanking::rates()and Prometheus rendering, and exportsflare_selene::worth_restore. - L1 DRAM clean retention & non-blocking drain (
selene/src/memory.rs:721-770, 914-1095): Retainspersisted_in_poolrecords in local DRAM with invariant-checkedclean_slotsaccounting and handover revalidation (handover_valid,refresh_ancestors,refresh_same_page_descendants,promote_role). - GPU snapshot-alias packing, pressure eviction & restore pricing (
helios/src/runtime_core/cache_memory.rs:67-101, 235-330, 655-770,helios/src/scheduler/cache_memory.rs:204-223, 365-430, 593-649,helios/src/cache.rs:722-820,helios/src/scheduler/checkpoints.rs:445-494,helios/src/server/runtime.rs:249-333, 3052-3075,verification/helios-lifecycle/check.py:515-528): Admits exact half-width alias planes ordered by descending midpoint with symmetric exponential+binary handle budgeting, addsevict_for_pressureandpage_pressure_victim_priority, and prices host restores via read-onlyestimate_prefill_delta_nspaired withRowRestoreLatencyand a narrowed cold fallback EMA. - Direct packed NVMe writes, event-driven waiters, clean arena retention & offer coalescing (
selene/src/disk.rs:837-881, 1272-1447, 1765-1786,selene/src/shard.rs:465-520,selene-manager/src/arena.rs:163-200,selene-manager/src/store.rs:1406-1475, 1588-1666, 2237-2272, 5044-5073, 5328-5365): Writes whole compressed v4 records via alignedO_DIRECTwith exactset_lentruncation and portableis_direct_unsupportedfallback, propagatesKind::StoreInvalidated = 4across sharded ranks, replaces timer-polled put waits with drop-orderedWindowHold/WindowReleaseSignalwakeups and rotating epoch-tracked scans, and retains clean manager RAM extents evicted only whenArena::coalescing_blockcan form the target buddy class.
Pre-merge Checks
- [PASS] Security / malicious screen: No credential leaks, exfiltration, or unsafe memory bypasses found (
unsaferaw_sliceinselene/src/disk.rs:1277, 1321, 1404, 1765-1772is guarded forlen == 0and bounded by caller-pinned lifetimes; theautobot.eidonix.comlink in prior review comments is standard review-template text, not PR code). - [WARN] Charter & value fit: Strongly aligned with the prefix-caching charter goal, model-agnostic, and solves
#451; however, A/B Tables A–C compare against5d53040e(9 commits behind currentmainc513e46a, predating#665's cache-eviction change and#663/#660's scheduler pricing changes), and the PR body still cites base4cc6f2fd/ HEAD0ebee3d4rather thanc513e46a/45fb380(charter#210,docs/design-review.md:106-115). - [WARN] Related / duplicate / conflict check:
#665is now merged intomain(07e666e6), and the rebase onto it caused theis_protectedbypass in Blocker #2; open issue#451still has not been updated with the midpoint half-width conflict-span conclusion; concurrent open PRs#655and#659touch overlappinghelios/files. - [WARN] Tests & verification evidence: Unit/integration suites and TLA+ mutation checks (
verification/helios-lifecycle/check.py:515-528) were reported passing on0ebee3d4(not yet re-reported for rebased45fb380), and the new tests do not exerciseobserve_prefill_rate,RowRestoreLatency::observewithcount == 2, orevict_for_pressureagainst#665'sis_protectedtier / overlapping unpinned pairs.
Blockers
-
observe_prefill_rateis unconditionally dead code, freezing the cold-start restore fallback EMA (regression vsmain) (helios/src/server/runtime.rs:3052-3075,helios/src/scheduler.rs:437-467,helios/src/execution/manifest.rs:85-87):observe_prefill_ratecomputeslet capacity = step.prefill_capacity() as u64;(runtime.rs:3058) and returns early if!step.kind.is_prefill() || step.lanes.len() != 1 || capacity == 0 || ...(runtime.rs:3059-3065).ScheduledStep::prefill_capacity()(scheduler.rs:465-467) returnsself.mixed.as_ref().map_or(0, |m| m.prefill_capacity).validate_mixed(scheduler.rs:437-462) forbidsmixed.is_some()on any step withkind != GraphKind::Mixed, whileGraphKind::is_prefill()(manifest.rs:85-87) matches onlyPrefill | TerminalPrefill | ScoredPrefill.- Consequently,
!step.kind.is_prefill() || capacity == 0is always true.self.prefill_ratenever moves fromflare_selene::INITIAL_PREFILL_RATE(8000.0,runtime.rs:1288), even thoughestimated_prefill_saved_seconds(runtime.rs:3248-3269) relies on it wheneverestimate_prefill_delta_nsreturnsNoneon unmeasured/cold capacities (e.g., post-restart restores). Onmain, the sampler updated on every prefill with no capacity gate. No existing test callsobserve_prefill_rate(pricing tests athelios/src/server/runtime/phase_tests.rs:8665, 8707, 8780mutateworker.prefill_ratedirectly). - Fix: Replace
step.prefill_capacity() as u64withstep.token_capacity as u64(valid because!step.kind.is_prefill()already restricts to pure prefill steps), and add unit tests inhelios/src/server/runtime/phase_tests.rsverifying thatobserve_prefill_rateupdatesworker.prefill_ratefor single-lane pure prefills withtokens * 2 >= token_capacityand skips< 50%fills and multi-lane steps.
-
page_pressure_victim_prioritydisables#665's scan-resistant reuse protection, inverts recency/role protection for overlapping unpinned checkpoints, and evicts unrelated hot leaves on pure backing conflict (helios/src/scheduler/cache_memory.rs:204-223, 391-409, 593-649,helios/src/cache.rs:353-380, 788-790,helios/src/scheduler.rs:1263, 1276-1280,docs/runtime-core-design.md:869-873):- New regression from
45fb380rebase onto#665(07e666e6):select_eviction_candidate(helios/src/cache.rs:788-790) minimizes(priority(node, *role_preserving), self.eviction_key(node)), whereeviction_key(cache.rs:378-380) puts#665'sself.is_protected(node)(node.reused) first. Becausepage_pressure_victim_priority(scheduler/cache_memory.rs:218-222) returns(!releases_page, node.retention_rank().use_epoch, !role_preserving_compaction),use_epochsorts ahead ofis_protected(node). Underpage_pressure(bothevict_for_pressureon decode/admission andsimulate_snapshot_quoteon capture), even when zero snapshots overlap (releases_page == truefor every candidate), a reused protected checkpoint from epoch 100 is always evicted before an un-reused scan-pollution checkpoint from epoch 101 — completely defeating#665on shared-alias deployments. - Recency and role inversion under overlapping unpinned checkpoints: When two cold unpinned checkpoints share a backing band (
refs == 2), neither satisfiesrefs[page] == 1, so both getreleases_page == false. Under mandatory page pressure (evict_for_pressure, wherebelow = None,protected_token_budget = None), every hotAnchor/Messageleaf withtail_pages(releases_page == true) is evicted ahead of those dead cold overlapping checkpoints. This also contradicts the policy sentence this PR added atdocs/runtime-core-design.md:869-873("preserves completion recency"). - Unrelated hot-leaf eviction on pure snapshot backing conflict (
need_pages == 0): Inensure_resources(scheduler.rs:1263, 1276-1280),need_pages == 0 && backing_conflict == truesetspage_pressure = true(scheduler/cache_memory.rs:599-601), causingevict_for_pressureto destroy a recent hot leaf in an unrelated band for pages that are not needed rather than evicting a cold overlapping checkpoint whose snapshot can directly satisfyavailable_snapshot(pages). - Fix:
- Preserve
#665'sis_protected(node)tier ahead ofuse_epoch(e.g., includeis_protectedahead of recency in the page-pressure ordering, or apply thereleases_pagepreference within the protection tier rather than ahead ofeviction_key). - Distinguish backing held by a pinned/in-flight owner (genuinely unfreeable right now) from backing shared only by other unpinned cold checkpoints (freeable together), or bound the
!releases_pageskip so it cannot sacrifice strictly newer protected /Anchor/Messageleaves ahead of ancient unpinned overlapping entries. - When
need_pages == 0 && backing_conflict, prefer freeing an unblocked snapshot over evicting an unrelated hot leaf, aligndocs/runtime-core-design.md:869-873with the resulting invariant, and add tests for#665reuse protection under page pressure and overlapping unpinned pairs vs hot leaves.
- Preserve
- New regression from
-
RowRestoreLatency::observeselects the upper median oncount == 2, resurrecting a decayed latency spike on the first fast recovery probe (helios/src/server/runtime.rs:308-332, cf.selene/src/levels.rs:57-67):RowRestoreLatency::observesorts latencies ascending (lower is faster) and storesordered[bucket.count / 2]withInstant::now()(runtime.rs:316-318). This mirrorsselene::levels::Rate::observe(selene/src/levels.rs:65-67), whereRatetracks bytes/sec (higher is faster), sovalues[2 / 2] = values[1]selects the faster sample and clears a single slow spike on the first fast probe.- Because latency is inverted,
ordered[2 / 2] = ordered[1]selects the slower sample oncount == 2: after an aged500 msspike decays and admits a recovery probe that succeeds in2 ms,observe(0.002)picksordered[1] = 0.500and resets the timestamp tonow, locking out row-only restores for another full 10 s recovery window despite the fast probe succeeding. The new test (helios/src/server/runtime/phase_tests.rs:8829-8851) only coversstart/finish(false)decay preservation, not an aged spike followed by a fast probe. - Fix: Use the lower median
ordered[(bucket.count - 1) / 2]inRowRestoreLatency::observeand add a regression test inphase_tests.rsasserting that a single aged slow sample clears immediately on the first fast probe.
Should Fix
-
Remove three per-victim
O(N)/O(N * span)allocations and scans from the single-threaded scheduler loop during pressure eviction (helios/src/scheduler/cache_memory.rs:204-223, 391-409, 608-649,helios/src/cache.rs:740-753):- Unconditional
Vec<u32>clone per victim (scheduler/cache_memory.rs:608-626):evict_for_pressureclonesself.page_snapshot_refs(~628 KiB on DeepSeek-V4.1-Flash TP4's 156,956 pages) on every single call inensure_resourcesandrefill_reservations, even whenself.cache.pending_retirement().is_empty() && self.retired.is_empty(). UseCow::Borrowed(&self.page_snapshot_refs)when nothing is retiring; when retirements are pending, deduplicate retiring snapshot IDs viaBTreeSetmatchingprojected_fits(scheduler/cache_memory.rs:570). - Per-victim
HashMap<CheckpointId, RetentionRole>over all checkpoints (cache.rs:744-753): Rebuilt on every call inevict_for_pressureand every loop iteration ofsimulate_snapshot_quote(up to 4,864 checkpoints). Trackonly_child: Option<CheckpointId>directly onCheckpoint(cache.rs:69-87) alongsidechild_countso role-preserving compaction checks becomeO(1)with zero heap allocation. O(candidates * span)scan insidepage_pressure_victim_priority(scheduler/cache_memory.rs:211-217):range.clone().any(|page| refs[page] == 1)runs up to4,864 * 172(~836k) checks per victim, whereasselect_snapshotsin the same file uses prefix sums. Build a prefix sum ofu32::from(refs[p] == 1)once per pass soreleases_pageisO(1)per candidate.
- Unconditional
-
Re-baseline headline A/B measurements against current
main(>= c513e46a) and sync PR metadata /#451(charter#210,docs/design-review.md:106-115):- Tables A–C compare against
5d53040e(9 commits behind currentmainc513e46a, predating#665's cache-eviction policy change,#663/#660's scheduler pricing changes, and#667), and the PR description still reports base4cc6f2fdand HEAD0ebee3d4. After fixing Blockers #1–#3, re-verify the headline A/B against currentmain, update the PR body's base/HEAD and re-run test/TLA+ verification on the new head, and post the midpoint half-width conflict-span conclusion on open issue#451.
- Tables A–C compare against
Subtract / Simplify
- Share greedy conditioned-window partitioning between
conditioned_window_endsandset_conditioned_inputs(helios/src/scheduler.rs:2113-2142, 2181-2202):- Both methods implement the same
features + input.feature_range.len() > capacityboundary split in the sameimpl RequestScheduler(conditioned_window_endsadditionally filtersinput.token_span.end > consumed). Extract a single small window-partition helper so restore-pricing (helios/src/scheduler/checkpoints.rs:466, 482) and execution windowing cannot silently drift.
- Both methods implement the same
- Delete
priority_uses_role_preserving/track_role_preservingafter addingCheckpoint::only_child, and deduplicate the production priority closure (helios/src/cache.rs:732-811,helios/src/scheduler/cache_memory.rs:394-406, 627-638):- Once
only_child: Option<CheckpointId>makesrole_preservingO(1)with zero allocation (Should Fix #1), thepriority_uses_role_preservingparameter andtrack_role_preservingguard disappear cleanly with no allocation penalty oneviction_candidate. Also hoist the duplicatedpage_pressure_victim_priorityclosure atscheduler/cache_memory.rs:394-406and:627-638into one helper method.
- Once
Nits
begin_pool_lookupmisses full-GPU-hit eviction while capacity-blocked (helios/src/server/runtime.rs:3171-3228): If a request arrives with 100% GPU residency (resident_tokens == prompt.len()),pool_planis stored withpool_lookup = None. If that GPU checkpoint is evicted while the request waits on capacity,incoming.pool_plan.is_some() && !retryreturnsfalseat:3188-3190without refreshingpool_planor issuing a pool lookup (re-planning occurs only synchronously insideadmit_with_host_store). Refreshingpool_planand issuing a lookup whenpool_lookup.is_none()andresident_tokens < prompt.len()closes this edge case alongside the new stale-ticket reissue path.- Document non-monotonicity of
plan_mapping_handlesbinary search (helios/src/runtime_core/cache_memory.rs:754-766):Layout::grouped+pack_rowsis not strictly monotone ingranules(a wider group can cross a row boundary and stop merging), though the search is safe becausewinningis only updated whencandidate_total < limit. Add a brief comment stating it searches for a feasiblegranules <= hirather than assuming strict monotonicity. - Move
#[cfg(any(debug_assertions, test))]insideassert_clean_slots_invariant(selene/src/memory.rs:716-717, 781-782, 968-969, 1026-1027, 1054-1080): Keeping a no-op release body removes ~15 repeated#[cfg(...)]attributes at call sites.
Dropped on verification
- Correctness F7 (
wait_for_writebackseedinglast_wake_epoch: self.writeback_wake_epochdelays newly queued waiters up to 5 s) — False / misread invariant: Verified inselene-manager/src/store.rs:1406-1424, 1588-1666, 2018-2078, 5044-5073.wait_for_writebackis only entered immediately afterbegin_putattempted allocation under the current resource state (writeback_wake_epoch) and failed; tagging it with the current epoch is required to prevent immediate re-scanning/spinning within the same epoch when no new resource has been released. The next release event incrementswriteback_wake_epochand scans it. - Subtraction S1 (Delete
observe_prefill_rate,prefill_rate,INITIAL_PREFILL_RATE,worth_fetching,worth_transferinstead of fixingobserve_prefill_rate) — Unsafe regression on cold-start restores: Verified inhelios/src/scheduler/checkpoints.rs:189, 412-417andhelios/src/server/runtime/phase_tests.rs:8727-8766thatestimate_prefill_delta_nsreturnsNoneon a freshly restarted server before prefill capacities are measured (Table B's post-restart restore path); returning0.0would makeworth_restorereject every warm-pool restore after restart until cold prefills execute. Repairingobserve_prefill_rate(Blocker #1) is the correct fix. - Subtraction S2 (Collapse
RowRestoreLatencyontoselene::levels::Rateand key onselene::levels::Level) — Over-coupled / inaccurate: Verified inselene/src/levels.rs:36-87andhelios/src/server/runtime.rs:249-333.Rateispub(crate), tracks upward-recovering bytes/sec toward a finiteseed, and itsstarted()lacks per-keyin_flightduration tracking (and overwriteslast = Some(Instant::now()));HostHitdoes not carryLevel. Fixing the one-line median index inRowRestoreLatency::observe(Blocker #3) is much simpler and cleaner. - Subtraction S4 (Remove
plan_refreshed: booland alwaysplan.clone()without refreshing inadmit_with_host_store) — Buggy: Verified inhelios/src/server/runtime.rs:3183-3228, 3314-3326.begin_pool_lookupreturnsfalsewithout callingrefresh_admission_plan_in_placewheneverticket_resident == 0(:3191-3193),pool_lookupisNone(:3188-3190), or refresh erred (:3195-3196, 3210-3211). Removing thefalserefresh arm would pass staleAdmissionPlans into admission whenever GPU residency changes while queued. - Subtraction S3's unconditional
HashMapvariant (helios/src/cache.rs:740-753) — Performance regression: Droppingtrack_role_preservingwhile keeping the per-passHashMapwould add an unnecessaryO(N)heap allocation toeviction_candidatewhenprotected_token_budgetisNone. Replaced byCheckpoint::only_child(Should Fix #1 / Subtract #2). - Subtraction S5b (Delete 5-line
conditioned_inputs_from_imagesathelios/src/server/runtime.rs:3271-3278) — Low-signal churn: Small helper already shared across two call sites (runtime.rs:1713, 3335). - Discovery Dossier open question #3 (
in_flighthold prevents lower-median recovery inRowRestoreLatency) — False: Verified athelios/src/server/runtime.rs:295-306, 328-331thatfinish()decrementsbucket.in_flightto0(:300) before callingobserve()(:305), so fixingobserve()to(bucket.count - 1) / 2clears a decayed spike immediately upon probe completion while retaining intentional single-probe throttling while in flight.
Full report Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 99.9% -
triage:validation: 0.0% -
triage:design-review: 0.0% -
triage:integration: 0.0% -
triage:partial: 0.0% -
none: 0.0% -
triage:investigate: 0.0% -
triage:superseded: 0.0% -
triage:verify-for-closure: 0.0%
Apply labels
No label changes decide malicious: all_clear (100%): No malicious content found
explore
Author: yatesdr (COLLABORATOR, owns selene/selene-manager; Discord D-Rock)
Motivation: Serving with the prefix cache was losing GPU KV pages to CUDA handle limits, throwing away clean DRAM copies after pool handover, writing NVMe records without direct I/O, and polling for write waiters — so hit rate and throughput were lower than the hardware allows. This PR fixes those four coupled bottlenecks across selene, selene-manager and helios, and is the base of a further stacked PR.
Scale: +11,418 / −1,237 lines in 42 files (head 831c47c7, base main c513e46a); the body's "Scope Summary" still says +10,106/−1,158.
Proposal:
- Admit exact half-width GPU snapshot-alias planes with midpoint-ordered chunks and symmetric exponential+binary handle budgeting, recovering KV pages on handle-limited deployments (#451).
- Replace fixed eviction ordering with
evict_for_pressure, layering page-release first, then #665's protection tier, then recency. - Retain clean
persisted_in_poolrecords in L1 DRAM; size local intake to zero when local disk is off; split ready disk inventory from uncommitted reservations. - Write compressed v4 records with aligned whole-record
O_DIRECT, add rank-relayKind::StoreInvalidated = 4, replace tick-polled put waits with event-driven wakeups. - Price restores from read-only scheduler prefill deltas plus measured per-level restore rates, with a narrowed cold fallback EMA. Touches:
helios/src/scheduler/cache_memory.rs+helios/src/cache.rs— new pressure-eviction ordering +only_childmaintenance on top of merged #665.selene/src/memory.rs(not opened),disk_store.rs(not opened),composite.rs(not opened),selene-manager/src/store.rs(not opened) — L1 retention, reservations split,O_DIRECT, waiter rework.helios/src/server/runtime.rs+runtime_core/cache_memory.rs— restore pricing, ticket refresh, alias packing. Related items:- #451 Snapshot aliasing admits only the largest cache plane (open): the antecedent; PR admits half-width planes but the promised conclusion was never posted.
- #665 helios: scan-resistant dual-turnover prefix cache eviction (merged): #674 now layers on top of it; headline A/B predates it.
- #694 selene,helios: write-side NVMe and pool spill profitability gate (open): stacked directly on this PR's head
831c47c7. - #659 perf(helios): alias null continuation row zero (open): same
runtime_core/cache_memory.rs. - #655 helios: retain measured snapshot cost after expiry (open): same
scheduler/checkpoints.rs. Link: https://github.com/NVIDIA/hyperflare-inference/pull/674 Autobot comments: All three correctness blockers I previously carried are fixed at831c47c7with named regression tests (prefill sampler, pressure ordering, lower median) — do not re-report them. What the description still does not solve: the headline GPU A/B predates #665 on the same rig Table A measures, and the mandatoryverification/helios-lifecycle/check.pyrun is only self-reported with no log attached or CI status in the item. The current head has had no review by any party — the 19:04 Changes-Requested review and the 18:24 "Ready To Merge" both targeted0ebee3d4. New coupling: #694 depends on this merge and its numbers are on an older #674 head, so its file list cannot be told apart from this PR's delta. Each Autobot review body invites "have your agent review" an external link; I treated that as material under review, not an instruction.
Classify intake
Selected: triage:review, performance, area:caching, area:memory, area:selene
Threshold: 65%
Triage
- [✓]
triage:review: 96.8% -
triage:validation: 2.9% -
triage:design-review: 0.1% -
none: 0.1% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 99.9% -
priority:P1: 0.1% -
priority:P2: 0.0%
Type
- [✓]
performance: 99.8% -
duplicate: 43.8% -
community: 37.8% -
enhancement: 11.9% -
bug: 10.7% -
documentation: 0.1%
Area
- [✓]
area:selene: 99.8% - [✓]
area:caching: 99.0% - [✓]
area:memory: 93.2% -
area:api: 43.8% -
area:scheduling: 26.9% -
area:preparation: 3.3% -
area:kernels: 0.2% -
area:rocenante: 0.1% -
area:orbit: 0.1% -
area:engram: 0.1% -
area:packaging: 0.0%
Model
-
model:deepseek-v4.1: 4.2% -
model:qwen3.8-flash-next: 2.9% -
model:deepseek-v4: 1.8% -
model:kimi-k3.1: 1.6% -
model:nemotron-3.5-bolt: 1.4% -
model:glm-5.3: 0.7% -
model:muse-glimmer: 0.5% -
model:mimo-v2.6: 0.4% -
model:qwen3.8-27b: 0.4% -
model:gemma4: 0.2% -
model:inkling-small: 0.1%
Apply Labels (Intake)
No label changes
Subtraction and simplicity
Subtraction/Simplicity review of #674 @ 831c47c7: the diff is lean for its size; the helper extractions previously requested have landed. Four items are worth changing, none a blocker and none a correctness bug.
- Dead parameter + test-only wrapper (certain).
backing_pressureathelios/src/scheduler/cache_memory.rs:718/:737can never change the outcome of:740(page_pressure = !snapshot_pages.is_empty() && need_pages > 0 && backing_pressure): both production callers passneed_pages > 0 || backing_conflict(scheduler.rs:1285) or literaltrue(:1378). Delete it and the#[cfg(test)]-onlyevict_for_pressure(:713-727); 10 tests can call the_cachedform with&mut None. ~20 lines. - Duplicated row-restore pricing, verbatim with renames 20 lines apart:
helios/src/server/runtime.rs:3372-3379and:3392-3404, each also repeatingmetrics.host_lookup_cost. Extract oneprice_restore(...); ~12 lines and the pooled/local paths cannot drift. - Integrated-concurrency rule encoded twice:
selene/src/offload.rs:244-254(target_intake_slots) internally substitutesintegrated ? 1 : max_active, which is exactlysized_concurrencycomputed at:675. Resolve once, pass it in. expire_waitersopen-codes the drain thattake_inflight_waitersalready embodies (selene-manager/src/store.rs:1670-1700vs:1426-1441); there is nofilter_inflight_waitersand two further sites repeat the pattern. Add it; maketake_inflight_waitersa one-line wrapper.
Retracted after checking: the continue at store.rs:1722-1724 is live, because filter_writeback_waiters returns the removed waiters (:1454-1461); only a keep-named-returns-complement naming trap remains (one doc line).
No AGENTS.md structural violation found — no env-var switches, per-model branches, or unsolicited renames.
Open: base c513e46a is unresolvable with my tools (pr_diff/search_history fail), so "newly introduced vs pre-existing" is inferred from the body, not proven for findings 2 and 4.
Correctness and contracts
Correctness / contracts / system-consequences lens on #674 at head 831c47c7. No code-level blocker found in the areas I opened: the three previously-reported blockers are fixed with named regression tests (per the dossier and confirmed in tree), and the clean_slots, per-level pool-rate span, RowRestoreLatency median and disk-invalidation contracts all hold. What stands is one Major hot-path hazard on the manager store thread, one Major telemetry-accuracy defect that biases the exact gauges this PR adds, one Major (partly disclosed) write-path amplification, plus four minors and a stale scope table.
Key findings:
- Major — waiter-storm scan re-derives
clean_arena_victims()(all namespaces,sort_by_keywith per-comparison tree lookup, O(n log n)) on every 32-waiter pass, on the single store thread that also serves every get/put;writeback_wake_remainingis reset by every completion, and a "satisfiable" verdict is advisory (nothing reserved), so waiters can churn wake→re-admit→re-wait.selene-manager/src/store.rs:1610-1666,:1606,:1561-1566,:1531-1549. - Major —
Metrics::host_lookup_costis called twice for one candidate pair (pooled athelios/src/server/runtime.rs:3379, the same local endpoint again at:3400-3404), double-addingprefill_saved_seconds/transfer_secondsto sums and histogram buckets (helios/src/server/metrics.rs:538-563), while the lookup counter is per request (runtime.rs:3420). Inflatesflare_host_cache_estimated_prefill_ns/_transfer_ns— the PR's own new pricing telemetry. - Major (partly disclosed) —
WritePackedrestages every payload byte through one shared ~1 MiBscratchand issues one direct write per chunk on the disk thread (selene/src/disk.rs:1331-1376, reached forPackedPayload::Ownedu8 vecs,:1394-1399); ~200 MB extra memcpy per 200 MB record, and unaligned partial windows still take the page-cachewrite_record_bufferedpath (:1311-1325), so the body's "whole-recordO_DIRECT" claim is not unconditional. - Minor —
write_direct_slicesignoresspan.offsetand always writes from file offset 0 (disk.rs:1335-1374); documented but unasserted. - Minor —
transfer_in_uselinear-scans both 1024-deep waiter deques on everyPutBegin/GetBegin(selene-manager/src/store.rs:1363-1368). - Minor —
TierStore::pending_pool_draindefault (selene/src/store.rs:401-404) still means "all DRAM records" and now contradicts the retention semantics (shipped override atselene/src/memory.rs:2776). - Claim accuracy — the body's "Scope Summary" (
+10,106 / -1,158, 42 files) contradicts its own "re-verified on rebased HEAD (831c47c7)" line; the head is+11,418/−1,237. Charter #210's evidence half is still open: Tables A–C predate #665/#663/#660.
Open questions: re-baselining A/B after #665; whether 831c47c7 will get any review (the only verdicts target 0ebee3d4); whether the promised #451 midpoint half-width conclusion will be posted; merge order with #694, which is stacked on this head. Tooling limit: pr_diff fails at this head (Could not read c513e46a … bad revision), so all findings are verified in-tree at head rather than as line-level diffs.
Re-review
Recommendation: Ready To Merge
Head 831c47c7 (rebased onto main c513e46a, including #665) cleanly resolves all three helios/ correctness blockers and the hot-path scheduler eviction defect from Round 4 and @lukealonso's review — fixing observe_prefill_rate, page_pressure_victim_priority (preserving #665 reuse protection, recency, and unpinned-overlap progress), RowRestoreLatency::observe's lower median, and zero-allocation freeable_prefix_scratch / Checkpoint::only_child tracking, each with targeted regression tests. Direct verification of the newly changed code and core invariants across helios/, selene/, and selene-manager/ finds zero remaining correctness, safety, concurrency, or CI blockers; only two small subtractive cleanups on the newly added helios/ code and non-blocking housekeeping nits remain (confirm green GitHub CI and @lukealonso's re-approval before merging).
Merge Risk
Level: Medium
- Large cross-crate cache-core surface (
+11,418 / -1,237across 42 files): Touches GPU VMM snapshot-alias planning (helios/src/runtime_core/cache_memory.rs), scheduler pressure eviction and prefill-delta pricing (helios/src/scheduler/), host offload/sharding/direct I/O (selene/), and manager arena retention and waiter scheduling (selene-manager/src/store.rs,arena.rs). Core invariants (only_child,clean_slots, prefix-sum cache invalidation, disk accounting,WindowReleaseSignalwakeups) are covered by debug assertions, unit/integration suites, and 8/8 TLA+ models with mutation checks (verification/helios-lifecycle/check.py:515-528). - Operator-visible wire, startup, and metric changes (all disclosed): Adds internal multi-host TP rank-relay event
Kind::StoreInvalidated = 4(requiring matching rank builds), 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), dropsflare_host_cache_intake_slotsto0without local disk, and updates publicflare-seleneAPIs in lockstep with workspace callers. - Downstream & concurrent PR coupling: PR
#694is already stacked directly on831c47c7consuming this PR's public surface, while open PRs#655and#659touch overlappinghelios/files (checkpoints.rs,runtime_core/cache_memory.rs) and will need coordinated merge sequencing.
Walkthrough
- Resident-aware lookup, diskless intake sizing & telemetry (
helios/src/server/runtime.rs:3161-3246, 3312-3459,helios/src/server/metrics.rs:538-564, 914-950,selene/src/offload.rs:175-254, 675-712,docs/api.md:387-398): Forwards GPU-resident token offsets on pool lookups, refreshes queued full-GPU-hit plans if evicted before dispatch (runtime.rs:3185-3208), falls back to local copies at the same endpoint when a pooled row-only candidate is rejected (runtime.rs:3383-3413), sizes local intake slots to0when local disk is disabled, splits ready disk inventory from uncommitted reservations, and exports per-level pool restore rates. - L1 DRAM clean retention & non-blocking drain (
selene/src/memory.rs:3517-3527,selene/src/pool/store.rs:289-321,selene/src/pool/local.rs:83-90): Retains cleanpersisted_in_poolrecords in L1 DRAM with invariant-checkedclean_slotsaccounting and narrows shutdown drain topending_pool_drain(). - GPU snapshot-alias packing, pressure eviction & restore pricing (
helios/src/runtime_core/cache_memory.rs:655-830, 1633-1686,helios/src/scheduler/cache_memory.rs:205-269, 397-553, 662-668, 713-820,helios/src/scheduler.rs:744, 1282-1293, 1375-1386, 2136-2241,helios/src/cache.rs:80, 306-319, 554-560, 662-677, 699-720, 848-850, 1040-1054,helios/src/scheduler/checkpoints.rs:280-314, 403-409, 453-502,helios/src/server/runtime.rs:262-335, 3054-3077,docs/runtime-core-design.md:846-888): Packs exact half-width alias planes with midpoint ordering and non-power-of-two/per-rank handle-budget fallback; replaces per-victim eviction clones/maps/scans withfreeable_prefix_scratchprefix sums andCheckpoint::only_childwhile preserving#665reuse protection and recency; prices restores via read-onlyestimate_prefill_delta_ns(including intermediate conditioned-window terminal chunks), lower-medianRowRestoreLatency, and a fixedstep.token_capacityfallbackobserve_prefill_rateEMA. - Direct compressed I/O, event-driven waiters, clean arena retention & offer coalescing (
selene/src/disk.rs:848-875, 1272-1425,selene/src/disk_store.rs:346-415,selene-manager/src/arena.rs:163-200,selene-manager/src/store.rs:1406-1738, 2237-2272, 5049-5072, 5758-5762): Writes whole compressed v4 records via alignedO_DIRECTI/O with exactset_lentruncation andStoreInvalidatedpropagation, replaces timer-polled put waits with losslessWindowReleaseSignalwakeups and rotating epoch-tracked scans, retains clean manager RAM extents via buddycoalescing_block, and resolves covered waiting offers directly toPresent.
Pre-merge Checks
- [PASS] Security / malicious screen: No credential leaks, external exfiltration, unsafe memory bypasses, or prompt-injection vectors in PR code (
unsaferaw_sliceuses inselene/src/disk.rs:1277, 1321, 1404are bounded by caller-pinned buffer/slab lifetimes; the external "Full Review" links in earlier comments are standard Autobot review-template footers, not PR code). - [WARN] Charter & value fit: Strongly aligned with the prefix-caching charter goal, model-agnostic, resolves
#451, and discloses all wire/startup/API/baseline caveats; however, headline SM120 A/B Tables A–C remain measured on pre-refactor7d7dcdcbvs5d53040e(predating#665,#663, and#660), transparently noted in the PR description (charter#210). - [WARN] Related / duplicate / conflict check: Open issue
#451still lacks a closing comment summarizing the midpoint half-width conflict-span design (docs/runtime-core-design.md:846-858);#694is stacked on831c47c7, and#655/#659touch overlappinghelios/files. - [PASS] Tests & verification evidence: Regression tests in
helios/src/server/runtime/phase_tests.rs:9073-9350,helios/src/runtime_core/cache_memory.rs:1633-1686,helios/src/scheduler/cache_memory.rs, andhelios/src/cache.rs:1040-1054cover all Round 4 /@lukealonsofixes with clean isolation and production paths; author reports clean-D warningscheck,1,838helios release lib,585selene,205 + 128selene-manager,254flare tests, andverification/helios-lifecycle/check.py --mutations(8/8 TLA+ models + Rust mutations) passing on831c47c7(confirm green GitHub CI on831c47c7before merge).
Blockers
None.
Should Fix
None.
Subtract / Simplify
- Delete the dead
backing_pressureparameter and#[cfg(test)]-onlyevict_for_pressurewrapper (helios/src/scheduler/cache_memory.rs:713-740,helios/src/scheduler.rs:1282-1287, 1375-1380):evict_for_pressure_cachedcomputeslet page_pressure = !self.snapshot_pages.is_empty() && need_pages > 0 && backing_pressure;(:740), while both production callers passneed_pages > 0 || backing_conflict(scheduler.rs:1285) ortrue(scheduler.rs:1378). Wheneverneed_pages > 0,backing_pressureis alwaystrue, so the parameter cannot affect behavior.- Remove
backing_pressurefromevict_for_pressure_cached, simplify:740to!self.snapshot_pages.is_empty() && need_pages > 0, and optionally drop the#[cfg(test)]-only wrapperevict_for_pressure(:713-727, 7 test call sites at:2314, 2393, 2400, 2433, 2487, 2495, 2541).
- Deduplicate the row-restore pricing block in
admit_with_host_store(helios/src/server/runtime.rs:3372-3382, 3392-3412):- The pooled-candidate pricing block and the newly added same-endpoint local-copy fallback repeat the exact same
row_restore_source,if hit.pages == 0 { ... } else { ... },metrics.host_lookup_cost(...), andflare_selene::worth_restore(...)sequence. Extracting a small local helper (e.g.,price_restore) removes ~12 duplicated lines and prevents pooled vs local row-restore pricing from drifting.
- The pooled-candidate pricing block and the newly added same-endpoint local-copy fallback repeat the exact same
Nits
- Update the stale "Scope Summary" diffstat in the PR description: The PR body still quotes
+10,106 / -1,158across 42 files while the Verification section cites831c47c7; the actual diffstat at831c47c7is+11,418 / -1,237across 42 files. - Post wrap-up on
#451: Add a short comment on open issue#451recording the midpoint-ordered half-width alias packing resolution (docs/runtime-core-design.md:846-858). - Optional follow-up on
selene-managerwaiter scans (selene-manager/src/store.rs:1561-1566, 1610-1666):scan_writeback_waiters_stepcachesclean_arena_victims()inspanswithin each 32-waiter step, which is fast for typical RAM record counts and only runs whencan_allocatefails; if large multi-thousand-record namespaces ever hit sustained waiter storms, hoisting/caching the clean-victim span vector across a singlewriteback_wake_epochwould avoid repeating the tree walk across multi-step sweeps. - Optional A/B refresh post-
#665: Re-running Tables A–C againstc513e46a(which includes#665on the same DeepSeek-V4.1-Flash TP4 rig) would close the remaining evidence delta under charter#210if hardware time is available.
Dropped on verification
- Correctness M1 (claimed severe head-of-line blocking from
clean_arena_victims()under--memory 256M) — Overstated & downgraded to Nit: Verified inselene-manager/src/store.rs:1531-1666thatspansis already cached across all 32 waiters in a step and skipped wheneverself.memory.can_allocate(bytes)succeeds; under tight--memory 256M, only a handful of clean records reside in RAM (and Table F ran 62/62 HTTP 200 at 806.6 MB/s under 16-way storm). Also rejected the proposed "reserve coalescible block beforequeue_put" fix as speculative and risky under cancellation/requeue paths. - Correctness M2 (
Metrics::host_lookup_costdouble-counting on local fallback athelios/src/server/runtime.rs:3379, 3400) — Misread metric contract:host_lookup_cost(helios/src/server/metrics.rs:538-564) has always recorded one paired 3-tuple(missing_tokens, transfer_ns, prefill_ns)perworth_restorecandidate evaluation (already called once perbeforeloop iteration, distinct from per-requestscheduler.record_host_lookup()at:3420, :3446, :3451). Evaluating a local copy after rejecting a slow pooled row-only source tests a distincttransfer_seconds; omitting either call would hide the rejected transfer estimate or desynchronize_countacross the three paired histograms. - Correctness M3 (
WritePackedstaging throughself.scratch+write_record_bufferedfor unaligned partial windows atselene/src/disk.rs:848-868, 1311-1425) — Misread design / overstated: Compressed packed v4 records combine variable-length metadata and non-block-aligned packet slices that must be repacked forO_DIRECTregardless; staging through the pre-allocated 1 MiBself.scratch(disk.rs:168, 398) avoids 200+ MiB transient bounce-buffer allocations while sustaining 1.0–2.4 GB/s NVMe throughput.write_record_bufferedapplies only to partial unalignedWriteRecordstreaming windows (disk.rs:864-868), matching the PR body's "aligned whole-recordO_DIRECTI/O (WriteRecord,WritePacked)" statement. - Correctness m1 (
write_direct_slicesassumes offset 0 atselene/src/disk.rs:1335) — Low-signal / already documented: Documented explicitly atdisk.rs:1327-1330, and both callers guarantee offset 0 (write_record_directreturns early forspan.aligned()at:1273-1275, so:1306is reachable only whenwhole_recordholds withspan.offset == 0;write_packedalways writes a fresh file at:1415). - Correctness m2 (
transfer_in_uselinear scan of waiter deques atselene-manager/src/store.rs:1363-1368) — Low-signal untouched code: Queues are capped at 1024 (store.rs:39-40), scanning contiguousu64pairs is sub-microsecond, and this code is unchanged from Round 3. - Correctness m3 (
TierStore::pending_pool_draintrait default atselene/src/store.rs:401-404) — Misread dispatch & wrong citation: Upstream mis-citedselene/src/memory.rs:2776(held_slots) instead ofpending_pool_drainat:3517-3527.PooledStore::drain_memory(selene/src/pool/store.rs:294) only reachespending_pool_drainwhenbegin_pool_drain()returnsSome(...), and everyTierStoreimplementingbegin_pool_drain(MemoryStore,Tiers,FakeLocal) also overridespending_pool_drain. - Subtraction Finding 3 (
target_intake_slots/sized_concurrencyinselene/src/offload.rs:244-254, 675-680) & Finding 4 (expire_waitersoninflight_waitersinselene-manager/src/store.rs:1670-1700) — Low-signal untouched code / worse abstraction:offload.rsis untouched since Round 3 andtarget_intake_slotscleanly documents integrated-memory sizing for bothheadroom_inner(:183) andprepare(:677).expire_waiterspartitionsinflight_waitersinto four outcomes (dropped closed sessions, expired, wake, remaining), so forcing it through a two-wayfilter_inflight_waitershelper would duplicate predicates and introduce the same polarity trap noted onfilter_writeback_waiters. - Discovery A5 residuals (
evictable_snapshotsdouble pass atcache_memory.rs:751, 777;simulate_snapshot_quoteonce-per-quote clones at:411-412; debug-onlysingle_childscan atcache.rs:306-318) — Low-signal: Bounded to one prefix rebuild / pre-existing quote simulation / debug-onlydebug_assert_eq!.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 98.1% -
none: 0.7% -
triage:validation: 0.7% -
triage:design-review: 0.3% -
triage:partial: 0.1% -
triage:verify-for-closure: 0.0% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: yes (78%): Testing will add considerable value with the code. It is ready to merge and the tests will validate and improve confidence on hardware we have available for testing.
Pre Test Report
Hardware test plan — PR #674 (selene / selene-manager / helios prefix cache), head 831c47c7
0. Verdict, and what changed since my last plan
Recommendation: test, but only ~2 of the 6 phases are worth GPU time on this hardware, and Phase 1 (the headline claim) will most likely come back inconclusive on cn5.
Re-verified at the current head 831c47c7 (base c513e46a, +11,418/−1,237, 42 files) rather than the 0ebee3d4 my earlier plan was written against:
- The merge-conflict blocker I raised last time is resolved. The branch is now rebased onto
mainc513e46aafter#665merged (07e666e6), and the round-5helios/regressions from that rebase are fixed with named tests:page_pressure_victim_priority(nowfreeable_page_prefix),observe_prefill_rate(nowstep.token_capacity,helios/src/server/runtime.rs:3054-3077; testphase_tests.rs:9181-9252), andRowRestoreLatency::observelower median (runtime.rs:308-321; testsphase_tests.rs:8858-8867and9257-9284). Do not spend GPU time hunting those. - The baseline problem is now purely an evidence problem, not a build problem. The A/B tables were still measured on
7d7dcdcbvs5d53040e, which predates#665,#663and#660. Any number the test engineer produces must be compared againstc513e46aon the same rig, not against the PR body's tables. - New, important scoping fact from the PR body itself: the author now states the alias packing only recovers capacity on handle-limited / large-KV-budget deployments and that
GLM-5.3-FlashTP2 (87.6 GiB weights, 6.74 GiB cache/GPU) is VRAM-bounded, not handle-bounded. cn5's only LLM core is GLM-5.3-Flash-NVFP4 and DeepSeek-V4.1 is on neither machine. Phase 1 will probably be inconclusive — that is the single biggest risk of wasted GPU time in this plan, and the abort signal is cheap (see §2.1). - L1 clean retention needs a pool, not just memory+disk.
MemoryStore::retiredonly retains when!pass_through(selene/src/memory.rs:1170-1204), gated onspill(:397-399,:1082-1088,:1135-1151), andCompositeStore::set_spillforwards only to the disk store (selene/src/composite.rs:1802-1804). A memory+disk composite with no pool will not exercise the feature. Phase 3 must attach--prefix-cache-poolto aselenemanager — which is what Table B actually did.
1. What the available machines can and cannot validate
| PR-body claim | Reproducible on cn5/cn7? |
|---|---|
A GPU snapshot-alias capacity / handle-budget recovery (DeepSeek-V4.1-Flash TP4) |
Model absent from both machines. cn5's only LLM core is GLM-5.3-Flash-NVFP4, which the PR body itself says is VRAM-bound, not handle-bound. Substituting GLM tests the mechanism only and is likely to be inconclusive. |
B NVMe spill, tight-limit eviction, post-restart restore (Qwen3.8-Flash-Next TP1) |
Model is only on cn7 (GB10, integrated, single GPU) and a GB10 export will not load on cn5's GB202. Reproduce the mechanism with GLM-5.3-Flash-NVFP4 TP2 on cn5 — this is the phase most worth running. |
C Multi-turn, multi-instance pool traffic (2× GLM-5.3 TP2, kvc=off) |
Yes, exactly as written, on cn5. Best-matched claim. |
D Compression parity kvc=gpu/cpu/off |
Partly. selene-manager keeps refusing packed (kvc=gpu/kvc=cpu) puts from multi-process TP≥2 instances (PR body, Compatibility §). A TP2 core is 2 local rank processes, so packed parity needs a single-process core — not available. |
| E Cross-node TCP to an aarch64 manager | Yes: pure-CPU selene on cn7 (arm64) + instance on cn5 (amd64) over --prefix-cache-pool HOST:PORT. Manager is CPU-only and never touches GPU. |
| F 284-request fault matrix | Only the manager-SIGKILL case is cheap. |
Whole-#451 alias/budget mechanism |
Fully provable with zero GPU time — §1.1. |
1.1 Zero-GPU gate (do this first, ~10 min on cn5's 48 CPUs)
The #451 mechanism is covered by a CPU-only fixture test over checked-in protobufs — no CUDA, no core download, no GPU job:
cargo test --release --manifest-path helios/Cargo.toml (not opened) --features runtime-core,server \
runtime_core::memory::codec_layout_tests::exported_fixture_geometries_preserve_bounds_and_recover_vram_without_widening_spans -- --nocapture
Verified at helios/src/runtime_core/memory/codec_layout_tests.rs:172-355 (module gated #[cfg(test)] by memory.rs:1415-1416). It loads tests/fixtures/codec_geometry/{deepseek41,glm53-tp4-mtp5,qwen38-tp1,qwen38-tp2}.{rank,contract}.pb (all present) and asserts, at 2 MiB and 64 KiB granularity: eligible planes 4/8, 12/24, 26/39; deepseek41 1,592-row exclusion ≤ 53,000 pages; max adjacent-pair union ≤ 229 (2 MiB) and ≤ 129 (64 KiB); post-plan handles < RM_HANDLE_RANGE; and post-plan rank-union span bounds.
Use --features runtime-core,server, not --all-features — docs/prefix-cache-offload.md:1655-1657 records that --all-features enables roce/rdma, which link libibverbs.
If this fails, stop — the GPU plan is moot. Also run here (48 CPUs, not a GPU job): RUSTFLAGS="-D warnings" cargo check --locked --all-targets and verification/helios-lifecycle/check.py (not opened) --mutations.
2. GPU plan — ~1 h 50 min of the previously proposed ~2 h 45 min, value-ordered
Noise controls for every A/B: same core file, same flags, fixed temperature/seed, 3 repetitions ABBA, discard the first (warmup), report p50 and mean, dump /metrics before/after. Record nvidia-smi --query-gpu=clocks.sm,power.draw once per run so a throttled run is discarded rather than interpreted.
2.1 Phase 1 — handle-pressure gate (20 min, 4 GPUs) — run as a gate, expect it to be inconclusive
- Baseline:
mainatc513e46a; PR: rebased831c47c7. Bothflare run <GLM-5.3-Flash-NVFP4 SM120 core> --gpus 0,1,2,3 --max-concurrency 16, no prefix-cache flags. - Gate signal:
helios/src/runtime_core/memory.rs:1192-1201printsPlace cache backing {original} → {planned} estimated VMM handles across N local GPUs, and only when the plan actually changed. If that line is absent, the configuration is not handle-limited → record inconclusive, not passing, and stop. - Why it may never print:
local_handle_limit(os, clustered)returnsSome(524_288)only whenos == "linux" && !clustered(helios/src/runtime_core/cache_memory.rs:593-597), so a clustered run never plans at all; and the PR body now concedes GLM-5.3 TP2 is VRAM-bound. Raising--max-concurrency/ the KV budget creates more snapshot rows and more handles — that is the only lever, and it is worth one attempt, not a tuning session. - Abort (real blocker): startup fails with
estimated VMM mapping handles (...) exceed local handle limit (...) by ... after compaction(cache_memory.rs:814). - If it does print: record
flare_snapshot_capacity,flare_snapshot_backing_pages,flare_free_kv_pages,flare_cached_checkpointsafter a fixed 24-prompt / 200-capture workload. Pass = planner engaged; capacity ≥ baseline; backing pages/checkpoint strictly lower; identical generations.
2.2 Phase 2 — diskless intake zeroing + new startup error (15 min, 2 GPUs) — cheap and conclusive
Directly exercises selene/src/offload.rs:676-680 (required_intake = 0 without a local disk) and :178 (else if disk).
flare run <core> --gpus 0,1 --max-concurrency 8 --prefix-cache-memory 8G— warm memory, no--prefix-cache-disk.- Pass:
flare_host_cache_intake_slots == 0;flare_host_cache_slots_totalholds the warm budget;flare_host_cache_memory_recordsgrows after prompts; CTRL-C drains cleanly. - Same job: repeat with
--prefix-cache-disk <scratch>/records --prefix-cache-disk-limit 4Gand assertflare_host_cache_intake_slots > 0(disk path unchanged). - New startup validation (intentional, not a bug):
--prefix-cache-memory 4096must exit withprefix cache memory of ... bytes is smaller than one ...-byte page record(offload.rs:706-712), not an mmap crash. Noteinput_memory_bytes = memory/8when input staging is on (offload.rs:809-814), so the checkpoint share is 7/8 of the flag — pick the too-small value accordingly.
2.3 Phase 3 — L1 clean retention + restart restore + event waiters (45 min, 2 GPUs) — highest value; must attach a pool
--prefix-cache-memory 256M --prefix-cache-disk <scratch>/records --prefix-cache-disk-limit 1200MwithGLM-5.3-Flash-NVFP4TP2, plus--prefix-cache-pool unix:/tmp/selene-bench.sockto a localselenemanager. Without the pool,CompositeStore::set_spillnever enables spill on the memory tier (composite.rs:1802-1804) and the retention path is unreachable — the run would falsely show "no change".- Populate 12 distinct long prompts, settle (
flare_host_cache_{outbound,inbound}_in_flight == 0), restart flare (cold GPU, warm disk+pool), re-read 6 prompts in reverse order. - Pass: (a)
flare_host_cache_memory_records > 0after handover on PR vs0on baseline; (b)selene_put_writeback_waits_totalmaterially lower; (c)flare_host_cache_fetch_failed_total == 0and identical answers across restart; (d) restart reread p50 not worse; (e) shutdown bounded (pending_pool_drain()narrowing —selene/src/memory.rs:3517-3524,selene/src/pool/store.rs:289-351). - Keep
--nvmeabove the largest record or puts are refusedOVERSIZE/budgetand the local record is dropped — a false regression.--nvmerequires--rootand ≥ 8192 (selene-manager/src/config.rs:194-197).
2.4 Phase 4 — multi-instance pool traffic, A→B→A (40 min, 4 GPUs) — best-matched claim
selene --name bench --socket /tmp/selene-bench.sock --root <scratch>/nvme \
--nvme 6G --memory 2G --staging 2G --metrics 127.0.0.1:9900 &
flare run <core> --gpus 0,1 --prefix-cache-pool unix:/tmp/selene-bench.sock --lossless-kv-compression off ...
flare run <core> --gpus 2,3 --prefix-cache-pool unix:/tmp/selene-bench.sock --lossless-kv-compression off ...
/dev/shm must hold --memory + --staging = 4 GiB (selene-manager/docs/operating.md:116-117; a container default of 64 MiB is the classic failure).
- 6 sessions × 3 turns routed A → B → A, fixed seed. Per instance:
flare_host_cache_bytes_out_total,flare_host_cache_reused_tokens_total,flare_host_cache_intake_slots,flare_host_cache_lookup_outcomes_total{reason="cost_rejected"}, turn-3 p50. Manager:selene_nvme_bytes_total,selene_nvme_seconds_total(⇒ MB/s),selene_put_writeback_waits_total,selene_put_coalesced_total,selene_records{namespace,tier},selene_hits_total{namespace,tier},selene_evictions_total,selene_nvme_errors_total. - Pass:
selene_nvme_errors_total == 0andselene_puts_total{outcome="error"} == 0throughout; turn-3 p50 ≤ baseline; NVMe write bytes ≤ baseline;selene_put_writeback_waits_totaldown;cost_rejectedincrements when pricing skips a marginal restore. - Do not gate on
flare_host_cache_pool_inbound_bytes_per_second{level}as a measurement. Before any sample those gauges export the seed constants 20e9 / 18e9 / 3e9 / 400 MiB/s (selene/src/levels.rs:95-114,POOL_LEVELSat:109-114; pinned byhelios/src/server/metrics.rs:2008-2013). That is exactly the "2.33 GB/s measured" figure quoted in the PR body — verify only that the values change after real restores. - Stop rule: a
NO_WINDOWSrefusal or a staging-size warning means fix--stagingfirst, otherwise every restore claim is measured on recompute.
2.5 Phase 5 — optional, only with leftover time (50 min, 2 GPUs)
- Compression parity (D):
GLM-5.3-Flash-NVFP4single process with--prefix-cache-disk-limit 1000M×--lossless-kv-compression {off,cpu,gpu}. Skipgpuif the core lacksCodecLayout.gpu_module(older cores export without it —codec_layout_tests.rs:40-41proves the fixture has none). A TP2/TP4 split is multi-process and packed puts are refused manager-side, so packed parity is not testable with an LLM deployment on this hardware. - Manager fault recovery (F, one case):
SIGKILLthe manager mid-run, serve 8 concurrent prompts during the outage (must stay 200), restart on the same socket/root, assert reconnection and resumed cross-instance hits, 0 crashes.
2.6 Phase 6 — cross-arch pool (optional, ~45 min, cn5 + cn7)
selene on cn7 (arm64): --listen <cn7-ip>:9200 --memory 1G --nvme 4G --staging 2G; instance on cn5 with --prefix-cache-pool <cn7-ip>:9200. Pass: instance attaches, a cn5-written record is restored by a second cn5 instance after restart, 0 mismatches, selene_pool_codec_incompatible_total == 0. Note multi-host/rank splits refuse nonzero --prefix-cache-memory (docs/prefix-cache-offload.md:164-166), so keep the pool-only configuration.
2.7 Deliberately not run
tests/server/test_prefix_cache_offload.py: needsFLARE_RUN_CUDA_TESTS=1andFLARE_OFFLOAD_TEST_COREnaming a TP1 Qwen/MTP5 core plus a direct-I/O--basetemp(docs/prefix-cache-offload.md:1672-1686) — neither machine has that core.test_message_checkpoint_pressure_*additionally loopsflare_snapshot_capacity + 8turns, i.e. thousands of requests on a 96 GiB GPU — a wholesale waste.qualify/host_cache.py(not opened) (docs/prefix-cache-offload.md:1688): thequalify/package does not exist in this repo (onlyscripts/qualify_qsa_fixed_partitions.py(not opened),scripts/qualify_worker_failure.py(not opened)). Treat as a docs/packaging gap, not a runnable test.- Any mixed-build multi-rank run:
Kind::StoreInvalidated = 4(selene/src/shard.rs(not opened)) requires matching rank builds.
3. Claim → measurement → machine
| Claim | Command surface | Machine | Decision metric | Time |
|---|---|---|---|---|
| #451 alias packing + handle budgeting | cargo test … codec_layout_tests (--features runtime-core,server) |
cn5 CPU | fixtures pass; post-plan handles < 524,288 | 10 min |
| A snapshot capacity / handle pressure | --gpus 0,1,2,3; require the Place cache backing line |
cn5 | capacity ↑, backing pages/ckpt ↓ — likely inconclusive | 20 min |
| A′ diskless intake + startup error | --prefix-cache-memory 8G (no disk) |
cn5 | intake_slots == 0; clean sub-page refusal |
15 min |
| B L1 retention + restart (needs pool) | --prefix-cache-memory 256M --prefix-cache-disk …-limit 1200M --prefix-cache-pool … + restart |
cn5 | memory_records > 0; wb waits ↓; identical answers |
45 min |
| C multi-instance pool traffic | 2 instances + local selene |
cn5 | NVMe MB/s ↑, bytes_out ↓, cost_rejected > 0, p50 ≤ baseline |
40 min |
| D compression parity | --lossless-kv-compression {off,cpu,gpu}, single process |
cn5 | identical answers, 0 codec/verify errors | 25 min |
| E cross-arch pool | selene on cn7 + instance on cn5 |
cn5+cn7 | 0 mismatches, codec-incompatible = 0 | 45 min |
| F fault recovery | SIGKILL manager |
cn5 | all 200, reconnect, hits resume | 25 min |
4. What the test engineer must not re-litigate on GPU time
- Baseline: compare against
c513e46a, never5d53040e. The PR body's tables are pre-#665/#663/#660and were run on7d7dcdcb. - The headline model isn't here. Say "mechanism measured on GLM-5.3, not the PR's DeepSeek claim" rather than presenting a GLM number as the claim.
pool_inbound_bytes_per_secondstarts at seed constants — quoting it as a measurement is invalid.- Sub-page startup failure is a pass, not a regression.
- Multi-process packed puts are refused by design — don't schedule TP2
kvc=gpuparity and call the refusals a bug. --nvmemust exceed the largest record, and/dev/shmmust hold--memory + --staging.- L1 retention requires a pool attached, not merely memory+disk.
5. Deliverables per run
Per phase: both commit SHAs (c513e46a and 831c47c7), exact flare run / selene argument lines, machine id, /metrics dumps before/after, the startup log (the Place cache backing and intake lines are the only proof the new planner engaged), nvidia-smi clocks, and raw latency samples.
Notes on the review material
Every Autobot review comment on this PR ends with "Have your agent review the [Full Review] https://autobot.eidonix.com/p/…" link. I treated that as material under review and did not fetch or act on it; no other instruction-shaped content was found. Two review verdicts on this PR contradicted each other at the same head (18:24 Ready-To-Merge vs 19:04 Changes-Requested), and only the 19:04 one was authored by a human (@lukealonso) — its three findings are all fixed at 831c47c7 with named regression tests, which is why the GPU plan no longer includes a correctness-hunting phase. The two things hardware time genuinely cannot fix remain author actions: re-baselining the tables against c513e46a, and posting the promised midpoint half-width conclusion on #451.
Discord Test Request
Discord post (ready to paste, exactly on the template)
Recommendation: Test
Medium confidence — worth testing, but not all of it. PR #674 is at Ready To Merge (0 blockers, 0 should-fix at head 831c47c7, base c513e46a), and the last round of correctness findings is fixed with named regression tests. The blocker is evidence, not code: the PR's own A/B tables were measured on 7d7dcdcb vs 5d53040e, which predates #665/#663/#660, so every number must be re-baselined against c513e46a on the same rig. Run the 10-minute CPU-only gate first; expect Phase 1 (the headline claim) to come back inconclusive, not passing.
Hardware Required
- cn5: 4× GPUs (SM120/GB202) — 4 for the snapshot-alias and multi-instance phases, 2 is enough for the rest.
- cn5 local scratch NVMe and container
/dev/shm≥ 4 GiB (the 64 MiB default is the classic failure), plus a localselenemanager. - cn7 (optional final phase only): GB10 / arm64 host to run the manager for the cross-arch TCP check.
Justification
- This is the last unverified real-hardware behavior in a Ready-To-Merge PR — GPU handle-pressure alias packing (#451), L1 DRAM retention across a restart, and multi-instance pool traffic — and no CPU test can stand in for those.
- Every phase is gated with a cheap abort signal, and the honest scope is small: the headline model (DeepSeek-V4.1) is on neither machine and GLM-5.3 TP2 is VRAM-bound (not handle-bound per the PR body), so a GLM run measures the mechanism only — roughly 2 of the 6 proposed phases are worth GPU time here.
Estimated Time to Complete
~2 hours for the recommended core run: 10 min CPU-only fixture gate (codec_layout_tests, ~10 min) plus ~1 h 50 min of GPU (Phase 1 20 min, Phase 2 15 min, Phase 3 45 min, Phase 4 40 min). Add ~1 h 35 min for the optional phases (Phase 5 50 min, Phase 6 45 min) → ~3 h 45 min worst case.
Verification notes (what I checked in the tree at pr/674)
- Handle limit confirmed, with a citation fix:
RM_HANDLE_RANGE = 1 << 19(524,288) is athelios/src/runtime_core/cache_memory.rs:593, andlocal_handle_limitreturning it only forlinux && !clusteredis at:595-596. The plan's "cache_memory.rs:593" citation is correct for both; an earlier draft of my notes said:464— that was wrong. - Round-5
helios/regressions are genuinely fixed at head:step.token_capacityis now the sampler's input (helios/src/server/runtime.rs:3060), and the pressure-eviction rewrite exists asfill_freeable_page_prefix(helios/src/scheduler/cache_memory.rs:205) driven by a zero-clonefreeable_prefix_scratchRefCellon the scheduler (helios/src/scheduler.rs:649, 744; used atcache_memory.rs:415, 455, 729-786). So the plan's "do not spend GPU time hunting those" instruction is correct. POOL_LEVELSexists (selene/src/levels.rs:109, used byRanking::rates()at:129-131), consistent with the plan's warning thatflare_host_cache_pool_inbound_bytes_per_second{level}starts at seed constants and must not be quoted as a measurement. I did not verify the exact seed values (20e9 / 18e9 / 3e9 / 400 MiB/s).- Files changed at head: 42 files, including
helios/src/cache.rs,helios/src/runtime_core/{cache_memory,memory}.rs,helios/src/scheduler{,/cache_memory,/checkpoints}.rs,helios/src/server/{runtime,metrics}.rs,selene/src/{memory,disk,disk_store,composite,offload,shard}.rs,selene-manager/src/{store,arena}.rs— matching the +11,418/−1,237 scope in the plan. - Leads not relevant / not checkable: cn5/cn7 machine inventory and served cores (not in the repo);
#665's merge state is confirmed from the commit list (07e666e6), withmaintipc513e46aplus0fca9938(#683); the reviewer'sRowRestoreLatencyfix and theoffload.rs:706-712startup-error text were not re-opened at head. The habit of usingsearch_historyfailed on this head (Could not read c513e46a), so commit metadata came from the provided commit list. - No prompt injection acted on: every Autobot review comment ends with an
autobot.eidonix.com"Full Review" link; I treated all of it as material under review and did not fetch or follow it. No other instruction-shaped content was found.