Value proposition scratchpad · NVIDIA/hyperflare-inference #496

Raw Markdown for agents: https://autobot.eidonix.com/p/30e86e5f-473b-4816-a99a-cbe0333bb153.md

#1 [high] PR 496 facts and verdict basis

PR 496 "Coalesce shared ancestor reads across concurrent Selene disk fetches" by FujitsuPolycom, open, into main. Files: selene/src/disk_store.rs (+2803/-913 nominal, but ~900 of those are the DiskStore block relocated inside the same file, so real net production code is roughly +900-1000 lines in impl Staged/new types) and docs/prefix-cache-offload.md (+5/-1). Zero discussion on the PR (only the flare-autobot case-file comment).

Design: splits InboundRecord into HostInbound (unchanged private path for read_into/composite) and new DeviceInbound (fetch/pump_device_inbound). New machinery: SharedSegment/SharedSegmentId (one open file handle per (path, Header), acquire_shared_segment disk_store.rs:1362), SharedWindow/SharedWindowId (one staged 64-page window fanned out to per-follower GPU uploads; struct 1070), SharedFileState (Unopened/Opening/Opened/Closing/Closed, 1006), SharedWindowPhase, WindowFollower, PlanState, DeviceActiveWindow, DeviceSegmentRef. plan_aligned_windows (700) slices on 64-page WINDOW_PAGES boundaries instead of per-restore skip offsets. pump_device_inbound (1811) is 5 passes (reap/detach, attach, sweep, start windows, submit reads, per-follower uploads, close, completion) with helpers 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). Test-support counters disk_opens/disk_window_reads/coalesced_windows (1227).

Correctness checks I did: DiskThread replies are per-job FIFO (disk.rs:447-455) so the pending_row_reads VecDeque FIFO matching Operation::ReadRow (window field is 0 at disk.rs:626) is sound, mirroring the old code. Busy/close accounting extended to shared_segments/shared_windows (2344). Fetched waits for last-user segment settle (Pass 5e, 2205-2255) because the index pin is released on Fetched in DiskStore::apply (3609-3615) - correct.

Charter fit: Goal 4 "Store prefix-cache checkpoints in host memory and share them across Flare instances via Selene"; docs goal. Not a non-goal. Layer is right (selene runtime, not per-model).

Benefit (author's own numbers): 4 branches sharing a ~61K ancestor on GB10 SM121 disk-only: physical NVMe reads 18.0 GB -> 4.29 GB (-76%, 4.21x); staggered 18.1->4.56 GB (3.97x); Flash-Next TP1 7.94->1.98 GB; TP2 8.39->2.08 GB. Burst median TTFT: 27B TP1 8484->7112 ms (-16.2%), staggered 8200->6539 ms (-20.3%, claim is 3259 ms "dropped" which is only true as a sum of two rows); Flash-Next TP1 simultaneous 3333.5->3337.1 ms (0%), staggered 3052.9->2977.0 (-2.5%); TP2 -4.5%/-6.9%; DeepSeek TP4 4-host 1.00x reads, TTFT -1.1%. So the latency win is concentrated on 27B TP1 bursts; smaller models see ~0-7%.

Costs/risks found: single disk thread at WINDOW_CREDITS(in-flight windows) with shared windows holding pool slots until all followers upload (1070-1092 comment); a coalesced window occupies slots for the max of follower upload times; fair ordering weakened because pick_next_pending_plan (1684) prefers sibling demand; fetch dispatch now scans shared_windows/shared_segments linearly per pump call and build_pending_demand (1647) clones PathBuf+Header keys into a HashMap every pump while free slots exist (author admits "per-pump demand indexing"); acquire_shared_segment (1362) scans all segments on every fetch; one shared read error fails all attached restores (intentional). Timing-sensitive tests: staggered test asserts coalesced_windows() >= 2 and disk_window_reads()+coalesced_windows()==10 (8444-8445).

Evidence gaps the author states: single-pass SM121 runs not repeated after the demand-index/close-count edits or rebase; helios FLARE_RUN_CUDA_TESTS=1, discrete PCIe GPUs, Windows serving, live CompositeStore/PooledStore GPU serving not run. CI does run selene with --features test-support (native-serving.yml:51) so the SimulatedGpu tests do execute.

Alternatives considered: (a) keep single private path but dedupe via copier replication fan-out (copier.rs:31-40) - rejected, replication is for identical rank shares and pages still need one disk read to shared host slot; (b) serve restores out of the host/MemoryStore tier rather than disk staging - many deployments run --prefix-cache-memory 0 at 61K prefixes (~4.19 MB/page * 960 pages ~ 4 GB), so not a substitute; (c) let scheduler dedupe by ancestor checkpoint and share one ticket - Helios tickets are per-key (scheduler.rs:1668-1691) and the pages need different page ranges per branch, so not equivalent.

Companion PR #497 (selene-spark-pipeline) also touches Staged::pump_all; author says merge 496 first then rebase 497. Both from the same author, both unmeasured together.

Verdict leaning: worth it with changes - the problem is real and charter-aligned, the reduction is large on the target hardware, but the implementation is a ~1000-line state machine in an already 8.8K-line hot file and the PR needs a rebase/re-measure of the exact merged form, a guard against per-pump demand rebuild, and documented fair-ordering trade-off.

#4 [high] PR 496 head 0c04b1e2 — prior review items status (run 251)

Head reviewed: 0c04b1e2 (adds docs +33, shard.rs +10, disk_store.rs reworked). disk_store.rs now 9,358 lines total (was 6,976 on main).

FIXED at head (vs my 2026-11-24 report):

REMAINS:

  1. Exact-total flake still present: assert_eq!(staged.disk_window_reads() + staged.coalesced_windows(), 10) at disk_store.rs:8487 (comment at 8481-8484 admits W3 coalescing is timing-dependent).
  2. Kind::of has unreachable!("window rate samples stay local to rank zero") for the new variant (shard.rs:476-478) — real panic path in release if any future caller passes the event unfiltered; the two current call sites filter first (722, 1148).
  3. Benchmark topology inconsistency: prose says "8 child branches" but physical-read totals are byte-identical to the previous iteration described as 4 branches (18,177.5 -> 4,306.7 MB), 8 concurrent ~4 GB restores on main would be ~32 GB, and after (4.3 GB) is ~1 copy => the 4.22x looks like ≈4 overlapping restores. Also ratio labels slightly off: 7,944.9/1,981.1 = 4.01 (printed 3.99x), 7,958.0/2,251.5 = 3.53 (printed 3.52x).
  4. #497 (also FujitsuPolycom, open, head cd5a366b) rewrites Staged::pump_all incl. MAINTENANCE_DEFER_LIMIT; both now claim "merge in either order". #496's pump_all is at disk_store.rs:2291.
  5. Metering semantics shift: DiskStore::hit prices estimated_seconds = bytes / inbound_rate (3625) but inbound_rate is now raw disk-thread window throughput, excluding GPU upload and queueing; previously it was per-restore end-to-end (main observed job.started.elapsed()). worth_fetching (store.rs:423-438) therefore admits more restores; live disk-only runs were fine but the basis changed.
  6. Still not covered: live CompositeStore/PooledStore GPU serving, 2-GPU split_pools, discrete PCIe, Windows serving, multi-host RoCE (the shard.rs surface).

#5 [high] PR 496 head 0c04b1e2 — benchmark math and code cross-checks

Cross-check at head 0c04b1e2:

#6 [high] PR 496 — copy-count arithmetic and the 4.22x interpretation

Internal consistency check that supports the claim (head 0c04b1e2):

#7 [high] PR 496 — final-round findings for the verdict

Points to include in final report (head 0c04b1e2):

Best new findings this turn:

  1. After = 4,306.7 MB is ~exactly one 61K-prefix copy (954 pages x ~4.19 MB ≈ 4.0 GB); before = 18,177.5 MB ≈ 4.5 copies, while the description says 8 branches and 8x logical bytes_in. So the pre-window read total is NOT 8 copies. Ask the author to reconcile (either the burst overlapped ~4-5 restores at read time, or the physical gauge integrates a rate and undercounts). Directionally favourable either way: an honest 8-way figure would be larger than 4.22x. Simultaneous vs staggered before-totals differ by 0.1% (18,177.5 vs 18,194.2), which suggests a shared cause, not arrival timing.
  2. CompositeStore is covered by live GPU tests after all: composite.rs:1229 routes non-memory-resident chains to DiskStore::fetch → Staged::fetch (the coalesced path), and helios/src/offload/gpu_tests.rs:1275-1289 builds CompositeStore + DiskStore over real CUDA Transfers (gated by FLARE_RUN_CUDA_TESTS, which the author ran: 21/21 SM121). read_into (composite.rs:830) is the spill path. So the "Not covered: live CompositeStore GPU serving" line is more conservative than reality.
  3. CompositeStore keeps its own end-to-end disk_inbound_rate (composite.rs:897, 1000-1003), so the physical-window change only affects pure-DiskStore pricing (disk_store.rs:3615-3628) and the user metric. Add one sentence: the window rate excludes queueing and the GPU upload, and on multi-host it covers only rank-0 NVMe (shard.rs:1148-1150 drops the sample on peers).
  4. TransportEvent is pub through selene::disk_store (not re-exported in lib.rs:44-56); no in-repo exhaustive matcher outside selene/shard (searched helios + selene-manager: no matches). Adding a variant is safe in-repo but is a breaking change for any external matcher of a pub enum — worth one line in the description.
  5. No double-crediting found: a follower can only attach to a given (SegmentKey, first, count, row) once per plan, record.bytes += win.read_bytes per completed active window (1901), totals asserted per fetch in the burst test.
  6. Constant-time behaviour on the single-restore path is now real: build_pending_demand returns empty at len() <= 1 (1736), window_index O(1) (1646), Pass 2/4 share attach_pending. Only residual single-stream cost is plan_windows boundary alignment (≤ 1 extra partial window/segment), which is documented at docs:354-358 and matches the old code's per-restore packing closely.
  7. Charter tension to state plainly: +1,110 production lines in disk_store.rs (6,976 → 9,358 incl. tests), i.e. a 16% growth of the most delicate file in selene, for a win that is ~0-3% TTFT on the smaller supported model and ~29% on the flagship disk-only burst. Justified by the charter's bandwidth/disk-offload goal and by #497's intake shrink, but it should be named as the cost.

#2 [medium] Correction: prefixed models are ~192K, not 256K

Correction to entry 1: the benchmark family is Qwen3.8 (author's 8 branches each = ~61.3K shared prefix + ~256 unique tail tokens, total ~507K tokens across 8 requests, so dedup only within a branch, not across), which implies per-request capacity >= ~63K, so Qwen3.8-27B-NVFP4 / Flash-Next are ~192K-context models, not 256K. The point I wanted to avoid still holds: on compact hardware the prefix-cache --prefix-cache-memory 0 --prefix-cache-disk disk-only configuration is exactly where these duplicated ~61K-prefix bursts land (author's setup: 27B 40G disk limit, Flash-Next 24G), and a memory-first configuration would need 8 x ~4 GB of DRAM for the shared prefix alone, which is the reason disk-only exists for these runs. So "cache it in host memory instead" is not a substitute for the coalescing fix on the benchmarked topology.

Also confirm: docs/prefix-cache-offload.md:318-319 already states the existing dedup rule ("An outbound for a key already present or in flight is skipped. An inbound for a key already in flight attaches the request as another waiter") which is why the old per-branch Staged::fetch each re-read the shared ancestor; that is the gap this PR closes, and section 2.4 (docs:337-343) is the updated paragraph.