Recommendation: Changes Requested
Four of the five changes in this PR are sound, well-placed, and verified by targeted tests (the #481 pre-6.7 sealed-memfd read-only reopen, Unix multi-worker io_uring lane fan-out + chunked warm, checked u64 mailbox validation + scored_prefill filtering, and PreparedPLELookup.publish_lookahead), but WaitBackoff re-lands the exact wait policy blocked in open PR #519 with a factually inaccurate main baseline claim and zero attributable served or readiness-wait measurements, while leaving the identical multi-worker lane-collapse bug untouched on Windows.
Blockers
WaitBackoffre-lands blocked PR #519's wait policy with a false before-state and no attributable served or readiness-wait evidence (helios/src/engram.rs:325-377, 685-687).- False before-state against
main: The PR description ("Why #3") claims#566"turned #519's spin-then-nap backoff inRequests::readinto dead code during normal serving." PR #519 is still open and unmerged;mainathelios/src/engram.rs:309-314has only a barestd::hint::spin_loop(). - Unmet evidence bar and unmeasured readiness-latency risk: PR #353 was closed and PR #519 was blocked on
2026-11-28 18:40on this exact wait because adding up toNAP_MAX(250 µs plus Linux timer slack) on the wait gating the Engram transfer stream can regress exposed GPU readiness wait (flare_replay_readiness_wait_nanoseconds_total) without a demonstrated served improvement overmain(Charter "Bring real evidence" / #210;AGENTS.md:165-169). - No attributable measurement: The only served benchmark reported here is a paired Qwen3.8 PLE lookahead run (cold 111,915-token prefill,
--embedding-table-workers 1) paired with the companion recipe PR, and the Limitations section states host CPU-time profiling ofWaitReadywas not run. Neitherflare_replay_readiness_wait_nanoseconds_totalnor a warm-cache alternating A/B isolatingWaitBackoffis reported. - Fix: Drop
WaitBackoff(and itsRequests::readchanges and tests) from #590 and keep it in #519 under that PR's evidence bar—or record an explicit maintainer decision accepting idle reader-thread CPU occupancy as the defect alongside paired warm-cache runs reportingflare_replay_readiness_wait_nanoseconds_totalto verify no readiness regression.
- False before-state against
Should Fix
-
Windows disk reader retains the identical multi-worker lane-collapse bug (
helios/src/engram/reader/windows.rs:56, 91-96).windows.rs:56sizes each lane todepth = DEPTH / workers, yetwindows.rs:91still checksif self.lanes.len() == 1 || reads.len() <= DEPTH, routing 33–128 reads onto a single 32-slot lane under Windows' documented default of 4 workers (docs/windows.md:147-148: "the default four workers share 128 slots and 8 MiB of staging per table").- Per
AGENTS.md:497-500(inspect equivalent paths before scoping a fix), apply the samelane_depth = DEPTH / self.lanes.len()/active_lanesfan-out towindows.rs:91-96, or explicitly state in the PR description that Windows I/O ring dispatch is out of scope here and tracked as a follow-up.
-
If
WaitBackoffis retained:Requests::read's backoff loop is unreachable in serving, and theWaitReadytest cannot distinguish napping from spinning (helios/src/engram.rs:309-316, 654, 1142-1182). (Moot ifWaitBackoffis dropped per Blocker 1.)- The only production caller of
Requests::readisReaderAction::Gather(helios/src/engram.rs:654), whichnext_reader_action(engram.rs:401-406) dispatches only afterjob.requests.is_ready(cancelled)returnstrue(andengram.rs:651already returnsErron cancellation beforereadis called). Thewhile ready.load(Ordering::Acquire) != sequenceloop inRequests::readtherefore never iterates in production, contradicting the PR description's "used by bothReaderAction::WaitReady... andRequests::read". - In
wait_ready_backoff_naps_until_publication_or_cancellation_and_resets(engram.rs:1142-1182),assert!(rounds.0 > SPIN_ROUNDS)after sleepingAFTER_SPIN = 5 mspasses even ifyield_coreonly spins (a tight spin loop executes far more than 4,096 rounds in 5 ms), and the test never exercises cancellation despite its name. RemoveWaitBackofffromRequests::readand add a#[cfg(not(windows))]upper bound onrounds.0(plus a cancellation check) if the backoff stays.
- The only production caller of
-
PR description evidence attribution and
warm-truncation scope (AGENTS.md:98-100, 103-112).- Explicitly attribute the paired Qwen3.8 served benchmark (
--embedding-table-workers 1, synchronous PLE gather -76.5%, cold 111,915-token TTFT -4.6%) toPreparedPLELookup.publish_lookahead+ the companion Qwen3.8 recipe PR, and state that multi-worker QD fan-out (bypassed atworkers == 1), pre-6.7EPERM, andu64wrap /scored_prefillvalidation are covered by unit tests rather than exercised by that served run. - Clarify item 1's
CachedReader::warmtruncation claim: in serving,pending_warm.len() <= prefetch_max_rows <= max_staged_rows == max_tokens * table.heads == reader.max_rows(helios/src/runtime_core/engram.rs:314-323,helios/src/engram.rs:264, 539), soids.len() > self.max_rowsis unreachable from the reader loop and only affects directReader::warmcallers.
- Explicitly attribute the paired Qwen3.8 served benchmark (
Subtract / Simplify
None. (Removing WaitBackoff or its unreachable Requests::read half is already covered by Blocker 1 and Should Fix 2.)
Nits
-
Windows
dead_codewarnings and inaccurateSPIN_ROUNDS/AFTER_SPINdoc comments (helios/src/engram.rs:325-332, 1090-1091). (Moot ifWaitBackoffis dropped per Blocker 1.)NAP_GROWTH(:329) andNAP_MAX(:332) are referenced only inside#[cfg(not(windows))] fn yield_core, so Windows builds will emitdead_codewarnings unless both constants are gated#[cfg(not(windows))].SPIN_ROUNDS(:325-327) claims "enough to catch IDs the graph published before the wait began", but pre-published IDs are already observed on the firstis_ready/ready.load(Ordering::Acquire)check beforewait.step()runs; bothSPIN_ROUNDSandAFTER_SPIN(:1090-1091) also describe napping unconditionally even though Windows keeps spinning.
-
Preserve the
/proc/self/fdreopen error in theEPERMdiagnostic (helios/src/engram/reader.rs:139-158).Self::open_readonly_view(file).ok()discards theio::Errorif opening/proc/self/fd/<fd>fails (e.g.,ENOENTvsEACCES). Keeping theResultlets theEPERMerror message report why/proc/self/fdcould not be opened while still preserving the fallback tofile.as_raw_fd()on Linux >= 6.7 hosts without procfs.
Verified passes
- Pre-6.7 Linux sealed-memfd read-only remap (#481,
helios/src/engram/reader.rs:108-176, 2294-2325): Reopening/proc/self/fd/<fd>viaFile::open(O_RDONLY | O_CLOEXEC) clearsVM_MAYWRITEwhile preservingF_SEAL_*checks andMADV_POPULATE_READ;ResidentMappingis constructed beforemadvisesoDropunmaps onmadvisefailure; the new Linux test verifiesF_GETFL == O_RDONLYandmprotect(PROT_READ | PROT_WRITE)returningEACCES. - Unix multi-worker
io_uringlane fan-out (helios/src/engram/reader.rs:787-800):lane_depth = DEPTH / self.lanes.len()is always in{128, 64, 32, 16}(workersvalidated to1 | 2 | 4 | 8),active_lanesis in2..=self.lanes.len()wheneverreads.len() > lane_depth, andself.lanes[..active_lanes].split_first_mut()is panic-free. CachedReader::warmchunking (helios/src/engram/reader.rs:939, 1081-1140, 1293-1304):CachedReader::newrejectsmax_rows == 0, soids.chunks(self.max_rows)cannot panic; per-chunkprefetch_rows_loadedaccounting eliminates caller-side double-counting and stays accurate if a later chunk fails.- Checked
u64mailbox validation, allocation bounds, andscored_prefillfiltering (helios/src/runtime_core/engram.rs:224, 242-347,helios/src/engram.rs:848-881): Closes the release-buildshape[0] * 8wrap ((1 << 61) + 1,1 << 61) andMappedHostoffset-overrun holes;Transfers::newbounds agree withruntime_core/engram.rsso existing exported cores remain backward compatible;scored_prefillnow matchescrate::engram::consumes(helios/src/engram.rs:1011-1021) andignition/preparation/contract.py:88-89. PreparedPLELookup.publish_lookahead(ignition/components/ngram_delivery.py:78-96, 157-165): MatchesPreparedPLELookup.publishandAdvisoryMailbox::snapshotlayout (countatnbytes - 16,flagatnbytes - 8), executes during Ignitiontorch.compile+ CUDA graph capture (zero serving-time allocation), and allocates fresh graph-localidssoself.idsis not corrupted.
Dropped on verification
- B2 (downgraded from Blocker to Should Fix):
helios/src/engram/reader/windows.rs:91is a pre-existing bug in an untouched file rather than a regression introduced by #590. - S2 (revert chunked
CachedReader::warm/ delete test):gatherrejectsids.len() > self.max_rowsbecause it fills a bounded caller staging buffer (helios/src/engram/reader.rs:1001-1004), whereaswarmhas no output slice andCachedReader::newenforcesmax_rows > 0(reader.rs:939), so chunking is safe, zero-cost for single chunks, and its regression test should be kept. - S3 (
publish_lookaheadinert in-repo / wrong row count / wrong docstring): Model recipes live in externallocal-inference-lab/hyperflare-recipes(bothPreparedPLELookupand #566'sPreparedEngramRequests.publish_lookaheadlikewise have zero in-repo callers);publish_lookaheadruns during Ignition graph capture so its docstring is accurate; andtoken_count=ids.shape[0]matchesPreparedPLELookup.publish,self.plan's preparedcaps, and thePACKED_TOKEN/max_staged_rowscontract (helios/model-contract.md:117-125,helios/manifest.md:469-470). - S4 sub-items (defect count 4 vs 5,
during graph capturedocstring,O_RDONLY | O_CLOEXECvsFile::open,.ok()omitted): The description accurately counts 4 defects + 1 missing interface = 5 items;publish_lookaheadexecutes during graph capture; Rust'sFile::openon Unix opensO_RDONLY | O_CLOEXEC; and the description explicitly states "falling back tofile.as_raw_fd()if procfs is unavailable". - X1 (delete
Transfers::newbounds checks andchecked_add(1/2)):checked_add(1/2)is mathematically reachable (u64::MAX = 3 * 6148914691236517205andu64::MAX - 1is divisible by 2, both validcompact_headsvalues under TP8 on 24/16 heads), andTransfers::new(helios/src/engram.rs:848-875) is cheap local defense-in-depth directly guardingaddress + nbytes - 8/- 16unsafe pointer math. - X2 (delete new fan-out test and fold into
parallel_unix_disk_workers_preserve_rows_and_propagate_truncation): The existing test (reader.rs:1934-2021) exercisesreads > DEPTH(160 IDs), whereas the new test (reader.rs:2221-2292) specifically targets the previously brokenlane_depth < reads <= DEPTH(80 IDs) regime. - X3 (merge
_advisory_requestsinto_requestsand reuseself.requests): Separateflare::ple_advisory_requestsmirrorspublish_requests/publish_advisory_requests(ignition/components/ngram_delivery.py:36-56), and keepingrequestsas a graph-localtorch.emptyfollowsAGENTS.md:505-507with zero persistent VRAM. - X4 (inline
map_fd/ drop.ok()fallback):open_readonly_viewis called by the Linux unit test (reader.rs:2304),map_fdcleanly isolatesunsafe { libc::mmap }, and the fallback tofile.as_raw_fd()preserves startup on Linux >= 6.7 hosts without procfs (narrowed to Nit 2 to surface the reopen error onEPERM). - N2 (extract helper for
GraphKind::try_from(g.kind.as_str()).is_ok_and(crate::engram::consumes)): Low-signal nit; a single-line idiomatic filter across three sites (helios/src/runtime_core/engram.rs:224,333,helios/src/runtime_core/model.rs:480-481) does not justify an extra wrapper.