Final review report · NVIDIA/hyperflare-inference #694

Raw Markdown for agents: https://autobot.eidonix.com/p/eac62062-798f-4ff1-9a0f-9227057a4eb1.md

Recommendation: Changes Requested

The core write-side profitability gate, top-down pool coverage, O(1) clean_slots accounting, dram_only warm L1 retention/reclamation, compaction-lineage canonicalization, and cascade anchor retention are technically sound — no core correctness, safety, or concurrency blockers were found after direct verification at head d74e810. Changes are requested before merge because (1) this PR is stacked on unmerged #674 and its headline A/B numbers were measured on an earlier combined dev commit (09400ad8) where two of three models had zero gated spills (conflating #674's byte reduction with this gate) and without reporting the mandatory verification/helios-lifecycle/check.py gate, and (2) the new user-visible Prometheus metrics, StoreOutcome::Unprofitable contract, and prefill_saved_ns == 0 fail-open / cold-restart recovery semantics are missing from docs/api.md and docs/prefix-cache-offload.md.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Rebase after #674 and refresh head-commit verification and A/B evidence (PR description, docs/design-review.md:106-115, 209-251):

    • The served SM120 A/B table was measured on combined dev commit 09400ad8 rather than head d74e810, and two of the three rows (GLM-5.3-Flash TP2 and DeepSeek-V4.1-Flash TP4) report 0 skipped spills while showing NVMe byte reductions (5.10 → 3.79 GB on GLM-5.3) attributable to #674 rather than this gate. Once rebased onto main after #674, rerun the A/B against post-#674 main at head (explicitly distinguishing any row where the gate does not fire from the gate's own savings) and label the production fleet table as an offline header replay directly alongside its headline figures.
    • Because the top commit modifies helios/src/scheduler.rs, helios/src/scheduler/sharing.rs (eviction/compaction tracking), and helios/src/server/runtime.rs (publication/pin lifecycle), run python3 verification/helios-lifecycle/check.py on head and include the result in the PR's Verification section per docs/design-review.md:211-215, 234-251.
  2. Document the new Prometheus metrics, StoreOutcome::Unprofitable, and fail-open recovery semantics (docs/api.md:340-398, docs/prefix-cache-offload.md:685-696, 1454-1465):

    • helios/src/server/metrics.rs:872-885, 922-933 adds flare_host_cache_spill_skipped_unprofitable_total{tier}, flare_host_cache_spill_skipped_unprofitable_bytes_total{tier}, and flare_host_cache_store_reasons_total{reason="unprofitable"}, none of which appear in docs/api.md:340-398 (which documents every other flare_host_cache_* family). Add them to docs/api.md, clarifying that ..._bytes_total counts skipped write bytes (packed stored bytes when compressed in L1 DRAM per selene/src/composite.rs:1023-1029, otherwise uncompressed tail+row bytes per disk_store.rs:3621-3622 and memory.rs:848-850).
    • docs/prefix-cache-offload.md:1462-1465 lists only Present, Oversize, and Retry under Publication outcomes; add Unprofitable (selene/src/store.rs:275) with its terminal unpin-without-deferral semantics (helios/src/server/runtime.rs:2940-2966).
    • Explicitly document in docs/prefix-cache-offload.md:685-696 (and the PR description) that prefill_saved_ns == 0 intentionally fails open (selene/src/store.rs:528-534) — including for on-disk records recovered after restart (selene/src/disk_store.rs:2306-2320, 2199-2201, preserved due to zero v4 header changes) until Helios republishes the key and backfills prefill_saved_ns (selene/src/composite.rs:810-825, 7992-8038).

Subtract / Simplify

  1. Stop forwarding set_pool_spill_policy into CompositeStore's flat MemoryStore (selene/src/composite.rs:2473-2476, selene/src/memory.rs:1243-1265, 1299-1305):
    • In CompositeStore, self.memory is flat (flat = true) and never spills to the pool (CompositeStore::set_spill only calls self.disk.set_spill(enabled) at composite.rs:2470-2472, and CompositeStore::spill_eligible_pool only queries self.disk.spill_eligible_pool(key) at composite.rs:2477-2479). Calling self.memory.set_pool_spill_policy(policy) at composite.rs:2475 allocates and maintains a full HashMap<PrefixKey, PoolCoverage> across every L1 DRAM record and runs an O(n) recompute_clean_slots() scan on every >= 5% pool rate update for zero behavioral effect. Delete line 2475 (or guard pool_coverage in MemoryStore on !self.flat).
  2. Simplify CompositeStore::record_is_packed to query self.disk directly (selene/src/composite.rs:2483-2493):
    • CompositeStore's TierStore implementation retires exclusively from PoolTier::Nvme (self.disk.take_retiring(), self.disk.retirement_predecessor(), self.disk.pin_export_files()), so checking self.memory.record(&key) before self.disk is backwards and unnecessary. Replacing lines 2483-2493 with self.disk.record_is_packed(key) matches the actual NVMe export source and removes 9 lines.
  3. Deduplicate estimated_prefill_saved_* in helios/src/server/runtime.rs:2917-2921 vs 3276-3297:
    • Both sites run scheduler.estimate_prefill_delta_ns(...) with the identical gained as f64 / prefill_rate.max(1.0) cold fallback. Extract a shared estimated_prefill_saved_ns(...) -> u64 helper (or have estimated_prefill_saved_seconds wrap it) to eliminate the second fallback formula.
  4. Deduplicate pool standalone profitability and chain-byte helpers (selene/src/memory.rs:424-444, selene/src/disk_store.rs:2186-2206, selene/src/composite.rs:572-577):
    • memory_pool_standalone_profitable and disk_pool_standalone_profitable are identical apart from MemoryRecord/DiskRecord, and both repeat the saved_ns == 0 => true check already performed by standalone_spill_profitable (selene/src/store.rs:529-534). Moving standalone_profitable(&self, bytes: u64, prefill_saved_ns: u64) -> bool onto PoolSpillPolicy removes both helpers and the redundant zero-checks.
    • CompositeStore::standalone_nvme_bytes (selene/src/composite.rs:572-577) returns (raw_bytes, raw_bytes) (the same u64 twice); returning a single u64 simplifies both the helper and its caller at composite.rs:587-592.
  5. Collapse duplicated PoolSpillPolicy construction (selene/src/pool/store.rs:202-214 vs 242-258):
    • PooledStore::new and PooledStore::pool_spill_policy repeat the identical remote_manager() → Level → rates[2]/rates[3] match. Extracting one free helper pool_spill_policy(remote_manager: bool, rates: &Ranking) -> PoolSpillPolicy removes the duplicate block.

Nits

Dropped on verification