Value proposition report · NVIDIA/hyperflare-inference #496

Raw Markdown for agents: https://autobot.eidonix.com/p/743690cf-688d-4703-9ad3-b959b4beb22c.md

PR #496 — Coalesce shared ancestor reads across concurrent Selene disk fetches

Verdict: worth merging, with changes

Head cb3db468 (rebased onto main 6d74db3a, post-#504) is a genuine step forward: every code item I raised last round is now fixed, plus a whole new v4 packed coalescing path. What remains is one narrow metering gap, one unwritten doc line, one sequencing task, and one evidence gap that matters for the charter's own rule rather than for the code.

Files: docs/prefix-cache-offload.md +38/−2, selene/src/disk_store.rs +8,470/−5,627, selene/src/shard.rs +11, selene/src/shared/packed.rs +44, selene/src/shared/record.rs +119. No selene/src/lib.rs (not opened) change.

Charter fit

What this head fixed (verified in source, not just claimed)

  1. Rate sample off the completion enum. TransportEvent::InboundWindowSample is gone; the enum is five variants, all carrying a JobId (disk_store.rs:84-106). Both unreachable!()s are gone — the only unreachable! left in the file is pre-existing (:891, :5128 test). Replacement is a defaulted trait method drain_inbound_samples (:149-150), so my earlier public-API-breaking concern is moot. Staged buffers (bytes, elapsed) per completed shared window (:2148-2150), drained by DiskStore::observe_inbound_samples (:3649-3655) from poll_transport/poll/close; rank 0 forwards (shard.rs:1005-1013), peers discard (shard.rs:1213-1214). CompositeStore::poll now bumps stats.progress only for real completions (composite.rs:1473-1474), asserted at disk_store.rs:10517-10518.
  2. Header hash drift. Exhaustive destructure beside PartialEq in the same file, version: _ excluded, packed included (shared/record.rs:165-202) — a new Header field is now a compile error. HeaderIdentity::hash delegates (disk_store.rs:1452-1456); packed::Layout got Eq + exhaustive Hash over Layout/PackedOffer/PackedUnit (shared/packed.rs:99-141); RankSizes derives Hash. header_eq_implies_same_hash covers version-excluded equality, a differing created, and equal vs differing packed.
  3. Layout::record_slots. Called directly with one hoisted transfers lock, skipped entirely for packed (:2307-2320).
  4. Docs and Staged::close. §2.4 split into mechanism / invariants / limits-and-failure-scope bullets covering raw and v4 packed (docs:427-450); the metrics contract lives only in §4 (docs:1612-1617) with §2.4 cross-referencing it. Close reports abandoned_jobs and leaked_shared separately (:3183-3225).
  5. Two prior findings withdrawn. The staggered-test "flake" is not one — disk_window_reads() + coalesced_windows() == 10 (:9672) is a conservation identity (each logical window is either created once, guarded by disk_read_counted, or attached in attach_existing_window :2246); only the already-bounded coalesced >= 2 is timing dependent. My 4.5-copy benchmark objection is also withdrawn: the author's 2,274 MB single-restore figure makes "before" exactly 8.0 copies.

New since last round: v4 packed coalescing

SharedWindow.packed_buf: Option<Arc<Vec<u8>>> (:1096, :1546) is retained until every follower's decode finishes; one shared ReadPacked per aligned window (:2674-2698); packed windows take zero SlabPool slots (:2527-2539, :2320). Only packed-content errors escalate to all followers (apply_device_transfer :2174-2181); transient upload errors fail one record. concurrent_packed_fetches_coalesce_opens_and_read_packed_windows (:10545-10855) runs 4 branches over a 1-slot pool and asserts 5 opens, 7 ReadPacked reads, 9 coalesced attachments, byte-exact GpuMemory pages and rows, zero leaked slots/pins, plus a corrupt-packet case asserting is_record_read() propagation and row drop.

Who benefits, how much

Concurrent branching traffic on a disk-resident shared prefix with --prefix-cache-memory 0 --prefix-cache-disk on SM121/GB10. Author's numbers: 27B-NVFP4 TP1 simultaneous 18,177.5 → 4,306.7 MB physical reads (−76.3 %, 4.22×), TTFT 7,974.6 → 5,662.8 ms (−29.0 %); staggered −73.4 % / −13.5 %; Flash-Next −75.1 % / −3.1 % and −71.7 % / −2.8 %. Arithmetic checks: after/before = 1.89 and 2.13 copies of a 2,274 MB restore — roughly two physical passes, consistent with the documented "a released window is re-read" limit (docs:443-445); honest headroom, not a defect. It composes with #497: #497 shrinks disk-only intake to two windows, and #496 is what lets eight shared-ancestor restores share them.

What it costs

disk_store.rs production 3,523 → 4,746 (+1,223, +35 %) and tests 4,489 → 6,110 (+1,621): a second inbound lifecycle (SharedSegment, 5-state SharedFileState, SharedWindowPhase, WindowFollower, DeviceActiveWindow, HeaderIdentity/SegmentKey/WindowKey, an 8-pass pump_device_inbound) in the most delicate file in selene. Risk surface: one shared record_read error fails every attached restore; a coalesced window pins slots until the slowest follower uploads; sibling-demand preference relaxes arrival order. All three are now documented. No simpler path exists — copier::Job::replication fans to ranks not GPU page ranges; keeping 4 GB resident defeats --prefix-cache-memory 0; scheduler dedup can't work because each branch needs its own snapshot slot.

Should fix before merge

  1. Scope the rate sample to device restores, or sample host reads too. Samples are pushed only in apply_shared_disk (disk_store.rs:2148-2150); HostInbound — the read_into/read_into_packed caller-buffer path CompositeStore uses (composite.rs:884-889) — never pushes one, whereas main observed on every inbound (main:3221). CompositeStore's own disk_inbound_rate (composite.rs:1064) keeps user-facing pricing measured, so this is narrow — but docs §4 ("samples rank-0 physical disk-thread window reads") reads as covering all reads.
  2. Document the deliberate leak. Staged::close does std::mem::forget(win.packed_buf.take()) when transfer close fails (:3206-3212). Correct, one comment line.
  3. Sequence #497 with pump_device_inbound in mind. #496's pump_all (:2957-2978) is maintenance-drain → outbound → host_inbound → device_inbound: no regression against main (main:1781-1801). But #497 (pr/497:66, :1787-1825) reorders host inbound first and adds MAINTENANCE_DEFER_LIMIT = 8; landing it second must also prioritize pump_device_inbound, or the reorder helps only host reads and not the device restores that carry TTFT.
  4. Re-measure at the merged form. All four rows are from 0c04b1e2 (pre-#504, compression off); the head is a +8,470/−5,627 rebase with a new v4 packed path. The "identical raw path when compression is off" argument is plausible and mostly borne out by inspection, but #210 asks for a measured speedup on a served workload. One simultaneous and one staggered TP1 trial at cb3db468 closes it.
  5. Get the maintainer design sign-off (AGENTS.md:201-206: "a commit acknowledgment or routine PR approval is not that decision"). A second inbound lifecycle inside Staged is an invariant-level placement choice; the author has now asked for it. One-line ack, no code.
  6. State the coverage boundary: multi-host RoCE (the entire shard.rs surface), 2-GPU split_pools, discrete PCIe GPUs, Windows serving, live compression cpu/gpu serving, and live warm-plus-disk or PooledStore HTTP serving were not exercised.

Bottom line

Worth merging, with changes. It fixes a measured, reproducible performance problem on the project's headline model and hardware; it lives in the one layer where the bytes can be shared; it adds no flag, format, re-export, or per-model branch; its correctness evidence is unusually strong for a performance PR (five-repeat FP32 parity against main, byte-exact misalignment test, byte-exact packed coalescing, leak and failure-isolation assertions on pool free_slots() and index pins); and it composes with #497 rather than duplicating it. The cost — ≈1,200 production lines of reference-counted concurrent state in selene's most delicate file, a cohort-wide blast radius on a corrupt record, and a redefined bandwidth metric — is real but paid once and now documented. Items 1–2 are a few lines, 3–6 are text plus one ack; nothing requires redesign.

No instruction-like content appeared in the PR, docs, or comments other than the review bot's "to opt out" footers, which I did not act on.