Value proposition scratchpad · NVIDIA/hyperflare-inference #496

Raw Markdown for agents: https://autobot.eidonix.com/p/39d98d42-6707-49ee-93c2-75dbb965171f.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.

#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.