Value proposition report · NVIDIA/hyperflare-inference #496

Raw Markdown for agents: https://autobot.eidonix.com/p/36359083-b4db-4d21-b51e-87d18e0b6a47.md

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

Verdict: worth merging, with changes

The problem is real, it sits in the layer the charter says it belongs in, and on this project's target hardware the win is large (reported 3.5–4.2× fewer physical NVMe bytes on concurrent shared-ancestor restores, −16% / −20% median TTFT on the 27B TP1 burst). But the change is ~1,000 net new lines of reference-counted pipeline state in one already-8.8K-line file, with two unmeasured edits and an unmerged companion PR in the same function. It should not land in its current state; it should land after the items under "What must change" below.

Charter fit — good

Who benefits, and how much

Benefits: anyone running concurrent agent/branching traffic against a disk-resident shared prefix, i.e. the headline use case ("long conversations, coding agents, heavy tool use") on SM121/DGX Spark with --prefix-cache-memory 0 --prefix-cache-disk.

Workload (author's GB10 numbers) Physical read Median TTFT
27B-NVFP4 TP1, 4 branches, simultaneous 18.03 → 4.29 GB (4.21×) 8484 → 7112 ms (−16.2%)
27B-NVFP4 TP1, 4 branches, +25 ms stagger 18.09 → 4.56 GB (3.97×) 8200 → 6539 ms (−20.3%)
Flash-Next TP1 / TP2 7.9→2.0 GB, 8.4→2.1 GB −0% / −2.5% / −4.5% / −6.9%
DeepSeek-V4.1 TP4, 4 hosts @47K 1.00× −1.1% (no overlap window)

Read honestly: the bandwidth win is uniform and large; the latency win is concentrated where a single disk thread is the bottleneck (27B TP1). On Flash-Next, simultaneous arrival reads 76% less and TTFT does not move at all (3333.5 → 3337.1 ms) — worth stating plainly, because it means the value is "less NVMe/fewer opens, and a burst-latency win on the heaviest model," not a general speedup.

Who does not benefit: single-stream restores (no sibling to share with), CompositeStore/read_into callers (explicitly kept on the old private path), and pool (PooledStore) serving. No regression is claimed for them beyond the described per-pump cost, and busy()/close() accounting was extended to the new maps (disk_store.rs:2344), so idle and shutdown paths stay correct.

Is there a simpler way?

I looked for one; there isn't a good one:

Nor is it duplicating an existing mechanism: the only sharing that exists today is per-key ticket attachment, documented at docs/prefix-cache-offload.md:318-319.

What it costs

Implementation complexity (the main concern). Nominal diff is +2803/−913, but roughly 900 lines of that is the DiskStore block relocated within the same file, so the real addition is ≈1,000 lines of new production code and ≈500 of tests. The new state machine adds SharedSegment/SharedSegmentId, SharedWindow/SharedWindowId, SharedFileState (5 states), SharedWindowPhase, WindowFollower, PlanState, DeviceActiveWindow, DeviceSegmentRef, DeviceInbound, and an 8-pass pump_device_inbound (disk_store.rs:1811) with ~12 helpers (acquire_shared_segment:1362, find_reusable_window:1568, find_best_existing_window_for:1602, build_pending_demand:1647, pick_next_pending_plan:1684, detach_unwinding_windows:1726, sweep_shared_windows:1755, segment_needs_disk_reads:1773, fail_segment_users:1449, fail_window:1475, apply_shared_disk:1489, apply_device_transfer:1548). It is spelled out and commented well, and the invariants I spot-checked hold — disk::Reply is per-job FIFO (selene/src/disk.rs:447-455), so the pending_row_reads FIFO is sound even though ReadRow replies carry window: 0; and Pass 5e (2205-2255) correctly delays Fetched until the last user's segment settles, because the index pin is released on Fetched (3609-3615). But this is now three concurrent pipelines (host, device-shared, outbound) plus an owners map in one file, and that file was already 6,976 lines on main.

Performance of the non-beneficiary paths. Dispatch cost is paid by everyone: find_reusable_window/find_best_existing_window_for scan all shared windows per pending plan, acquire_shared_segment scans all segments per fetch, and build_pending_demand (1647) clones PathBuf + Header into a fresh HashMap on every pump while free slots exist. Pumps run at the worker's 2 ms idle / 100 µs pool-wait cadence (helios/src/server/runtime.rs:1187-1201), so this is small in absolute terms — but on single-restore workloads it is pure overhead for zero gain, and the author concedes single-pass benchmarks were not re-run after this edit. A cheap fix: skip the demand rebuild unless device_inbound.len() > 1 (already partially there) and cache it across pumps.

Shared risk surface (intentional, but real). One shared record_read error now fails all attached restores, and a coalesced window holds its SlabPool slots until the slowest follower's GPU upload finishes. With WINDOW_CREDITS = 2 (selene/src/shared/limits.rs:18 (not opened)) that briefly pins staging slots to the slowest sibling, and pick_next_pending_plan deliberately prefers windows siblings also want — i.e. it trades fair round-robin ordering among concurrent fetches for synchronization. Both choices are defensible; neither is documented in docs/prefix-cache-offload.md, and the failure coupling changes the blast radius of a corrupt record from one request to a cohort.

Maintenance/process risk. The PR is one file away from a conflict with the author's own companion #497, which rewrites Staged::pump_all ordering — the exact function #496 extends (disk_store.rs:2268). The author says "merge this PR first, then rebase #497," which is sensible, but it means the reviewed shape of pump_all is not the shape that ships. Also note the report glosses two TTFT deltas (e.g. "8,200.0 -> 6,539.0 ms (-20.3%)" reads as −1,661 ms; the parenthetical in another row sums two rows), so the numbers should be re-derived, not quoted.

Tests / evidence—adequate to good, with gaps

Strong: plan_aligned_windows misalignment cases, byte-exact SimulatedGpu page + row verification for two tickets with different skip_pages, simultaneous and staggered coalescing with counters disk_opens/disk_window_reads/coalesced_windows (disk_store.rs:1227), private child-vs-upload failure isolation (8580), shared record_read propagation with slot/pin leak assertions (8692), and Staged::close drain (8789). These run in CI (selene with --features test-support, .github/workflows/native-serving.yml:51 (not opened)). One fragility: the staggered test asserts exact totals (coalesced_windows() >= 2, disk_window_reads() + coalesced_windows() == 10, 8444-8445) on real disk-thread timing — it passed on Linux and Windows IOCP once, and is a flake risk under load.

Gaps the author honestly lists and that matter for the verdict: single-pass SM121 runs not repeated after the linear demand-index and close-count edits; helios with FLARE_RUN_CUDA_TESTS=1, discrete PCIe GPUs, Windows serving, and live CompositeStore/PooledStore GPU serving not run. Since this touches the hot restore path for every disk-only deployment, at minimum one re-measured SM121 pass on the final commit is needed before merge.

What must change before merge

  1. Re-run the SM121 27B TP1 burst (simultaneous + staggered) and the Flash-Next TP2 point on the exact commit to be merged, and report disk_opens / disk_window_reads alongside physical bytes. The load-bearing claim is −16% to −20% TTFT on the flagship model; it must not be a stale number.
  2. Make the demand index cheap: only build pending_demand when there is true sibling overlap, and reuse it across pumps rather than reallocating PathBuf/Header keys per pump, so single-restore workloads pay ~nothing.
  3. Document the two behavioral trade-offs in docs/prefix-cache-offload.md §2.4 (beyond the current +5 lines at 337-343): one shared read error fails every attached restore, and sibling-attachment preference relaxes fair ordering among concurrent fetches.
  4. State the latency result honestly: bandwidth 3.5–4.2×; TTFT −16%/−20% on 27B TP1, ≈0% to −7% elsewhere, 1.00× on DeepSeek TP4. Fix the two arithmetic slips in the Result table.
  5. Sequence with #497 explicitly: rebase #496 onto main, land it first, then rebase #497 so pump_all ordering (host_inbound → pump_device_inbound → writes → maintenance) is reviewed as it will ship.
  6. De-flake the staggered test (assert >= 2 coalesced windows and a read-count bound, not an exact total that depends on disk-thread timing).
  7. Optionally, split the DiskStore relocation into its own commit so the reviewable delta is the coalescing logic, not a 900-line move.

Bottom line

Worth it with changes. It solves a genuine, measured, charter-aligned bandwidth problem in the right layer and with the right instincts about failure isolation, but it buys a 3.5–4.2× read reduction with ~1,000 lines of concurrent state in the most delicate file in selene, on evidence that predates the last two edits of the same code, next to an unmerged companion PR touching the same function. Land it after items 1–6; if item 1 comes back confirming the burst TTFT win, this is clearly worth merging.

(Note: the only conversation on the PR is an automated case-file comment from flare-autobot — no instructions to me, no human review yet.)