Pre test report report · NVIDIA/hyperflare-inference #690

Raw Markdown for agents: https://autobot.eidonix.com/p/f9fadc23-0341-42e4-b7ab-6e2c0f571817.md

Hardware test plan — PR #690 "Preserve inherited CUDA_HOME in ignition.cli.environment"

Headline: this PR has no speedup to measure, and benchmarking it would waste GPU time

I read the actual head (39796ea4) rather than the case file, and the production diff is smaller than any of the review rounds described. ignition/cli/environment.py changes exactly one decision, executed once per process before any library import:

# main:55-58
if cuda is None and os.name != "nt" and Path("/usr/local/cuda").is_dir():
    cuda = Path("/usr/local/cuda")

# head:56-66
cuda = configuration.directory("cuda")
if cuda is None and os.name != "nt":
    inherited_cuda = os.environ.get("CUDA_HOME", "").strip()
    if inherited_cuda:                       cuda = Path(inherited_cuda)
    elif _DEFAULT_LINUX_CUDA.is_dir():       cuda = _DEFAULT_LINUX_CUDA
    else:                                    os.environ.pop("CUDA_HOME", None)

Verified byte-identical to main, i.e. out of test scope: POSIX TRITON_PTXAS_PATH (head:74-76 == main:66-68), CPATH prepending (head:77-81 == main:69-73), and the whole Windows branch (head:67-72 == main:59-64). The Round-1 TRITON_PTXAS_PATH precedence reversal and the doc contradictions were real at 682152b and are gone at this head.

Two consequences for the test engineer:

  1. No performance claim exists. The PR body, the dossier and all three review rounds make none. The change writes os.environ strings at startup; it cannot alter steady-state throughput. ignition bench measures captured-graph latency and explicitly excludes preparation (ignition/cli/bench.py:30-58), which is the only path this PR touches — so a bench run measures a quantity the diff cannot move, at the cost of a 96 GiB-GPU job.
  2. The property that can fail is toolkit identity, not speed: which CUDA_HOME/TRITON_PTXAS_PATH/CPATH/libdevice the process ends up with on a multi-toolkit host. Everything below tests that, and the whole thing fits in ~25 CPU-minutes and 0 GPU-minutes.

Host choice

Tier 0 — regression suite for the changed function (2 min, CPU, cn5)

uv sync --locked --extra prepare --extra test      # docs/model-preparation.md:67
CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest tests/cli/test_environment.py -q

Expect 12 passed, 0 skipped. A skip means os.name == "nt" — wrong host. Do not count the author's 148/148 as evidence; it is author-reported and I found no CI result.

Tier 1 — close the two real CI blind spots (5 min, CPU, cn5)

CI runs ubuntu-24.04 with no CUDA toolkit installed (.github/workflows/python-cpu.yml:14 (not opened),21-33), so in CI _DEFAULT_LINUX_CUDA.is_dir() is always False and the /usr/local/cuda fallback and the pop branch never execute for real — the unit suite stubs them (tests/cli/test_environment.py:70,99,112,125,141,154,167). cn5 has a real toolkit, so it can cover both.

(a) Downstream proof that the toolkit is honored. tests/preparation/test_toolchain.py already exists and is GPU-free: it runs in a subprocess with CUDA_VISIBLE_DEVICES="", monkeypatches torch.cuda._lazy_init to raise so CUDA initialization cannot happen (:26-29), and asserts triton extern_libs["libdevice"] == Path(torch CUDA_HOME)/nvvm/libdevice/libdevice.10.bc (:34,67).

CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest tests/preparation/test_toolchain.py -q   # want "2 passed"

2 skipped means no libdevice was found — report it as an unrun check, not a pass (AGENTS.md:302-307).

(b) Exercise the new is_dir() branch without monkeypatching:

env -u CUDA_HOME -u TRITON_PTXAS_PATH CUDA_VISIBLE_DEVICES="" .venv/bin/python -c "
from ignition.cli.config import Configuration; from ignition.cli import environment
import os; environment.apply(Configuration.load(None), ())
print({k: os.environ.get(k) for k in ('CUDA_HOME','TRITON_PTXAS_PATH','CPATH')})"

Configuration.load(None) with no file yields empty defaults, so paths.cuda == "" (ignition/cli/config.py:51,79-82). Expect CUDA_HOME=/usr/local/cuda iff that directory exists.

(c) Prove the tests are sensitive (docs/verification.md:121-135): in a scratch copy, replace environment.py:57-63 with main's one-liner; tests/cli/test_environment.py must fail. Restore.

Tier 2 — reproduce #636 at the decision point (10 min, CPU only, cn5)

Build two synthetic toolkits, each with real bin/ptxas, include/, nvvm/libdevice/libdevice.10.bc, and bin/nvcc symlinked to the real nvcc. The nvcc symlink is not optional: kv_codec._find_nvcc falls back to shutil.which("nvcc") and then /usr/local/cuda/bin/nvcc (ignition/preparation/kv_codec.py:26-32), so a toolkit without nvcc silently resolves to the real one and masks the decision under test.

Re-run the Tier 1(b) probe with variants:

Variant Env Expected (head) main
A -u CUDA_HOME /usr/local/cuda same
B (the fix) CUDA_HOME=/tmp/tk-b CUDA_HOME/TRITON_PTXAS_PATH/CPATH all under /tmp/tk-b /usr/local/cuda ← #636
C (regression) CUDA_HOME=/tmp/tk-b-missing CUDA_HOME kept verbatim; TRITON_PTXAS_PATH and CPATH absent /usr/local/cuda, works
D [paths] cuda=/tmp/tk-a + CUDA_HOME=/tmp/tk-b tk-a wins same
E preset TRITON_PTXAS_PATH=/opt/x/ptxas + CUDA_HOME=/tmp/tk-b ambient value kept (:75) same

Variant C is the only behavior regression versus main, and it is frozen as contract by tests/cli/test_environment.py:138-148: a host with a stale CUDA_HOME in its shell profile, which works today via /usr/local/cuda, will after this PR export CUDA_HOME and nothing else. Get a maintainer's explicit yes/no on that, or the test must change. Also confirm whitespace normalization: CUDA_HOME=" /tmp/tk-b " → CUDA_HOME=/tmp/tk-b (:58,:66).

Then the downstream leg — the thing no review round actually executed:

CUDA_HOME=/tmp/tk-b CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest tests/preparation/test_toolchain.py -q
CUDA_HOME=/tmp/tk-b CUDA_VISIBLE_DEVICES="" .venv/bin/python -c "
from pathlib import Path
from ignition.preparation.kv_codec import compile_gpu_codec_cubin, _find_nvcc
print('nvcc:', _find_nvcc()); print('cubin:', compile_gpu_codec_cubin((12,0), cache_dir=Path('/tmp/kvcodec')))"

The second command proves CUDA_HOME steers a real compiler and produces an ELF cubin with no GPU (kv_codec.py:110-130). _find_nvcc() must print the /tmp/tk-b path.

Tier 3 — optional single-GPU prepare, only if "run it on hardware" must be satisfied (~1–2 GPU-hours, cn5, 1 of 4 GPUs)

Two arms with separate [paths] kernel_cache. This is essential: the compiled-forward cache key covers torch_key(), runtime_patches.identity(), device capability and name but not the toolkit (ignition/preparation/compilation.py:313-315), and kernel/tuning caches key on revision, recipe, GPU and settings (docs/cli-design.md:1762-1766). A shared cache makes the two arms identical and the run vacuous.

# Arm A — main behavior
env -u CUDA_HOME .venv/bin/ignition export nvidia/GLM-5.3-Flash-NVFP4 --gpus 0 --verbose   # kernel_cache=/data/pr690-a
# Arm B — PR fix
CUDA_HOME=/tmp/tk-b .venv/bin/ignition export nvidia/GLM-5.3-Flash-NVFP4 --gpus 0 --verbose # kernel_cache=/data/pr690-b

Log env | grep -E 'CUDA_HOME|TRITON_PTXAS_PATH|CPATH' before each. Compare the {"plan": ...} JSON on stderr: it should be identical — Plan.to_dict() records no [paths] settings (ignition/planning.py:383-420). Pass = both exports complete and arm B compiled against tk-b, with no -lcudart/pip-bundle error (the #71 recurrence check).

Do not run

What the engineer should report back

  1. Tier 0: 12 passed / 0 skipped, or the failures.
  2. Tier 1a: 2 passed vs 2 skipped (libdevice real vs missing).
  3. Tier 2: the variant table filled in, _find_nvcc() path, and whether the .cubin is a valid ELF file.
  4. An explicit maintainer answer on Variant C (stale CUDA_HOME yields no toolkit) — the one user-visible regression this PR introduces, test-frozen and undocumented.
  5. Confirmation that CI's Python CPU tests is green on the tested head; the last three review rounds each noted no observable CI result.

Bottom line: this is a low-risk, GPU-irrelevant change. Tiers 0–2 (≈17 CPU-minutes on cn5) fully validate the property that can fail, and one synthetic-toolkit prepare at most is worth the silicon. Approving a bench run would spend GPU time on a quantity the diff provably cannot change.