Pre test report scratchpad · NVIDIA/hyperflare-inference #742

Raw Markdown for agents: https://autobot.eidonix.com/p/107d360a-81b8-4929-be35-19531b39d87e.md

#1 [high] PR #742 mechanism and code sites

PR #742 head f26d8a8, base f46a9922, +105/-21 in 9 files. Fixes pool-only capture-buffer oversizing.

Sizing chain (verified by reading head):

IMPORTANT bug-class caveat for planning (from code-correctness lens, later dropped on verification): memory.rs:1143 passes capture.then_some(minimum_pages) (NOT allocated pages) into headroom_inner; final slab at offload.rs:699 uses geometry page_capacity (allocated). Reviewer verified this is fine because the 1133 call only computes the pre-registration tier_host reservation and the real slab is built at offload.rs:702-754 from bytes derived again from headroom_inner with local_pages = allocated capacity (offload.rs:699). Still: the actual slab size at startup is min(allocated page_capacity, max_sequence_pages)+row_slots.

Gov/doc: docs/prefix-cache-offload.md:1593-1609 documents ceiling min(GPU page capacity, ceil(max_sequence_tokens/page_tokens)) + one row. Bypass risk: with --kv-cache-limit context|concurrency, page_ceiling caps maximum_pages near max_sequence_pages, so the min() is a no-op; A/B must use default --kv-cache-limit memory.

#2 [high] Hardware test plan facts for PR #742 (pool-only capture bound)

Mode gate: capture requires options.prefix_cache.pool_only() (selene/src/offload.rs:116-118: pool.is_some() && memory_bytes==0 && !disk_enabled()) AND self.cluster().is_none() (helios/src/runtime_core/memory.rs:1009) AND local_pages.is_some() && shard.is_none() (selene/src/offload.rs:699-700). So: --prefix-cache-pool ADDR, --prefix-cache-memory 0, NO --prefix-cache-disk, single process (no --rank/--hosts). Must use default --kv-cache-limit memory (flare-cli/src/cli.rs:926-939): with context|concurrency, page_ceiling caps maximum pages ≈ ceil(context/page_tokens) (memory.rs:585-607) so the new min() is a no-op and A/B shows nothing.

Expected slab slots (chain-dominated, max_concurrency small): slots = min(allocated page_capacity, MSP) + layout.row_slots(), MSP = ceil(max_sequence_tokens/page_tokens) (memory.rs:562-569, 1007). intake floor (uncapped): intake_slots = 2max_activerow_slots + 2*64 (selene/src/offload.rs:226-228); on main slots = max(pages+row_slots, intake); with wide --max-concurrency the cap can be invisible (intake dominates) — doc example: 1,664 intake slots /11.0 GiB vs 7.1 GiB chain.

Observables: startup log line "pool only: capture buffer {GiB} ({N} slots, populate …, register …)" (selene/src/offload.rs:432-460, emitted in phase "Prepare host prefix cache", helios/src/runtime_core/model.rs:1130); startup error "host budget cannot hold a full pool capture" (selene/src/offload.rs:175-176). Metrics gauges: flare_host_cache_slots_total (host_slots[1]) & flare_host_cache_intake_slots (=0 in capture mode) & flare_host_cache_slots_in_use, flare_total_kv_pages, flare_kv_page_tokens (helios/src/server/metrics.rs:1334-1400,1467-1501). Failure signals if the cap under-sizes: flare_host_cache_dropped_total{reason="oversize"} and flare_host_cache_retry_abandoned_total{reason="slabs"} (metrics.rs:861-873, 905-912), plus flare_host_cache_stored_total (must be >0) and flare_host_cache_hits_total/reused_tokens for restore. page_record_bytes can be derived from the startup log (bytes/slots) or cache.kv_page_bytes in flare inspect CORE --json (models: max_sequence_tokens, max_active; cache: page_tokens, pages, max_pages). RSS: /proc//status VmHWM; cgroup memory.peak for the failure-mode run.

Hardware fit: cn5 (SM120, 4×96 GiB, 125 GiB RAM, amd64) is the right host — single-process TP1 or TP4, default --memory-limit gives ~99k pages on 96 GiB so pages >> MSP for any 128K-context core (large gap). cn7 (GB10, 1 GPU, 60 GiB unified, arm64, SM121) exercises the integrated branch (integrated_offload_host_budget, sized_concurrency 1) — smoke only. Risk: model entries on both hosts are listed at 0 GiB, so a prepared signed core may not exist; flare models / flare inspect must confirm before any GPU run (exporting would need the full checkpoint). Not worth GPU time: throughput/isolation benchmarks (no hot-path change; qualify/host_cache_isolation.py), full helios --ignored GPU suite, tests/server/test_prefix_cache_offload.py (does not exercise pool-only), Kani/TLA+.

#4 [high] PR #742 head 5021b7a — test-plan deltas and hardware fit for cn5/cn7

Head moved f26d8a8 -> 5021b7a3 (base main f46a9922), 9 files +105/-21. Diff is refactor+test only vs f26d8a8: prepare_offload now takes NonZeroU64 (model.rs:1119-1126, called model.rs:1047-1053), max_sequence_pages(context: NonZeroU64, page_tokens: usize) helper with zero-page guard (memory.rs:563-568, call site :1006-1012), capture_chain_pages() shared by capture_growth (:1502) and planned_offload_host (:1568), PlannedHostBudgets{offload_host,max_sequence_pages,async_transfer_host_caps} (:32-36, :1604-1608). No behaviour change -> previous test plan stands, only the SHA to build changes.

Capture-path gate (unchanged, re-verified at head): selene/src/offload.rs:164-181 chain_pages = max_sequence_pages.map_or(pages,|l| pages.min(l.get())); chain = chain+row_slots; err "host budget cannot hold a full pool capture" :176-177; intake = chain.max(intake_slots).min(budget). pool_only() = offload.rs:117-119. intake_slots = 2max_activerow_slots + 128 (offload.rs:227-229). Single-process gate memory.rs:1014 (pool_only && cluster().is_none()); local_pages/shards offload.rs:700.

Hardware fit (models listed, all 0 GiB = not yet downloaded; flare models download / flare run MODEL fetches prepared cores: docs/cli-design.md:126-132, flare-cli/src/cli.rs:44-49,72-73):

Observables verified in helios/src/server/metrics.rs:

Inspect fields for pre-computing expectations (flare-cli/src/inspect.rs:1030-1076, :801-807): model.max_sequence_tokens, model.max_active, cache.page_tokens, cache.pages, cache.max_pages, cache.kv_page_bytes, cache.state_row_bytes, cache.snapshots.

Phase-2 reproduction lever (no privileges needed): host budget = MemAvailable - future - reserve, reserve = min(2GiB,total/32) + 5% total (selene/src/offload.rs:932-997) => on 125 GiB cn5 reserve ~8.25 GiB; hog host RAM with a touched-memory process until MemAvailable ~75 GiB so main's whole-chain charge (~70-109 GiB) exceeds budget -> clean "host budget cannot hold a full pool capture", while head's ~12 GiB chain still admits. cgroup (systemd-run MemoryMax) / ulimit -v are fallbacks and produce different error text. Manager sizing rule: /dev/shm must hold --memory + --staging (selene-manager/docs/operating.md:115-118); a GPU export needs staging reserved for the whole export (operating.md:71-90) => staging must exceed chain bytes (~12 GiB for 1M ctx) or the put fails NO_WINDOWS. Also worth one cheap regression start with NO prefix-cache flags: head now computes max_sequence_pages unconditionally in allocate_caches (memory.rs:1012) even when offload is disabled. Not worth GPU time: tests/server/test_prefix_cache_offload.py (never passes --prefix-cache-pool, gate at :26-31), --kv-cache-limit context|concurrency A/B (page_ceiling caps pages ~MSP, memory.rs:576-607), throughput benchmarks, full helios --ignored suite, Kani/TLA+/RoCE/Windows.

#5 [high] Corrections to my earlier cn5/cn7 plan for PR #742

Corrections vs my earlier plan (entry #3), all verified at head:

  1. Head is 5021b7a3 (base f46a9922). Diff vs f26d8a8 is refactor/test only (non-optional prepare_offload param model.rs:1119-1126; max_sequence_pages helper memory.rs:563-568; capture_chain_pages memory.rs:676-678 used at :1502 and :1568). Sizing behaviour identical → same plan, new SHA to build.

  2. cn5 has 4x96 GiB, and the ONLY KV-bearing core there is GLM-5.3-Flash-NVFP4 (TP4) = exactly the PR's own configuration (16,384 MSP + 91 row_slots = 16,475 slots / 11.8 GiB vs ~99,099 slots / ~70.7 GiB on main). dinov2 entries are vision encoders, no KV. So TP4 on GPUs 0-3, single process → satisfies cluster().is_none() gate.

  3. cn7 is ONE GB10, so the TP4 core cannot load there. Need a TP1 core (gemma-4-E4B-it, Qwen3.8-27B-NVFP4, Qwen3.8-Flash-Next-FP4-Local, MiniMaxAI/MiniMax-M3.1-Flash ...) confirmed with flare inspect --json tensor_parallel==1. Best place for the near-boundary publish/restore test because a small model on 60 GiB unified leaves a context small enough to prefill in minutes.

  4. Cores are listed at 0 GiB = not in the local cache. flare run also downloads a prepared core (cli.rs:44-46) and flare models download exists (cli.rs:128-129) → fetching is feasible, but needs network + publisher trust (docs/cli-design.md:747,970) and disk outside the 16 GiB scratch.

  5. Phase-2 lever FIXED: /proc/meminfo MemAvailable is host-wide, so systemd-run MemoryMax would NOT shrink the computed budget (host_pool_budget reads meminfo, selene/src/offload.rs:968-997) — it would only cause an OOM at slab touch. Correct lever = burn host RAM with a touched allocation to drive MemAvailable down. cn5 budget = MemAvailable − reserve, reserve = min(2GiB, total/32) + total/20 ≈ 8.25 GiB at 125 GiB. So main (needs ~72.6+8.25 ≈ 81 GiB) must fail while head (~11.8+8.25 ≈ 20 GiB) passes whenever MemAvailable sits between ~20 and ~80 GiB → target 40 GiB, a very wide window.

  6. Metric-label fix: flare_host_cache_dropped_total tier labels are dram|nvme only (metrics.rs:835), not "pool". For a too-small capture slab watch flare_host_cache_store_reasons_total{reason="slabs"}, flare_host_cache_retry_abandoned_total{reason="slabs"}, and flare_host_cache_dropped_total{tier="dram",reason="oversize"}. Root copies to the pool: flare_host_cache_root_pages_total{tier="pool",reason="first"} (metrics.rs:822-833).

  7. Plan diff = +Phase 1c: head started with NO prefix-cache flags, because memory.rs:1012 now computes max_sequence_pages unconditionally on every model load (cheap regression cover for the new startup work).

  8. Honest scope cut: a 0.95x1M-token prompt on the GLM core costs hours of prefill, so the exact-MSP boundary is NOT covered on hardware; it is covered by unit tests (memory.rs:2456-2490) plus the fact that the cap is derived from the prepared ceiling while ModelConfig::fit_context only ever lowers the runtime ceiling (helios/src/model.rs:261-273) → the cap can never under-size. Hardware instead proves: pool stores/restores a multi-page chain with zero oversize/slabs drops and an identical answer.

#6 [medium] Final pre-report verification notes (5021b7a)

Final verifications at head 5021b7a (all read this turn):