Explore scratchpad · NVIDIA/hyperflare-inference #713

Raw Markdown for agents: https://autobot.eidonix.com/p/30b846f8-b031-459e-9679-bef2f8862d5b.md

#1 [high] Change: what PR #713 does, files and size

PR #713 (jcartu, open 2026-12-03, head 4efd9fd, base main, branch point cc0a49d). Refs #630. No labels, no reviews, no CI checks.

Real changed files (pr_files): flare-cli/src/{config.rs +103, core_cache.rs +3/−1, distribution.rs +240/−3, main.rs +31/−28, orbit/agent.rs +3/−1, orbit/controller.rs +91/−3}, helios/src/{core/cache.rs +20/−9, lib.rs +4/−1, runtime_core/driver.rs +2, runtime_core/memory.rs +266, runtime_core/mod.rs +16/−2}.

Three independent changes:

  1. flare-cli/src/distribution.rs::serve_source now streams peer-served core ranges with O_DIRECT via direct_reopen/FileReadAt/allocate_aligned (re-exported from helios::lib.rs, originally eos/src/lib.rs:24,48,61 and eos/src/unix.rs:61), plus release_page_cache_range after serving. Falls back to copy_ranges_buffered (RangeReader + release_page_cache_range) when O_DIRECT is unavailable or returns EINVAL mid-stream. Four new release_page_cache call sites: orbit/controller.rs upload put loop, core_cache.rs AlreadyExists digest re-verify, orbit/agent.rs get, helios/src/core/cache.rs (write_stream post-sync_all, verify_file, hash_file, non-Windows copy_file).
  2. flare-cli/src/config.rs makes orbit run inherit [memory] reserve as MemoryLimit::Reserve when --memory-limit is unset; main.rs tracks memory_limit_from_config; orbit/controller.rs::merge_serving_options refuses to overwrite a persistent group's saved --memory-limit with the config-inherited one while letting an explicit CLI flag override.
  3. helios meminfo diagnostics: new LinuxMemInfo{free,available,cached} parser for /proc/meminfo in runtime_core/memory.rs, appended to the Plan cache summary on integrated GPUs, stderr warning when memory-limited and MemAvailable−MemFree > 10 GiB (PAGE_CACHE_WARN_THRESHOLD), and enrich_integrated_ctx_oom attaching meminfo + drop_caches hint (>4 GiB gap) to CUDA_ERROR_OUT_OF_MEMORY on cuCtxCreate_v2 / cuDevicePrimaryCtxRetain. New const CUDA_ERROR_OUT_OF_MEMORY=2 in driver.rs.

#2 [high] Change: PR diff view is polluted by merged sibling PRs (stale base)

The pr_diff tool output for #713 does NOT match pr_files. The diff includes whole-file changes to flare/src/controller.rs (gpu/active_gpu fields, desktop_cuda_ordinal), flare-winui/bridge/src/lib.rs, helios/src/cache.rs (only_child tracking, eviction priority), helios/src/cache/lifecycle_tests.rs, helios/src/execution/roce.rs (gid_indices per-HCA), selene/src/lib.rs, docs/*.md, AGENTS.md, .github/workflows/native-serving.yml, docs/TODO.txt — none of which appear in this PR's file list.

Cause: the branch point reported is cc0a49d and the repository's commit graph is partly unreadable (search_history fails: "Could not read c513e46a… fatal: Failed to traverse parents of commit ef38cb9…"), so the merge-base computation is stale and the diff is taken against a much older commit than main's current tip.

Consequence for anyone reading: the ~1.29M-character "diff" overstates the change. The authoritative scope is the 11 files in pr_files. Do not attribute the AGENTS.md/CUDA_HOME rewrite (that is #690, merged 2026-12-03), the WinUI GPU-by-UUID work (that is #702, merged 2026-12-03), the RoCE per-device GID change, or the prefix-cache only_child refactor to #713.

#3 [high] Why: #630's three asks vs what #713 answers

Issue #630 (pfn, opened 2026-11-30, updated 2026-12-02, open, labels area:memory/bug/performance/priority:P2/triage:investigate). 2× DGX Spark GB10 (121.6 GiB unified), flare 0.5.0, GLM-5.3-Flash-FP4 TP2, [memory] reserve = "4G".

Symptom: on identical cores/flags, orbit run plans 13.0–14.4 GiB cache budget / ~1.96–2.19M KV tokens (limited by memory) vs 20.5–22.2 GiB / 3.15–3.43M for a manual flare run after cache eviction — −37.8%, and 1,961,984 tokens is below the reporter's 2,000,000 operating floor. MemAvailable reads ~115–116 GiB in every state; only MemFree predicts the outcome. Separately, cuCtxCreate_v2 failed (2, CUDA_ERROR_OUT_OF_MEMORY) during Initialize GPU with MemFree 0.8–1.5 GiB while MemAvailable ≈116 GiB.

Three asks from #630:

  1. Size the KV plan (and CUDA context budget) from MemFree, or flush reclaimable cache before planning.
  2. Print MemFree/MemAvailable/Cached alongside Allocate cache, and warn when they diverge by >10 GiB.
  3. Print MemFree/MemAvailable/Cached on the cuCtxCreate failure path.

How #713 matches: ask 2 → append_integrated_meminfo in helios/src/runtime_core/memory.rs appends the triple to the Plan cache summary and emits a stderr warning when limited_by_memory && MemAvailable−MemFree > 10 GiB (PAGE_CACHE_WARN_THRESHOLD = 10<<30). Ask 3 → enrich_integrated_ctx_oom appends the triple to CudaError.description plus a drop_caches hint when the gap > 4 GiB (CTX_OOM_DROP_CACHES_THRESHOLD). Ask 1 is only partially served: the PR adds more page-cache release sites and switches peer serving to O_DIRECT, but it does NOT change sizing to read MemFree — shared_available still goes through flare_selene::offload::available_memory (helios/src/runtime_core/memory.rs:32 area). Description says "live GB10 impact remains unmeasured". Third #630 comment (2026-12-02, on v0.5.1/1fbcc3c9/#667) records controller MemFree 1.0 / MemAvailable 11.2 / Cached 10.6 GiB at idle, ~9 GiB of distribution-related page cache still resident, and that none of #667's release calls visibly cleared it by plan time — exactly the gap #713's four extra release sites + O_DIRECT target.

#4 [high] Related work: #646 and #667 are the page-cache campaign #713 continues; #323 was closed on the premise #713 fixes

Lineage of #630 mitigation work (all by different authors, all merged):

#5 [high] Project fit: charter (DGX Spark, Orbit, evidence) and the docs #713 makes stale without touching

Charter (read_charter) facts bearing on #713:

Docs on main that #713 makes true or leaves stale (no docs files in pr_files — zero documentation changes):

design-review token: the description says .githooks/commit-msg: passed (design-review=2e5b), but docs/design-review.md:298 requires a Design-Signed-Off-By: <reviewer identity> line; the PR names no sign-off identity.