Case file: PR #690 — "Preserve inherited CUDA_HOME in ignition.cli.environment"
Author jcartu · head 682152b · base main · open, ready for review, opened and last updated 2026-12-02 · 5 files, +183/−10 · no labels, no reviews, no CI checks on head · fixes #636.
Key findings
- This 4-line decision has now been revised three times in six weeks, each time by a different person, and each prior revision broke the other camp. #71 (eugr, merged 2026-10-24) removed automatic
CUDA_HOMEassignment because the pipcuda-tilebundle was being selected and native builds failed withcannot find -lcudart; commitc9935887(Luke Alonso, 2026-11-27) then added the/usr/local/cudafallback that #636 blames for overridingCUDA_HOME; #690 (jcartu) now adds a config → inheritedCUDA_HOME→/usr/local/cuda→ native-discovery order. A reviewer is deciding the third attempt at a decision that has failed twice. - The change silently reverses precedence for a second variable that the description mentions only inside its precedence list. At PR head,
ignition/cli/environment.py:78-81setsTRITON_PTXAS_PATHwhen[paths] cudais configured even if the caller exported a non-blankTRITON_PTXAS_PATH, and populates it when the ambient value is blank/whitespace. Previously the base condition wasptxas.is_file() and "TRITON_PTXAS_PATH" not in os.environ— any ambient value, blank or not, won. A pinned-PTXAS workflow combined with[paths] cudais now overridden with no warning, which sits against design-review principle 10's "explicit user values win over defaults" (docs/design-review.md:89-92). This one is stated in the description, but it is a behavior change beyond what #636 asked for (#636 asks only forCUDA_HOMEprecedence). - Documentation invariants the PR does not reconcile. AGENTS.md:452-455 forbids reading an environment variable to choose behavior, while the same PR edits AGENTS.md:466-473 to document exactly that for
CUDA_HOME. docs/cli-design.md:46-51 still saysCUDA_VISIBLE_DEVICESis the only environment input and that library variables are set "from its own configuration"; docs/cli-design.md:52-53 still says "Two levels of precedence … Nothing else exists", although the toolkit decision now has a third source. Only the per-decision table (docs/cli-design.md:1480) and docs/model-preparation.md:123-132 were updated. Principle 10's exception for "the documented CUDA device selection and dependency setup policies" (docs/design-review.md:89-92) is the hook the PR relies on; whether these two doc edits constitute the required documentation is a reviewer judgment. - Evidence is CPU-only, POSIX-only, and author-reported. All 10 tests in tests/cli/test_environment.py carry
@pytest.mark.skipif(os.name == "nt", ...)(lines 61, 78, 92, 109, 123, 138), so Windows behavior — explicitly claimed unchanged — has no test. There is no GPU, multi-toolkit, or end-to-end preparation evidence; the actual #636 failure (a host with both/usr/local/cudaand a second toolkit) is never reproduced. "146 passed" is the author's run; head682152bhas no CI checks at all. - Coverage that #71 added is gone; #690 re-establishes it. #71 said it tested "configured, unset, and inherited
CUDA_HOME" in tests/cli/test_serve.py (+29/−2), but that file no longer referencesenvironment/apply, and no other tests/cli file calledenvironment.applybefore this PR. The new 149-line file is the only coverage of the function. - #636 was triaged
triage:design-review, priority:P2, and has zero comments — no maintainer has recorded a design decision. The reporter explicitly asked for feedback on whetherCUDA_HOMEshould win by default; #690 implements it unilaterally. Neither item has any review, comment or reaction.
The change
At PR head, ignition/cli/environment.py:
- :22 new module constant
_DEFAULT_LINUX_CUDA = Path("/usr/local/cuda")— read at call time insideapply, which is what lets the tests monkeypatch it. - :54-67 the resolution order. Comment block at :54-57 restates intent (note the pre-existing line 54 comment "cuTile discovers its compiler bundle independently of the native toolkit" survives while the following lines now describe a different policy). Code:
configured_cuda = configuration.directory("cuda")(:58),cuda = configured_cuda.- If
Noneandos.name != "nt":inherited_cuda = os.environ.get("CUDA_HOME","").strip(); if truthy →cuda = Path(inherited_cuda); elif_DEFAULT_LINUX_CUDA.is_dir()→ default; elseos.environ.pop("CUDA_HOME", None)(:60-67).
- :68-75 unchanged Windows path (
CUDA_HOME,CUDA_PATH,TRITON_PTXAS.EXE_PATH, DLL dirs). - :76-86 POSIX:
TRITON_PTXAS_PATHset only when<cuda>/bin/ptxasis a file and (configured_cuda is not Noneor the ambient value strips to empty) (:78-81) — the one behavior change besides CUDA_HOME;CPATHprepend of<cuda>/includeunchanged (:82-86, deduped against existing entries). - :87
runtime_patches.apply()still last.
Base code (identical to c9935887, ignition/cli/environment.py:53-73 at that commit):
cuda = configuration.directory("cuda")
if cuda is None and os.name != "nt" and Path("/usr/local/cuda").is_dir():
cuda = Path("/usr/local/cuda")
Behavior deltas beyond the headline, compared with the base:
| Delta | In the description? |
|---|---|
Ambient non-blank TRITON_PTXAS_PATH loses to [paths] cuda |
Yes, but only inside the precedence list (item 1) |
Blank/whitespace TRITON_PTXAS_PATH no longer blocks population; it is now filled |
No |
Inherited CUDA_HOME is whitespace-stripped and re-exported normalized (" /opt/cuda " → /opt/cuda) |
Partially ("whitespace stripped") |
Blank CUDA_HOME removed from os.environ when no default toolkit dir exists |
Yes |
paths.cuda still resolves via Configuration.directory (ignition/cli/config.py:172-175), which returns None for the built-in default paths.cuda = "" (config.py:51) |
Not mentioned; it is why the default config falls through to the environment |
No config-schema change (ignition/cli/config.py:31-32, 51 untouched), no CLI flag, no artifact/ABI change.
Docs changed: docs/cli-design.md:1480 (toolkit row of the precedence table), docs/model-preparation.md:123-132 (rewritten paragraph), AGENTS.md:466-473 (the env-var bullet). Doc content matches the code as far as it goes; it does not document the blank-TRITON_PTXAS_PATH case nor the whitespace stripping.
The why
Issue #636 "ignition no longer respects the CUDA_HOME environment variable" — opened 2026-11-30 11:36 by hiroshi-ya, labels bug, enhancement, priority:P2, triage:design-review, no comments, and the body ends with an explicit request for feedback that nobody answered.
Its argument: local-inference-lab/flashinfer JIT resolves its toolkit through get_cuda_path(), which checks os.environ.get("CUDA_HOME") first; PyTorch, CMake and Numba all prioritize CUDA_HOME over the /usr/local/cuda symlink. It names commit c99358879813f22557ac619044af514fafacecc6 (Luke Alonso, 2026-11-27, "Support integrated GA10B GPUs, adaptive executor parking, and explicit memory limits") as the regression, with a permalink, and notes that environment.apply runs inside export() (cited as ignition/cli/serve.py:291) before preparation, so the branch fires unconditionally whenever [paths] cuda is unset.
Consequence for users: on hosts with several toolkits, a preparation selecting a non-default toolkit through CUDA_HOME was silently redirected to /usr/local/cuda, with TRITON_PTXAS_PATH and CPATH following it. Age: filed two days before the PR; it is the second report in this six-week chain (#71's original failure was the first).
Related work
- #71 (eugr, COLLABORATOR, merged 2026-10-24, +39/−21; docs/cli-design.md, docs/model-preparation.md, ignition/cli/config.py, ignition/cli/environment.py +2/−14, tests/cli/test_serve.py) — "Preserve native CUDA toolkit selection with cuTile dependencies". Installing
cuda-tile[tileiras]puts annvccundernvidia/cu13; Ignition had selected that bundle asCUDA_HOME, breaking native weight-loader builds withcannot find -lcudart(the wheel shipslib/libcudart.so.13, the linker wantslib64/). Its fix: setCUDA_HOMEonly when[paths] cudais configured, otherwise let native build libraries discover the toolkit. #690 partially reverts the intent by re-introducing an environment-derived toolkit, though without #71's trigger: #690 never selects a pip bundle by itself, it only honors what the caller exported, so #71's failure can recur only if the user's ownCUDA_HOMEpoints at a pipcuda-tilebundle. The description does not address this. - c9935887 (Luke Alonso, 2026-11-27) — the
/usr/local/cudafallback that #636 blames; #690 builds on it (keeps the fallback and the_DEFAULT_LINUX_CUDAsemantics) while inserting the environment layer above it. - #231 (original-el8, open) — same domain (Triton/libdevice toolchain), and its review asks for a test that drives
CUDA_HOME/environment.applybefore the torch import and asserts libdevice comes from that toolkit. Complementary, not competing; shares no non-doc file with #690. - #668, #678 (open) — reconcile multi-host selections and propagate
b12x_environmentin ignition/cli/serve.py; they touchapply()call sites, not the function. #690 changes the function all five call sites use. No conflict in lines. - No competing, stacked or superseding PR.
related_items(690)links only #636; the other PRs sharing files are model/recipe work (#465, #432, #427, #410, #408, #117), #215 (FlashInfer pinning, docs), and docs-touching #671, #664, #597. No open PR edits docs/cli-design.md:1480 or docs/model-preparation.md:123-132. - Coverage history: #71's
tests/cli/test_serve.pycases are gone (the file no longer mentionsenvironment/apply), so this PR is the first CPU-level coverage of the function in the tree.
Recent activity
- ignition/cli, last 60 days:
0fca9938(#683, CLI prog propagation, state.py (not opened) kernels),a3c80e19(#657, mDNS advertise),c146d7be(#620),f7d6428f(#592, sm110/thor),d3e0e783(#212),5adb27f2,f3a5b709(#544), andc9935887(2026-11-27) — the regression. Dominated by Luke Alonso. #690's 17-line edit is the only CUDA-toolkit change sincec9935887. - tests/cli:
0fca9938,a3c80e19,efc6252d(#635),a39f6777,d3e0e783,5adb27f2,f3a5b709,698ee450(#545). None exercisedenvironment.apply. - docs: heavy helios/scheduler traffic by PCCessna and Luke Alonso (#681, #661, #665, #660, #670, #663, #666, #657). The two lines #690 edits were last authored by eugr's #71 and then
c9935887. - Verdict: #690 builds on
c9935887, re-balances rather than reverts #71, and nothing merged since 2026-11-27 conflicts with the four lines it edits.
People
- Author — jcartu, GitHub association CONTRIBUTOR (not a maintainer; the charter's priority contributors are @voipmonitor, @original-el8, @lukealonso). Discord handle given in the description ("Discord: jcartu"), satisfying principle 17 / AGENTS.md:142-153. History: 3 merged (e.g. #505 "Bind core-declared FP32 parameters into text forward graphs", 2026-11-28), 3 closed, 10 open, most of the open ones filed the same day (#686–#693) — a burst of small fixes. Merged work is mostly Rust runtime/core (docs 3, helios/src 3, heliopause/src 1, helios 1, helios/proto 1); this is his first change to ignition/cli/environment.py. He has prior preparation-time environment engagement: issue #517 (closed) investigating
TRITON_DEBUGin_checkpoint_pages. - Area owners: ignition/cli — Luke Alonso (84 commits/180d), Martin Vit (25), jasonc (14); tests/cli — Luke Alonso (105), Eugene Rakhmatulin/eugr (29), Martin Vit (20); docs — Luke Alonso (391). The change is authored outside the two people who have owned this exact file: #71 is eugr's, the regression is Luke Alonso's.
- Engagement: zero comments, zero reviews, zero reactions on #690; zero comments on #636, including no maintainer answer to the reporter. Nobody has engaged.
Community
Nothing found beyond the absence of engagement: no review threads, no inline comments, no reactions on either #690 or #636, no linked downstream discussion beyond the issue. "Discord: jcartu" is the only channel the author offers.
Project fit
- In favour: #636 is a concrete, cited regression, which fits AGENTS.md:165-169 (a change must address a demonstrated defect) and the charter's "reproducible bug" merge criterion. Principle 10 (docs/design-review.md:89-92) explicitly exempts "the documented CUDA device selection and dependency setup policies" from the no-env-switch rule, and the PR edits docs to document the policy.
- In tension: AGENTS.md:452-455 forbids environment-variable behavior switches, and the same PR edits the neighbouring bullet (AGENTS.md:466-473). docs/cli-design.md:46-51 ("No environment variables …
CUDA_VISIBLE_DEVICES" only; library variables set "from its own configuration") and docs/cli-design.md:52-53 ("Two levels of precedence … Nothing else exists") are not updated, so after the change the design doc contradicts both the code and AGENTS.md. Reviewers must decide whether the per-decision table row (docs/cli-design.md:1480) and docs/model-preparation.md:123-132 are enough "documenting" for the principle-10 exception. - The new ambient-
TRITON_PTXAS_PATHoverride sits against principle 10's "explicit user values win over defaults" (docs/design-review.md:89-92) unless[paths] cudais read as the explicit user value. - Docs the change leaves valid: docs/cli-design.md:1403-1409 (
[paths] cudaexample) and docs/windows.md:382-386 (Windows guidance) remain accurate.
Claims and evidence
| Claim | Backing |
|---|---|
Preserves a caller-supplied CUDA_HOME when [paths] cuda is unset |
Implemented, environment.py:60-63; test lines 79-89, 93-106 |
[paths] cuda overrides inherited CUDA_HOME and ambient TRITON_PTXAS_PATH |
Implemented, environment.py:58-59, 78-81; test lines 62-75. New behavior beyond #636's ask |
Blank CUDA_HOME cleared when no toolkit source exists |
Implemented environment.py:66-67; test lines 140-149 (parametrized None, "", " ") |
Default /usr/local/cuda used when config and CUDA_HOME absent |
Test lines 125-135 |
pytest tests/cli -v: 146 passed, including all 10 new cases |
Test count verified: 4 single + 3 + 3 parametrized = 10. Run itself is author-reported; no CI on head 682152b. The repo workflow (.github/workflows/python-cpu.yml:30-33 (not opened)) runs pytest tests/ -q with CUDA_VISIBLE_DEVICES="" on ubuntu-24.04 with no CUDA toolkit, so CI would exercise the tests only via the monkeypatched _DEFAULT_LINUX_CUDA |
| Post-session environment restoration verified | Plausible via clean_environment (tests/cli/test_environment.py:45-58), which registers a monkeypatch undo entry even for absent keys by setenv then immediate pop. Non-obvious but works with pytest's monkeypatch |
| "Windows behavior unchanged" | True by inspection (environment.py:68-75) but untested — every test skips on os.name == "nt" |
Downstream consumer actually honors the preserved CUDA_HOME |
Not claimed, not tested. In-repo consumers: ignition/preparation/kv_codec.py:21-38 _find_nvcc prefers torch's CUDA_HOME then which("nvcc") then /usr/local/cuda; tests/preparation/test_toolchain.py:31-69 asserts libdevice comes from torch's CUDA_HOME (derived at torch import time); scripts/qualify_qsa_fixed_partitions.py:229-230 (not opened) requires CUDA_HOME=/opt/cuda |
| Anyone outside the PR proposed this design | No: #636 has no maintainer reply despite being labeled triage:design-review |
Limitations the author discloses honestly: Windows not executed; no end-to-end GPU preparation. Undisclosed in evidence terms: no multi-toolkit host run, which is the exact scenario in #636.
Process note I could not verify: .githooks/commit-msg:14-63 requires a Design-Signed-Off-By: …; design-review=<sha256[:4]> trailer on every commit; the commit message body of 682152b is not readable here, so trailer compliance is unverified.
Reach
- Call sites (entire blast radius): ignition/cli/serve.py:210 (multi-host export rank zero), :291 (
_prepare, the path in #636), :436 (debug_serve), :545 (join), and ignition/cli/bench.py:205. - Triggers only when
paths.cudais empty (its built-in default, ignition/cli/config.py:51), so every user who never configurespaths.cudais affected wheneverCUDA_HOMEis exported or blank. - Configuration/defaults: no new keys,
paths.cudaprecedence unchanged. Windows users unaffected (docs/windows.md:382-386 stays valid). - Compatibility: no Protobuf, core-format, ABI or Rust change; no artifact invalidation. Helios/Rust never reads Python's
CUDA_HOME(only hardcoded nvcc paths in test helpers, e.g. helios/src/runtime_core/persistent_worker.rs:1258-1259 (not opened), 1824-1827, 2225-2228). - Dependencies: pins untouched; interaction with
cuda-tile[tileiras](docs/model-preparation.md:134-137, "finds its own compiler independently") unchanged. - Multi-host: each host resolves its own
CUDA_HOME; nothing propagates it acrossignition join(unlikeb12x_environmentin #668). Heterogeneous toolkits across peer hosts remain possible — outside this PR's scope but unmentioned. - Documentation reach: 3 of 5 files are prose; AGENTS.md now documents an environment read in a section that forbids environment switches, and docs/cli-design.md's two umbrella bullets now disagree with the code.
Process
Open and marked ready for review; opened and last updated 2026-12-02 (same day); head 682152b, base main; 5 files +183/−10; no labels, no reviewers, no reviews, no CI checks on the head commit. Description follows the required four-part form (principle 16, docs/design-review.md:147-160: why / what changed / claimed result / evidence + limitations) and carries the Discord handle required by principle 17. Issue #636 carries triage:design-review, so the design question is queued for review rather than settled. Age: hours old at time of this case file; no rebase or conflict signals yet.
Open questions / what could not be found
- Does a maintainer endorse #636's premise that
CUDA_HOMEshould outrank/usr/local/cudaby default? Nothing recorded; the issue is labeledtriage:design-reviewand has no reply. - Is the ambient-
TRITON_PTXAS_PATHoverride intended as part of this fix, or incidental? It is not in #636's ask and contradicts principle 10's "explicit user values win". - Do docs/cli-design.md:46-53 and AGENTS.md:452-455 need amending for the principle-10 exception to cover
CUDA_HOME? Not addressed by the PR. - Can #71's
-lcudartfailure recur if a user'sCUDA_HOMEpoints at a pipcuda-tilebundle? Plausible, untested, undiscussed. - What verifies that downstream consumers (torch/
kv_codec._find_nvcc/FlashInfer JIT libdevice) really follow the preserved value on a real multi-toolkit host? Nothing in this PR; #231's review asks for exactly that test. - Windows path: claimed unchanged, untested.
- Commit trailer compliance (
Design-Signed-Off-By) unverifiable from the copy available here. - No CI check run on head
682152b; the 146-passed figure is author-reported.