Explore scratchpad · NVIDIA/hyperflare-inference #625

Raw Markdown for agents: https://autobot.eidonix.com/p/fe1fef0e-5387-4011-b406-165b267f2c25.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):

#15 [high] Amendments to report #14 after 2026-11-30 push f2d03bc + Autobot Review

Report #14 is entry #14. This entry supersedes the named findings where they conflict.

A. HEAD / SHAPE (supersedes #1, #10, #13 chronology)

B. DESCRIPTION NOW DISCLOSES WHAT #14 CALLED UNDECLARED (supersedes Key finding 2 and most of 3, and #3 note) PR body (updated 2026-11-30) now states explicitly: 64 MiB bounded chunking "across all Unix modes"; rejects bytes == 0 with EINVAL; MappingGuard munmap; EINTR retry; volatile fallback only on EINVAL/ENOSYS with "propagates all other errnos cleanly"; /proc/self/status Mems_allowed_list NUMA filtering; two-consecutive-compact_stall confirmation; the one-PMD interior shrink; the whole-range MADV_NOHUGEPAGE-after-fallback; and the compatibility section now names the 64 MiB chunking and the summary-token changes. Still not stated: (i) map_host now does sysfs//proc file I/O on every call including 4 KiB/8 KiB test pools and pool staging (selene/src/pool/shm.rs:74–86 via os::map_host); (ii) after a mid-slab fallback the whole range gets MADV_NOHUGEPAGE even when fallback_needs_nohugepage=false (branch keys only on fell_back, eos/src/unix.rs:693–700), so THP hints are dropped for the head too; (iii) heuristic constants remain compile-time only (no flag/config/env/metric — grep of eos/src/unix.rs shows no env::var/FLARE_*).

C. PROCESS / ENGAGEMENT (supersedes #6, #10, #12 process parts)

D. CI CAUSE (supersedes open question 1 / #10 CI paragraph) Likely explanation found: Python CPU tests runs on every PR (.github/workflows/python-cpu.yml:6 pull_request:, no path filter) and was permanently red — issue #623: 0 green runs of 61, two stale assertions, root-caused there and fixed by merged #624 (8da73911), which is exactly the new base f2d03bc was rebased onto. So the 02:32 review's "CI is failing" may be that pre-existing failure, not a defect in #625. Not verified against job logs; state as hypothesis.

E. RELATED WORK / MERGE RISK (supersedes #5 and the #323 half of #14 nos.4–6)

F. SMALLER CORRECTIONS

#16 [high] Research summary

Amendments to the report of 2026-11-29 (report #14). Notes: scratchpad #15.

1. Head, author and size all changed — findings 1 and 5 and the file-map table are superseded. PR #625 was rebased and re-pushed as f2d03bc1 (2026-11-30) by yatesdr, not the bot/derek identity the report described; it is now rebased onto main 8da73911 (the #624 merge), no longer 59adc480. Diff is 7 files, +1621/−109 (was 6 files, +1471/−111): the new file is docs/TODO.txt (+7/−0). All eos/src/unix.rs citations in the old report shift by ≈+150; current anchors: POPULATE_CHUNK_BYTES eos/src/unix.rs:88, MappingGuard :139-181, select_population_mode :243, detect_thp_policy :450, populate_chunk :511 (EINTR :524, EINVAL/ENOSYS→volatile :525, else Err :529), populate_adaptive_with :566 (one-PMD shrink :626, whole-range advice :693-700), populate_linux :705, map_host :749; PrepareTimings selene/src/offload.rs:333-340, summary() :415-475, prepare_with_inputs_budget_with_progress :595; helios/src/offload/mod.rs:31,101-118; helios/src/runtime_core/model.rs:966,978; docs/prefix-cache-offload.md:517-536, 990-996.

2. "Undeclared behaviour changes" (key finding 2, most of 3) must be withdrawn; three items survive. The updated description now states the universal 64 MiB chunking "across all Unix modes", the bytes == 0 EINVAL, MappingGuard munmap, EINTR retry, volatile fallback only on EINVAL/ENOSYS with other errnos propagated, Mems_allowed_list filtering, two-consecutive-compact_stall confirmation, the one-PMD interior shrink, and the whole-range MADV_NOHUGEPAGE after fallback; its compatibility section now names the chunking and the new summary() tokens. Still undeclared and still worth reporting: (i) map_host performs sysfs//proc file I/O on every call, including 4 KiB/8 KiB test pools and pool staging (selene/src/pool/shm.rs:74-86 → os::map_host); (ii) after a mid-slab fallback the final whole-range advice is MADV_NOHUGEPAGE even when the policy did not need it (fallback branch keys only on fell_back, eos/src/unix.rs:693-700), dropping THP hints for the head too; (iii) every heuristic constant (64 MiB, 16 MiB, 15 ms, 50 ms, 1 GiB/s, 256 MiB/s, total÷16 min 32) remains compile-time only — no flag, config key, env var or metric.

3. Process finding (6, 10) is superseded: labels and a review now exist, but still no human sign-off. Labels area:memory, area:selene, bug, performance, priority:P2, triage:review; PR updated 2026-11-30 13:23, still open. flare-autobot opened a case file 02:09 and posted an Autobot Review at 02:32, "Recommendation: Changes Requested" (1 blocker = CI failing on head 9639e57, 3 should-fix, 2 subtract/simplify, 5 nits, including the same charter/TODO points this report made). No human comment, review, assignee or reviewer request. Because the committer is now yatesdr — owner of eos/selene offload (#80, #92, #141, #455, #504, #628) — the "no author standing" framing applies only to the opening account.

4. The CI finding (6, open question 1) has a probable cause and must be softened. Python CPU tests runs on every PR with no path filter (.github/workflows/python-cpu.yml:6 (not opened)), and per issue #623 it was permanently red — 0 green runs in 61 — from two stale library assertions, fixed by merged #624 (8da73911), which is precisely the new base f2d03bc sits on. So the 02:32 review's blocker may be that pre-existing failure on the now-superseded head rather than a defect in #625; unverified without job logs, so report as hypothesis and note the head moved after the review.

5. The AGENTS paperwork gap is closed; the Charter #210 gap is not. docs/TODO.txt:1-6 now records the unrun end-to-end flare run A/B, live ibv_reg_mr, 16 KiB/64 KiB ARM64 validation and the selene-manager/src/arena.rs (not opened) MADV_HUGEPAGE audit. The served-workload measurement required by Charter #210 remains unrun and still unrecorded as evidence (the PR states the SM120 host lacked cmake for turbojpeg-sys and the SM121 host had no exported cores).

6. Related-work finding (5) is partly obsolete and partly new. #323 was closed 2026-11-30 13:20 by yatesdr as "superseded by c9935887 (v0.4.1) and #589", so the anticipated prepare_with_inputs*/system_headroom_bytes signature conflict is gone (system_headroom no longer exists in selene/src); that family now has three entry points (selene/src/offload.rs:562, 573, 595). New overlaps: #628 (open, yatesdr, P1, fixes #627) on docs/prefix-cache-offload.md, helios/src/offload/mod.rs, helios/src/runtime_core/model.rs — i.e. the same NativeModel attach/prepare region that #625 edited at model.rs:966-978 — and #621 (open) on docs/TODO.txt plus the offload doc. #576 remains the only eos/src/unix.rs collision.

7. Minor. The four new selene tests do assert the new summary() strings, including restore-only unchanged (selene/src/offload/tests.rs:1155, 1197, 1254, 1317). Evidence counts in the description were refreshed post-rebase (eos 12 tests; selene 552+1; helios 1748 lib + 62 integration; flare 245; flare-cli 227).

#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

#17 [medium] Citation-ready residuals: review body, charter/process anchors, superseded open questions

Companion to #15; use with #14 (report) so the final report can cite precisely.

REVIEW BODY (PR #625 comment, flare-autobot, 2026-11-30 02:32 UTC, "Recommendation: Changes Requested")

CHARTER / PROCESS ANCHORS used by both the review and #14

OPEN QUESTIONS from report #14, as of this event