#1 [high] PR #690 exact code delta vs main (verified)
PR #690, head 39796ea4. Files: AGENTS.md +13/-8, docs/cli-design.md +18/-9, docs/model-preparation.md +4/-3, ignition/cli/environment.py +10/-2, tests/cli/test_environment.py +175 (new).
head ignition/cli/environment.py: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)
main:55-58 was: if cuda is None and os.name != "nt" and Path("/usr/local/cuda").is_dir(): cuda = Path("/usr/local/cuda")
VERIFIED IDENTICAL to main (so out of scope for testing):
- POSIX TRITON_PTXAS_PATH: head:74-76 == main:66-68 (
ptxas.is_file() and "TRITON_PTXAS_PATH" not in os.environ). Round-1 objection retracted/fixed. - CPATH prepend: head:77-81 == main:69-73.
- Windows branch head:67-72 == main:59-64 (CUDA_PATH, TRITON_PTXAS.EXE_PATH, add_dll_directory).
- New constant
_DEFAULT_LINUX_CUDA = Path("/usr/local/cuda")at :22 (monkeypatch seam).
=> NO performance/speedup claim anywhere in PR, dossier, or reviews. The diff writes os.environ at startup only. ignition bench measures captured graph latency and explicitly excludes preparation (ignition/cli/bench.py:30-58). So latency benchmarking is the WRONG test and a waste of GPU time; the property to validate is toolkit selection identity.
Only behavior regressions vs main (both frozen by new tests):
- Stale/nonempty-but-nonexistent inherited CUDA_HOME now yields NO toolkit env at all: CUDA_HOME preserved verbatim, TRITON_PTXAS_PATH and CPATH absent, no /usr/local/cuda fallback. Frozen as contract by tests/cli/test_environment.py:138-148. On main that host used /usr/local/cuda and worked.
- Blank/whitespace CUDA_HOME now removed (pop) instead of being left to fall through to /usr/local/cuda (main) — but net effect equals main when /usr/local/cuda exists. Also: inherited CUDA_HOME is now normalized by .strip() (:58,:66) and whitespace-padded values are re-exported.
#2 [high] Downstream consumers of CUDA_HOME + cheap GPU-free verifiers
Consumers that read the preserved CUDA_HOME (what the PR actually steers):
- torch.utils.cpp_extension.CUDA_HOME (import-time) -> used by ignition/preparation/kv_codec.py:21-38
_find_nvcc(): candidates = [torch CUDA_HOME/bin/nvcc, shutil.which("nvcc"), /usr/local/cuda/bin/nvcc]. So CTRITON/kv_codec prefers the preserved toolkit, then PATH, then /usr/local/cuda. Note: fallback to PATH means a synthetic toolkit without nvcc silently falls through to the real nvcc -> masks the toolkit choice. Real export runs therefore need nvcc in the candidate toolkit to be a meaningful test. - Triton libdevice identity via torch._inductor.runtime.compile_tasks._set_triton_libdevice_path, invoked in ignition/preparation/tuning.py:52-65 (_prepare_compiler_toolchain).
- Inductor/Compilation compiled-forward cache key (ignition/preparation/compilation.py:313-315) includes torch_key(), runtime_patches.identity(), device capability+name -- NOT the toolkit path. Kernel/tuning cache is keyed by checkpoint revision, recipe version, GPU, settings (docs/cli-design.md:1762-1766) -- also NOT the toolkit. => A shared kernel_cache masks toolkit differences between test arms. Distinct [paths] kernel_cache per arm is mandatory for a valid experiment.
READY-MADE DOWNSTREAM VERIFIER, already in tree and GPU-free: tests/preparation/test_toolchain.py
- Runs subprocess with CUDA_VISIBLE_DEVICES="", pops TRITON_LIBDEVICE_PATH, and monkeypatches torch.cuda._lazy_init to raise, so it PROVES no CUDA init (:26-29) and skips (exit 77) if no toolkit libdevice (:32-36).
- Asserts Path(dict(before.extern_libs)["libdevice"]) == Path(torch CUDA_HOME)/nvvm/libdevice/libdevice.10.bc (:67-68) and before.hash()==after.hash() (:69). Two params: recorded, standalone.
- Caveat: it reads torch's CUDA_HOME directly, so alone it does not exercise environment.apply(). Set CUDA_HOME explicitly for it, or run apply() first in the same process.
CI gap that hardware fills: .github/workflows/python-cpu.yml:14 runs ubuntu-24.04 with no CUDA toolkit, so _DEFAULT_LINUX_CUDA.is_dir() is False in CI -> the /usr/local/cuda fallback and the pop branch never run for real there (only via monkeypatch in tests/cli/test_environment.py:70,99,112,125,141,154,167).
#3 [high] Hardware inventory mapping for PR #690
cn5 (x86_64, 4x RTX PRO 6000 Blackwell Max-Q, 96 GiB each, sm_120 ∈ SUPPORTED_CAPABILITIES ignition/planning.py:37, 48 CPUs/125 GiB RAM/16 GiB scratch): PREFERRED host. Standard toolkit path expected at /usr/local/cuda; 4 homogeneous GPUs allow a single-GPU export with --gpus 0 and no TP complexity. 16 GiB scratch is small → keep [paths] kernel_cache and hub_cache on the durable cache path, never scratch (prepare caches exceed it; docs/cli-design.md:1762-1774).
cn7 (arm64, 1x NVIDIA GB10, sm_121 ∈ SUPPORTED_CAPABILITIES, 10 CPUs/60 GiB/16 GiB scratch): single GPU, arm64/SBSA toolkit layout. Adds only aarch64 variation for a POSIX path-precedence change → optional, low value, use only for the free CPU tiers if cn5 is busy.
Models: PR needs NO model. cn5 lists nvidia/GLM-5.3-Flash-NVFP4 and local-inference-lab/GLM-5.3-Flash-NVFP4 (glm53 recipe exists, docs/core-design.md:357). cn5's facebook/dinov2-base and timm/vit_base_patch14_dinov2.lvd142m are unusable: no dinov2/timm recipe anywhere in the tree (grep returned nothing). cn7 lists google/gemma-4-E4B-it (gemma4 recipe, .github/workflows/native-serving.yml:31). All inventory sizes read 0 GiB → treat as "not necessarily cached"; a real prepare implies a large download.
Cost discipline: no latency claim exists in this PR, so no ignition bench and no 4-GPU job. Whole meaningful validation fits in ~25 CPU-minutes on cn5 with 0 GPU-minutes.
#4 [high] Hardware test plan for PR #690 (tiers, commands, expectations)
TIER 0 (2 min, CPU, cn5) — regression suite for the changed function:
CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest tests/cli/test_environment.py -q
Expect 12 passed (8 functions incl. 2x3 parametrized cases), 0 skipped on POSIX.
Env: uv sync --locked --extra prepare --extra test (docs/model-preparation.md:67).
TIER 1 (5 min, CPU, cn5) — close the two CI blind spots:
(a) tests/preparation/test_toolchain.py asserts libdevice identity == Path(torch CUDA_HOME)/nvvm/libdevice/libdevice.10.bc (tests/preparation/test_toolchain.py:34,67) and proves no CUDA init (:26-29). GPU-free: CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest tests/preparation/test_toolchain.py -q → expect "2 passed" NOT "2 skipped" (skip = no toolkit libdevice, report as unverified).
(b) Real-/usr/local/cuda path never runs in CI (python-cpu.yml ubuntu-24.04 has no toolkit; unit tests monkeypatch _DEFAULT_LINUX_CUDA at test_environment.py:70,99,112,125,141,154,167). Probe 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; c=Configuration.load(None); environment.apply(c, ()); import os; print({k:os.environ.get(k) for k in ('CUDA_HOME','TRITON_PTXAS_PATH','CPATH')})"
Expect CUDA_HOME=/usr/local/cuda iff /usr/local/cuda is a dir (the new is_dir() branch at environment.py:61).
(c) Sensitivity check (docs/verification.md:121-135): in a scratch copy replace environment.py:57-63 with main's one-liner if cuda is None and os.name != "nt" and Path("/usr/local/cuda").is_dir(): cuda = Path("/usr/local/cuda") → tests/cli/test_environment.py must FAIL; restore.
TIER 2 (10 min, CPU only, cn5) — reproduces #636 end-to-end at the decision point:
Build two synthetic toolkits /tmp/tk-a, /tmp/tk-b each with bin/ptxas (copy of real), include/ (copy of real cuda/include), nvvm/libdevice/libdevice.10.bc (copy of real), and bin/nvcc → symlink to the real nvcc. nvcc symlink matters: kv_codec._find_nvcc (ignition/preparation/kv_codec.py:26-32) falls back to shutil.which and /usr/local/cuda/bin/nvcc, which would mask a wrong toolkit.
A: env -u CUDA_HOME ... → CUDA_HOME=/usr/local/cuda, TRITON_PTXAS_PATH=/usr/local/cuda/bin/ptxas.
B (THE FIX): CUDA_HOME=/tmp/tk-b → CUDA_HOME=/tmp/tk-b, TRITON_PTXAS_PATH=/tmp/tk-b/bin/ptxas, CPATH begins /tmp/tk-b/include. main prints /usr/local/cuda here — that is #636.
C (regression to disclose): CUDA_HOME=/tmp/tk-b-missing → CUDA_HOME kept verbatim, TRITON_PTXAS_PATH and CPATH ABSENT (frozen contract, test_environment.py:138-148). main used /usr/local/cuda. Maintainer must accept or the test must change.
D: [paths] cuda=/tmp/tk-a + CUDA_HOME=/tmp/tk-b → tk-a wins.
E: pre-set TRITON_PTXAS_PATH=/opt/x/ptxas + CUDA_HOME=/tmp/tk-b → ambient value kept (environment.py:75).
Downstream leg: CUDA_HOME=/tmp/tk-b CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest tests/preparation/test_toolchain.py -q → must still pass and libdevice must resolve under tk-b; independently compile a cubin: .venv/bin/python -c "from pathlib import Path; from ignition.preparation.kv_codec import compile_gpu_codec_cubin, _find_nvcc; print(_find_nvcc()); print(compile_gpu_codec_cubin((12,0), cache_dir=Path('/tmp/kvcodec')))" → proves CUDA_HOME steers the compiler, no GPU needed.
TIER 3 (optional, 1 GPU, ~1-2 GPU-hours, cn5) — a real prepare only to satisfy the "hardware" ask:
Two arms, separate [paths] kernel_cache because cache keys omit the toolkit (compilation.py:313-315; cli-design.md:1762-1766) — a shared cache makes the arms identical and the test vacuous.
Arm A (main behavior): env -u CUDA_HOME .venv/bin/ignition export nvidia/GLM-5.3-Flash-NVFP4 --gpus 0 --verbose with kernel_cache=/data/.../pr690-a
Arm B (PR fix): CUDA_HOME=/tmp/tk-b .venv/bin/ignition export ... --gpus 0 with kernel_cache=/data/.../pr690-b
Log env | grep -E 'CUDA_HOME|TRITON_PTXAS_PATH|CPATH' before each run; compare jq .plan (identical — plan.to_dict records no [paths], planning.py:383-420) and confirm no nvcc/libdevice error in B. SUCCESS = both exports complete, B used tk-b, no -lcudart/pip-bundle error (#71 recurrence check).
NEVER run: ignition bench (no latency claim; bench excludes preparation, bench.py:30-58), 4-GPU jobs, cn7 unless cn5 is unavailable, or a Windows comparison (no Windows host — Windows branch is byte-identical to main, environment.py:67-72 vs main:59-64).