Explore scratchpad · NVIDIA/hyperflare-inference #625

Raw Markdown for agents: https://autobot.eidonix.com/p/34caaa47-8b71-456c-938b-2f70cd6982ca.md

#1 [high] Change: PR #625 size and file map

PR #625 "Avoid THP compaction stalls in eos::map_host and report offload startup timings", fixes #616. Open, ready for review, opened 2026-11-30, head 9639e57, base main. Author flare-autobot (COLLABORATOR). No comments, no reviews, labels none. CI on head: FAILED (per orientation packet).

Files (pr_files):

Description's "What Changed" matches the diff contents; no schema/ABI change claimed. Diff contains nothing beyond the described scope (verify further).

#2 [high] Change: eos::map_host rewrite mechanics (verified in code)

#3 [high] Change: what the diff does that the description understates

Details present in the diff that the PR description does not call out (potential reviewer interest):

  1. POPULATE_CHUNK_BYTES = 64 MiB chunking applies to every policy and to non-Linux Unix too (eos/src/unix.rs:88, populate_chunks line 462) — the description only frames chunking as part of the THP-policy strategy; the mmap_lock-hold reduction is therefore global, not only under synchronous-compaction policies.
  2. Error-handling reversal: previously any madvise(MADV_POPULATE_WRITE) failure silently fell back to volatile writes; now only EINVAL/ENOSYS fall back and other errnos (e.g. ENOMEM) propagate, and the mapping is unmapped (MappingGuard drop). SlabPool::new maps this to invalid("allocate host slots: …") (selene/src/slab.rs:164-165). This turns previously-silent degradation into a hard startup failure for non-EINVAL/ENOSYS errors. Not mentioned in the description's compatibility section.
  3. map_host now performs file I/O (/sys/.../transparent_hugepage/*, /proc/buddyinfo, /proc/vmstat) on every call; callers include SlabPool::new (selene/src/slab.rs:164) and pool staging Region::anonymous (selene/src/pool/shm.rs:78), i.e. also for small mappings (tests create 4 KiB/8 KiB pools).
  4. In the adaptive path the final whole-range advice after a fallback is MADV_NOHUGEPAGE even when fallback_needs_nohugepage == false (line 611-616 compares only fell_back), i.e. a mid-slab fallback disables THP hints for the whole slab, including the head that already got huge pages (measured AnonHugePages=2,046 MiB retained, so populated huge pages are not split back).
  5. When the single-PMD shortcut is not taken and both ends are PMD-aligned, the code anchors the last byte and shrinks the hugepage interior by one PMD (line 542-550); this is described, but the consequence is that the last PMD of such slabs is always populated as base pages.
  6. Heuristic constants (15 ms / 50 ms / 1 GiB/s / 256 MiB/s / total/16 min 32 / 64 MiB / 16 MiB) are compile-time constants with no operator override — description frames avoiding sysctl/switch as a benefit; charter line "Be explicit and pin everything. No magic defaults" is the matching project rule.
  7. New public item on Prepared: timings: PrepareTimings field (selene/src/offload.rs:368), plus PrepareTimings and prepare_with_inputs_budget_with_progress re-exported from helios (helios/src/offload/mod.rs:30-31, 101). Public API surface growth (additive).
  8. Summary text change is user-visible in startup log: memory X GiB (N slots, populate 12.3s, register 4.8s) · disk DIR (limit L, N records, staged, scan 0.9s) versus previously no durations (selene/src/offload.rs:415-475; assertions selene/src/offload/tests.rs:1189-1193, 1246-1248, 1304-1310).

#4 [high] Why: #616 is a live P2 regression report tracing back to #589

#5 [high] Related work: #589 caused it, #576 and #323 collide on the same files

#7 [high] Project fit: charter alignment and the rule-nearby tensions

#8 [high] Claims and evidence: each claim checked in code; benchmarks unverifiable from repo

Claims vs evidence (verified by reading the description and diffs):

  1. "map_host keeps its pub fn map_host(bytes: usize) -> io::Result<usize> signature" — TRUE (eos/src/unix.rs:664). No caller changes needed; flare_eos::map_host re-exported via eos/src/lib.rs:10-12.
  2. "rejects bytes == 0 with EINVAL" — TRUE (line 656), tested at eos/src/unix.rs:816.
  3. "MappingGuard munmaps on any population error" — TRUE (Drop at line 173), tested at line 824.
  4. "retries on EINTR; volatile fallback only on EINVAL/ENOSYS" — TRUE (line 446-453).
  5. "reads sysfs THP enabled/defrag/hpage_pmd_size, portable 2/32/512 MiB defaults" — TRUE (lines 228-240, 383-398), unit-tested (line 838+).
  6. "24-cell (enabled,defrag) mode matrix" — the test iterates 4 enableds × 6 defrags = 24 (eos/src/unix.rs:866-930).
  7. "walks growing PMD-aligned chunks from hpage_pmd_size up to max(16 MiB, hpage_pmd_size)" — TRUE (lines 558-596): chunk doubles each iteration, capped.
  8. "stall_floor = max(15 ms, chunk_bytes / 1 GiB/s), hard_ceiling = max(50 ms, chunk_bytes / 256 MiB/s)" — TRUE (lines 348-360).
  9. "compact_stall sampled a second time only when latency falls in (stall_floor, hard_ceiling]" — TRUE (lines 581-595).
  10. "falls back when free huge pages drop below chunk_hugepages + (total_hugepages / 16).min(32)" — TRUE (line 343).
  11. "finishes with one whole-range madvise so Linux merges all sub-VMAs" — TRUE (line 611-616); live smaps assertions in tests at line 1103+ and 1196+.
  12. "PrepareTimings (slab_populate, cuda_register, disk_scan, each Option)" — TRUE (selene/src/offload.rs:331-340).
  13. "prepare_with_inputs_budget_with_progress(..., on_step: impl FnMut(&str))" — TRUE (selene/src/offload.rs:594, helios wrapper helios/src/offload/mod.rs:101).
  14. "progress step and timer reset before SlabPool::sized and again before pool.register" on split fallback — TRUE (selene/src/offload.rs:~710-730), asserted step sequence at selene/src/offload/tests.rs:1203-1250.
  15. "restore-only and disabled summaries byte-for-byte unchanged" — TRUE: selene/src/offload/tests.rs:1347, 1375 assert exact strings; selene/src/offload/tests.rs:255 asserts "disabled".
  16. "Prepare host prefix cache label and StartupStage::PrepareHostPrefixCache unchanged" — TRUE (helios/src/runtime_core/model.rs:934, helios/src/startup.rs:41,82); phase.detail is the pre-existing method (helios/src/startup.rs:325).
  17. "No Protobuf schema, model core format, or serving ABI changed" — plausible; diff touches no .proto, no core format code.
  18. Benchmark numbers (128.56 s → 30.99 s, 4.15x; 119 GiB in 57.19 s + 11.27 s register; compact_stall +25,654 → +62): author-supplied, not reproducible from the repo; no benchmark script or raw logs committed. No flare run end-to-end timing. Standard test suites are cited with counts (eos 11, selene 552+1, helios 1,753+62, flare 245, flare-cli 228, selene-manager 412).
  19. Test for map_host_advises_hugepages_and_prefaults_zeroed_pages was rewritten to accept hg OR nh depending on detected policy (line 1091-1130) — i.e. the old assertion "expects hg" is now conditional; on a defrag=madvise host the test asserts nh only when fallback_needs_nohugepage. Assertion strength is policy-dependent.
  20. The test adaptive_mid_mapping_fallback_merges_into_single_vma forces fallback with a synthetic buddyinfo closure (returns u64::MAX then 0) so it exercises the fallback path deterministically (eos/src/unix.rs:1145-1200).

#10 [high] Process: ready-for-review, zero reviews, CI failed, and the Windows-test hypothesis

#11 [high] Research summary

I gathered the case file for PR #625 across all eight angles, with 10 scratchpad entries carrying file:line and PR/issue citations.

The change. A 6-file, +1471/−111 PR that rewrites eos::map_host (+1008/−54 in eos/src/unix.rs) into a THP-policy-aware chunked populator, and adds per-step startup timings/progress to the offload prepare path (selene/src/offload.rs, selene/src/offload/tests.rs, helios/src/offload/mod.rs, helios/src/runtime_core/model.rs, docs/prefix-cache-offload.md). I verified every mechanism it describes in the code: the 4-mode policy matrix, the order-weighted /proc/buddyinfo reserve, the 15 ms/50 ms latency thresholds, the compact_stall re-sample, the final whole-range madvise for VMA merging, and the new PrepareTimings/on_step plumbing.

What a reader could not learn from the description (highest-value findings): 64 MiB chunking is applied to every policy and to non-Linux Unix, not just synchronous-compaction cases; error handling is reversed so non-EINVAL/ENOSYS population errors now abort startup (previously silent volatile fallback) — a hard failure mode not in the compatibility section; the allocator now reads /sys and /proc on every map_host call, including 4 KiB test pools and pool staging; a mid-slab fallback applies MADV_NOHUGEPAGE to the whole range even when the policy didn't require it; the last PMD of both-ends-aligned slabs is always base pages; and the new cross-platform test map_host_rejects_zero_bytes_with_einval asserts EINVAL but Windows map_host (eos/src/windows.rs:166) does not reject zero bytes — my leading (unverified) hypothesis for the reported CI failure on the ubuntu/windows-2022 matrix.

Connections. #616 is a live P2 regression that traces directly to merged maintainer PR #589's map_host reordering, so this is a follow-up fix to a day-old regression rather than a new feature; no competing THP fix exists. #576 (open) and #323 (open) both edit the same files — #576 adds tests to the same eos/src/unix.rs test module, #323 adds parameters to the same prepare_with_inputs* path and was already advised to refactor those signatures.

Fit and process. The change squarely meets the charter's "reproducible bug / measured performance issue" bar, but its benchmark is a standalone harness rather than the charter's required served flare run workload (the PR admits this), and its behavior is entirely compile-time constants with no operator knob, which sits near the "no magic defaults" rule. Zero reviews or comments; open <1 day; CI failed on head.

Full detail, citations and the claim-by-claim verification table are in the scratchpad entries.

#12 [high] Community: no comments, reviews or reactions at all

#13 [high] Recent activity: what changed lately in these files and whether #625 builds on or reverses it

Chronology immediately before #625 (base parent 59adc480, #540, 2026-11-29):

#6 [medium] People: area owners, author standing, zero engagement

Who works here (charter + commit history, 180 days):

#9 [medium] Reach: operators with large host slabs, log format, eos::map_host's other callers