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

Raw Markdown for agents: https://autobot.eidonix.com/p/1edbb68c-06c7-4d8d-95d8-df4af72cccc6.md

#1 [high] PR #641 code behavior to validate (exact lines)

PR #641 head d82fcfc, 3 files, +163/-10.

compile_pool.py:38-64 compiler_resources(device, headroom_bytes, options, compile_workers):

aot.py:1067-1074 ForwardCache._prepare_ranks: release_unused() ; NEW torch.cuda.empty_cache() ; comment ; dist.barrier(group=group) ; then compiler_resources() at :1076. Both new calls sit inside the existing try/except (:1068-1072) so a failure sets error and is surfaced collectively after all_gather_object(demand,...) at :1081-1085, before allocate_workers() at :1087-1088. :1088 prints "N compiler workers; per rank [..]" - direct readout of admitted workers per rank. Single-rank path does NOT call _prepare_ranks: aot.py:914-917 routes coordinator None -> _prepare_many, which uses CompilePool(...) at :921-922 => compiler_resources via compile_pool.py:133.

Reproduce-failure diagnostic text is the MemoryError at compile_pool.py:96-97: "host {host!r} has {jobs} missing forwards but no capacity for a forward compiler ({available>>20} MiB available host memory, {headroom>>20} MiB headroom)" => before/after numbers for free.

Fallback floor allocate_workers :87-94: one worker per host under the 2 GiB minimum allowance (worker_bytes - 32 GiB + host_memory._WORKER_BYTES(2 GiB) <= remaining). This - not the resample - is what produced the author's live [1,1,1] (case file / final review nits).

host_memory.py:103-110 device_memory_info: free,total = mem_get_info; on POSIX integrated free = min(total, available_bytes()) => on Linux integrated, free already equals MemAvailable-capped, so min(available,free) is a no-op; the clamp only changes behavior on Windows (os.name=="nt"). Consequence: on cn7 the ONLY substantive changes are the post-flush resample and the widened trigger. available_bytes() :82-100 = /proc/meminfo MemAvailable capped by finite cgroup-v2 ancestors (:51-79) => a 60 GiB job cgroup caps available.

#2 [high] Invocation surface + cheap verification vehicles

CPU gate (CI, not yet reported on d82fcfc): .github/workflows/python-cpu.yml:25-33 env BUILD_NVEP=0 FLASHINFER_BUILD_NO_PIP=1 ; uv sync --extra prepare --extra test CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest tests/ -q Targeted: .venv/bin/python -m pytest tests/preparation/test_compile_pool.py -q

GPU test opt-in: FLARE_RUN_CUDA_TESTS=1 ; TP adds FLARE_RUN_TP_CUDA_TESTS=1 + CUDA_VISIBLE_DEVICES (AGENTS.md:302-307). TP2 fixture tests/preparation/test_inductor_tuning_cuda.py:539-550 needs WORLD_SIZE>=2 + LOCAL_RANK => torchrun.

Live tests that hit the changed lines (verified by reading them):

Export CLI: ignition export MODEL --gpus LIST [--compile-workers N] [--autotune-effort off|default|audit] [--no-compile] [--reuse-weights] [--verbose] [--config PATH] (ignition/cli/init.py:35-78; parameters.py:1344-1366; docs/model-preparation.md:231-245,273-308) Config: [preparation] compile_workers, [memory] reserve (ignition/cli/config.py:22-51). headroom passed to ForwardCache = plan.headroom_bytes + plan.reserve_bytes (bootstrap.py:129-137), ForwardCache default headroom_bytes=4 GiB (bootstrap.py:35). compile_threads default = min(16, os.cpu_count()) (compilation.py:26-30) => cn7 10 CPU -> 10, so max_workers=min(10,8)=8; cn5 48 CPU -> 16, max_workers=8 at defaults. Cache dirs (ignition/cli/environment.py:39-50): paths.kernel_cache ~/.cache/flare/kernels -> B12X_COMPILE_CACHE_DIR, FLASHINFER_WORKSPACE_BASE, TRITON_CACHE_DIR, TORCHINDUCTOR_CACHE_DIR. paths.core_cache ~/.cache/flare/cores. Export publishes to shared cache and needs an unused destination (docs/model-preparation.md:275-282) => one core name per experimental arm. --reuse-weights reuses cached weight hashes/layouts of a compatible default (docs:290-308). --autotune-effort off removes races => deterministic, much cheaper compile phase (docs:211-214, params 1344-1353). Recipes live in the EXTERNAL repo local-inference-lab/hyperflare-recipes (docs/model-preparation.md:310-314) => both A/B arms must pin the same recipes commit.

Non-invasive flush observability: discrete (cn5) sample nvidia-smi --query-gpu=index,memory.used -lms 100; GB10 (cn7) NVML does not report VRAM (docs/model-preparation.md:489-495) => sample /proc/meminfo MemAvailable in a background loop instead. A runtime monkeypatch of torch.cuda.empty_cache in a throwaway harness script counts flushes directly (no repo edit).

#3 [high] Machine-to-branch mapping, predictions, hardware limits

cn5 = 4x RTX PRO 6000 Blackwell Max-Q 96 GiB, SM120, DISCRETE VRAM, amd64, job: 48 CPU/125 GiB RAM. os.cpu_count ~48 => compile_threads=min(16,48)=16 => max_workers=8 at defaults. Discrete gate threshold at defaults = max_workersdevice_bytes = 81 GiB = 8 GiB (12 GiB at --compile-workers 12). => a real export leaves free >> 8 GiB => PR flush does NOT fire => cn5 is the zero-cost CONTROL for the widening. Reachable: local TP1/TP2/TP4 export (no coordinator => single-rank path only, aot.py:1070 NOT executed), live torchrun TP2 tests (coordinator => aot.py:1070 executed), discrete flush/VRAM-delta probe (nvidia-smi memory.used). Limits: cannot exercise integrated/unified-memory branch at all; 1 GiB discrete worker constant is mocked only.

cn7 = 1x GB10, SM121, INTEGRATED (unified DRAM), arm64, job: 10 CPU/60 GiB RAM cgroup. compile_threads=min(16,10)=10 => max_workers=min(10,8)=8; gate 8*34 GiB=272 GiB > 60 GiB cgroup => flush ALWAYS fires. main arm on integrated: gate free-headroom_bytes < 2 GiB (headroom_bytes ~4 GiB) => flush ~never fires for a small model (free = min(total, MemAvailable) per host_memory.py:107-109). => arms differ deterministically: PR 1 flush, main 0. Limits: 60 GiB cgroup vs author's 121 GiB GB10, so the author's exact 8435 MiB/8192 MiB scenario CANNOT be reproduced;

1-worker-per-host (needs available-headroom >= 34 GiB and the 272 GiB gate) cannot be demonstrated; Windows clamp untestable.

Predictions to check against measurements (deviations = findings):

  1. cn7 probe: PR flush=1, available rises by the allocator-cached host bytes (~model/freed tensors); main flush=0, available flat.
  2. cn7 TP1 export: both arms succeed; admitted workers identical (1, or 2 if available-headroom >= 34 GiB); PR compile-phase wall clock within noise of main (flush cost should be small); PR peak MemAvailable dips no lower than main.
  3. MemoryError repro needs available in [8,12) GiB at compiler_resources time on cn7 (main: no flush + floor needs 4 GiB => MemoryError at compile_pool.py:96-97; PR: flushes, resamples, recovers the 1-worker floor). Requires a RAM balloon.
  4. cn5 discrete probe: PR flush=0 (free >> 8 GiB), free/available unchanged; after a forced low-free state, PR empty_cache raises free and leaves host available unchanged (tests/preparation/test_compile_pool.py:622 pins host_samples==1).
  5. cn5 TP2 torchrun tests: [single] and [tp2] pass; flush ordering (release_unused -> empty_cache -> barrier -> compiler_resources) happens on live hardware.
  6. cn7 capture_order_cuda test: PR flush skipped (max_workers=1 => 34 GiB threshold vs ~high available) => skip path live.
  7. Author's claimed "[1,1,1] unlocking additional compiler workers" is NOT what live hardware shows here; only the no-crash
    • flush-count + cost result is measurable.