Repository navigation
feat(cargo-oxide): doctor optional compute-sanitizer probe - #537
Merged
nihalpasham merged 2 commits intoJul 28, 2026
Merged
Conversation
Mirror the sanitize discovery path so missing Compute Sanitizer tooling is reported by doctor without failing the overall environment check. Closes NVIDIA#532 Signed-off-by: Ayush7614 <[email protected]>
…st, Version line - doctor_compute_sanitizer_lookup_matches_sanitize_discovery probed the real PATH for 'compute-sanitizer', failing on any machine with the tool installed; use a fake tool name resolved through the configured toolkit root, like the sibling sanitize discovery test. - Hoist the triplicated fallback path array into COMPUTE_SANITIZER_FALLBACK_PATHS, shared by run_compute_sanitizer, doctor, and the test so the 'same discovery order as sanitize' claim holds by construction. - Report the 'Version ...' line from compute-sanitizer --version instead of the banner line.
Collaborator
|
Thanks, Gist: doctor now probes compute-sanitizer with the same discovery order as cargo oxide sanitize. I added one maintainer commit:
Validated on an RTX 5090 / CUDA 13.3 host:
Closes #532. Merging |
nihalpasham
approved these changes
Jul 28, 2026
vyncint
added a commit
to vyncint/cuda-oxide
that referenced
this pull request
Aug 24, 2026
`cargo oxide doctor` reports the CUDA toolkit missing, and exits non-zero, on
an install where the toolkit is not on `PATH` -- immediately after reporting
four components of that same toolkit as found.
## Before -> after
Same machine, same environment, `CUDA_HOME=$HOME/cuda-13.3`, toolkit not on
`PATH`:
before after
CUDA headers (cuda.h)... ✓ .../include/cuda.h (unchanged)
CUDA toolkit (nvcc)... ✗ nvcc not found ✓ Cuda compilation tools,
release 13.3, V13.3.33
(.../cuda-13.3/bin/nvcc)
libNVVM (libnvvm.so)... ✓ libNVVM 2.0 (unchanged)
nvJitLink... ✓ nvJitLink 13.3 (unchanged)
libdevice... ✓ .../libdevice.10.bc (unchanged)
`nvcc` was present at `$CUDA_HOME/bin/nvcc` throughout, in the toolkit those
four lines resolved.
## Root cause, across all three tools
`doctor` probes three CUDA toolkit executables by two different mechanisms:
| tool | doctor | the command that uses it |
|---|---|---|
| `compute-sanitizer` | `find_cuda_toolkit_executable` | `sanitize`, same helper |
| `nvcc` | `Command::new("nvcc")`, PATH only | nothing else invokes it |
| `cuda-gdb` | `Command::new("cuda-gdb")`, PATH only | `debug`, via the helper |
`find_cuda_toolkit_executable` tries PATH, then the root from
`CUDA_TOOLKIT_PATH` / `CUDA_HOME` / `cuda-oxide.toml`, then the standard install
roots. The two bare probes see only PATH. So:
* `nvcc` is in the required tier, so a working environment sets `ok = false`
and `doctor` exits 1;
* `cuda-gdb` contradicts `cargo oxide debug`, which resolves it through the
helper -- doctor calls absent a tool the command it is predicting would find.
The toolkit-root contract is doctor's own stated model; its `cuda.h` failure
prints "Set CUDA_TOOLKIT_PATH or CUDA_HOME to a CUDA Toolkit install root".
`COMPUTE_SANITIZER_FALLBACK_PATHS` states the rule the other two break, in its
own doc comment: "Shared by `sanitize` ... and `doctor` so both use the same
discovery order by construction." That helper arrived with the
compute-sanitizer probe in NVIDIA#537 and the older probes were never moved onto it.
Exactly three toolkit executables are referenced anywhere in `cargo-oxide`, so
this is the whole affected path, not the one symptom I noticed first.
## The change
All three probes now go through `DOCTOR_TOOLKIT_TOOLS`, one table pairing each
tool with its fallbacks, resolved by `doctor_toolkit_tool`. The `cuda-gdb`
fallback list becomes `CUDA_GDB_FALLBACK_PATHS`, shared by `doctor` and
`codegen_debug`, so the two answer identically by construction rather than by
coincidence -- `codegen_debug`'s inline copy is gone.
The required/optional tiers are deliberately untouched. Whether `nvcc` should be
required at all is a policy question; this is a discovery bug, and mixing the two
would make the change harder to judge.
## Tests
* **Regression** -- every tool in the table resolves under a configured toolkit
root with nothing on PATH. This is the case that was broken.
* **Unaffected control** -- the configured root is still preferred over the
standard install roots, so discovery order is unchanged; only which function
`doctor` calls changed. PATH precedence is asserted end to end against the
real binary instead of by mutating the process `PATH`, which is `unsafe` in
edition 2024 and racy across test threads.
* **Negative** -- absent from PATH, from the configured root and from the
fallbacks is still `None`; the fix invents no path.
* **Source invariant** -- no CUDA toolkit executable may be probed with a bare
`Command::new`. Read out of the source rather than from the table, so a tool
left out of the table is still caught. This is the test that fails before the
fix.
* **Single list** -- `doctor` and `debug` reference one `cuda-gdb` fallback
list, and a second inline copy fails the test.
Verified by reverting: the whole `nvcc` probe restored to its original form
compiles, fails `no_toolkit_executable_is_probed_by_bare_path`, and the CLI
returns to `✗ nvcc not found`. Re-adding an inline `cuda-gdb` list fails the
single-list test. Adding a bare `ptxas` probe fails the source invariant.
A PATH-only install still resolves from PATH, checked against the real binary
with a stub `nvcc` earlier on PATH.
Verified: 183 tests pass, fmt clean, `clippy --all-targets -- -D warnings`
clean, `RUSTDOCFLAGS="-D warnings" cargo doc` clean, and all guard scripts pass.
Doctor's exit status on this machine is still 1, for a genuinely absent `clang`
-- the fix does not paper over a real failure.
Closes NVIDIA#1180.
Signed-off-by: Vyncint Ng <[email protected]>
vyncint
added a commit
to vyncint/cuda-oxide
that referenced
this pull request
Aug 28, 2026
`cargo oxide doctor` reports the CUDA toolkit missing, and exits non-zero, on
an install where the toolkit is not on `PATH` -- immediately after reporting
four components of that same toolkit as found.
## Before -> after
Same machine, same environment, `CUDA_HOME=$HOME/cuda-13.3`, toolkit not on
`PATH`:
before after
CUDA headers (cuda.h)... ✓ .../include/cuda.h (unchanged)
CUDA toolkit (nvcc)... ✗ nvcc not found ✓ Cuda compilation tools,
release 13.3, V13.3.33
(.../cuda-13.3/bin/nvcc)
libNVVM (libnvvm.so)... ✓ libNVVM 2.0 (unchanged)
nvJitLink... ✓ nvJitLink 13.3 (unchanged)
libdevice... ✓ .../libdevice.10.bc (unchanged)
`nvcc` was present at `$CUDA_HOME/bin/nvcc` throughout, in the toolkit those
four lines resolved.
## Root cause, across all three tools
`doctor` probes three CUDA toolkit executables by two different mechanisms:
| tool | doctor | the command that uses it |
|---|---|---|
| `compute-sanitizer` | `find_cuda_toolkit_executable` | `sanitize`, same helper |
| `nvcc` | `Command::new("nvcc")`, PATH only | nothing else invokes it |
| `cuda-gdb` | `Command::new("cuda-gdb")`, PATH only | `debug`, via the helper |
`find_cuda_toolkit_executable` tries PATH, then the root from
`CUDA_TOOLKIT_PATH` / `CUDA_HOME` / `cuda-oxide.toml`, then the standard install
roots. The two bare probes see only PATH. So:
* `nvcc` is in the required tier, so a working environment sets `ok = false`
and `doctor` exits 1;
* `cuda-gdb` contradicts `cargo oxide debug`, which resolves it through the
helper -- doctor calls absent a tool the command it is predicting would find.
The toolkit-root contract is doctor's own stated model; its `cuda.h` failure
prints "Set CUDA_TOOLKIT_PATH or CUDA_HOME to a CUDA Toolkit install root".
`COMPUTE_SANITIZER_FALLBACK_PATHS` states the rule the other two break, in its
own doc comment: "Shared by `sanitize` ... and `doctor` so both use the same
discovery order by construction." That helper arrived with the
compute-sanitizer probe in NVIDIA#537 and the older probes were never moved onto it.
Exactly three toolkit executables are referenced anywhere in `cargo-oxide`, so
this is the whole affected path, not the one symptom I noticed first.
## The change
All three probes now go through `DOCTOR_TOOLKIT_TOOLS`, one table pairing each
tool with its fallbacks, resolved by `doctor_toolkit_tool`. The `cuda-gdb`
fallback list becomes `CUDA_GDB_FALLBACK_PATHS`, shared by `doctor` and
`codegen_debug`, so the two answer identically by construction rather than by
coincidence -- `codegen_debug`'s inline copy is gone.
The required/optional tiers are deliberately untouched. Whether `nvcc` should be
required at all is a policy question; this is a discovery bug, and mixing the two
would make the change harder to judge.
## Behaviour change, deliberate
A discovered `nvcc` whose `--version` fails now reports `✓ <path>` instead of
failing doctor. Previously a broken `nvcc` on PATH fell to the catch-all arm and
printed `✗ nvcc not found`, which was also wrong -- it was found. The new arm
mirrors the `compute-sanitizer` probe, which has always reported the path when
the version banner cannot be read. Recording it because it is a real change in
verdict for one input, not only a discovery fix.
## Tests
* **Table pairing** -- every entry pairs a tool with its own fallback list.
Pure, so it covers all three tools on every host; pairing `nvcc` with
`CUDA_GDB_FALLBACK_PATHS` is a one-token slip no filesystem test could see.
* **Lookup** -- each tool gets its own list and an unknown name gets none
rather than another tool's.
* **Call sites** -- every `doctor_toolkit_tool` call names a tool the table
knows, since an unknown name silently loses its standard install roots.
* **Source invariant** -- no CUDA toolkit executable may be probed with a bare
`Command::new`. Read out of the source rather than from the table, so a tool
left out of the table is still caught.
* **Single list** -- `doctor` and `debug` reference one `cuda-gdb` fallback
list; a second inline copy fails.
Every test here is hermetic: pure or source-based, no filesystem and no
environment. That is deliberate. `find_cuda_toolkit_executable` probes PATH
first through `which`, and that probe has no injection point, so a test using
real tool names asserts a temp root while resolving whatever the host has
installed. An earlier version of this commit did exactly that and passed only
because this machine has no `nvcc` on PATH -- the very configuration the fix is
about. Toolkit-root resolution itself stays covered by the existing
`sanitizer_tool_lookup_uses_project_cuda_toolkit_root`, which fabricates a name
for the same reason.
Each test confirmed to bite by breaking what it guards: mispairing the table,
probing a tool absent from it, making the lookup return one list for every
tool, and re-adding an inline `cuda-gdb` list each fail their own test.
Reverting a probe to `Command::new` does not compile; restored to its original
form so it does, it fails the source invariant and the CLI returns to
`✗ nvcc not found`.
Suite runs clean in all three host shapes: toolkit on PATH, toolkit on PATH
with `CUDA_HOME` elsewhere, and no toolkit on PATH at all.
Verified: 185 tests pass, fmt clean, `clippy --all-targets -- -D warnings`
clean, `RUSTDOCFLAGS="-D warnings" cargo doc` clean, and all guard scripts pass.
Manual `doctor` runs agree in both configurations -- toolkit on PATH and not --
resolving the same `nvcc`. Exit status on this machine is still 1, for a
genuinely absent `clang`: the fix does not paper over a real failure.
Closes NVIDIA#1180.
Signed-off-by: Vyncint Ng <[email protected]>
vyncint
added a commit
to vyncint/cuda-oxide
that referenced
this pull request
Aug 28, 2026
`cargo oxide doctor` reports the CUDA toolkit missing, and exits non-zero, on
an install where the toolkit is not on `PATH` -- immediately after reporting
four components of that same toolkit as found.
## Before -> after
Same machine, same environment, `CUDA_HOME=$HOME/cuda-13.3`, toolkit not on
`PATH`:
before after
CUDA headers (cuda.h)... ✓ .../include/cuda.h (unchanged)
CUDA toolkit (nvcc)... ✗ nvcc not found ✓ Cuda compilation tools,
release 13.3, V13.3.33
(.../cuda-13.3/bin/nvcc)
libNVVM (libnvvm.so)... ✓ libNVVM 2.0 (unchanged)
nvJitLink... ✓ nvJitLink 13.3 (unchanged)
libdevice... ✓ .../libdevice.10.bc (unchanged)
`nvcc` was present at `$CUDA_HOME/bin/nvcc` throughout, in the toolkit those
four lines resolved.
## Root cause, across all three tools
`doctor` probes three CUDA toolkit executables by two different mechanisms:
| tool | doctor | the command that uses it |
|---|---|---|
| `compute-sanitizer` | `find_cuda_toolkit_executable` | `sanitize`, same helper |
| `nvcc` | `Command::new("nvcc")`, PATH only | nothing else invokes it |
| `cuda-gdb` | `Command::new("cuda-gdb")`, PATH only | `debug`, via the helper |
`find_cuda_toolkit_executable` tries PATH, then the root from
`CUDA_TOOLKIT_PATH` / `CUDA_HOME` / `cuda-oxide.toml`, then the standard install
roots. The two bare probes see only PATH. So:
* `nvcc` is in the required tier, so a working environment sets `ok = false`
and `doctor` exits 1;
* `cuda-gdb` contradicts `cargo oxide debug`, which resolves it through the
helper -- doctor calls absent a tool the command it is predicting would find.
The toolkit-root contract is doctor's own stated model; its `cuda.h` failure
prints "Set CUDA_TOOLKIT_PATH or CUDA_HOME to a CUDA Toolkit install root".
`COMPUTE_SANITIZER_FALLBACK_PATHS` states the rule the other two break, in its
own doc comment: "Shared by `sanitize` ... and `doctor` so both use the same
discovery order by construction." That helper arrived with the
compute-sanitizer probe in NVIDIA#537 and the older probes were never moved onto it.
Exactly three toolkit executables are referenced anywhere in `cargo-oxide`, so
this is the whole affected path, not the one symptom I noticed first.
## The change
All three probes now go through `DOCTOR_TOOLKIT_TOOLS`, one table pairing each
tool with its fallbacks, resolved by `doctor_toolkit_tool`. The `cuda-gdb`
fallback list becomes `CUDA_GDB_FALLBACK_PATHS`, shared by `doctor` and
`codegen_debug`, so the two answer identically by construction rather than by
coincidence -- `codegen_debug`'s inline copy is gone.
The required/optional tiers are deliberately untouched. Whether `nvcc` should be
required at all is a policy question; this is a discovery bug, and mixing the two
would make the change harder to judge.
## Behaviour change, deliberate
A discovered `nvcc` whose `--version` fails now reports `✓ <path>` instead of
failing doctor. Previously a broken `nvcc` on PATH fell to the catch-all arm and
printed `✗ nvcc not found`, which was also wrong -- it was found. The new arm
mirrors the `compute-sanitizer` probe, which has always reported the path when
the version banner cannot be read. Recording it because it is a real change in
verdict for one input, not only a discovery fix.
## Tests
* **Table pairing** -- every entry pairs a tool with its own fallback list.
Pure, so it covers all three tools on every host; pairing `nvcc` with
`CUDA_GDB_FALLBACK_PATHS` is a one-token slip no filesystem test could see.
* **Lookup** -- each tool gets its own list and an unknown name gets none
rather than another tool's.
* **Call sites** -- every `doctor_toolkit_tool` call names a tool the table
knows, since an unknown name silently loses its standard install roots.
* **Source invariant** -- no CUDA toolkit executable may be probed with a bare
`Command::new`. Read out of the source rather than from the table, so a tool
left out of the table is still caught.
* **Single list** -- `doctor` and `debug` reference one `cuda-gdb` fallback
list; a second inline copy fails.
Every test here is hermetic: pure or source-based, no filesystem and no
environment. That is deliberate. `find_cuda_toolkit_executable` probes PATH
first through `which`, and that probe has no injection point, so a test using
real tool names asserts a temp root while resolving whatever the host has
installed. An earlier version of this commit did exactly that and passed only
because this machine has no `nvcc` on PATH -- the very configuration the fix is
about. Toolkit-root resolution itself stays covered by the existing
`sanitizer_tool_lookup_uses_project_cuda_toolkit_root`, which fabricates a name
for the same reason.
Each test confirmed to bite by breaking what it guards: mispairing the table,
probing a tool absent from it, making the lookup return one list for every
tool, and re-adding an inline `cuda-gdb` list each fail their own test.
Reverting a probe to `Command::new` does not compile; restored to its original
form so it does, it fails the source invariant and the CLI returns to
`✗ nvcc not found`.
Suite runs clean in all three host shapes: toolkit on PATH, toolkit on PATH
with `CUDA_HOME` elsewhere, and no toolkit on PATH at all.
Verified: 185 tests pass, fmt clean, `clippy --all-targets -- -D warnings`
clean, `RUSTDOCFLAGS="-D warnings" cargo doc` clean, and all guard scripts pass.
Manual `doctor` runs agree in both configurations -- toolkit on PATH and not --
resolving the same `nvcc`. Exit status on this machine is still 1, for a
genuinely absent `clang`: the fix does not paper over a real failure.
Closes NVIDIA#1180.
Signed-off-by: Vyncint Ng <[email protected]>
nihalpasham
pushed a commit
that referenced
this pull request
Aug 28, 2026
`cargo oxide doctor` reports the CUDA toolkit missing, and exits non-zero, on
an install where the toolkit is not on `PATH` -- immediately after reporting
four components of that same toolkit as found.
## Before -> after
Same machine, same environment, `CUDA_HOME=$HOME/cuda-13.3`, toolkit not on
`PATH`:
before after
CUDA headers (cuda.h)... ✓ .../include/cuda.h (unchanged)
CUDA toolkit (nvcc)... ✗ nvcc not found ✓ Cuda compilation tools,
release 13.3, V13.3.33
(.../cuda-13.3/bin/nvcc)
libNVVM (libnvvm.so)... ✓ libNVVM 2.0 (unchanged)
nvJitLink... ✓ nvJitLink 13.3 (unchanged)
libdevice... ✓ .../libdevice.10.bc (unchanged)
`nvcc` was present at `$CUDA_HOME/bin/nvcc` throughout, in the toolkit those
four lines resolved.
## Root cause, across all three tools
`doctor` probes three CUDA toolkit executables by two different mechanisms:
| tool | doctor | the command that uses it |
|---|---|---|
| `compute-sanitizer` | `find_cuda_toolkit_executable` | `sanitize`, same helper |
| `nvcc` | `Command::new("nvcc")`, PATH only | nothing else invokes it |
| `cuda-gdb` | `Command::new("cuda-gdb")`, PATH only | `debug`, via the helper |
`find_cuda_toolkit_executable` tries PATH, then the root from
`CUDA_TOOLKIT_PATH` / `CUDA_HOME` / `cuda-oxide.toml`, then the standard install
roots. The two bare probes see only PATH. So:
* `nvcc` is in the required tier, so a working environment sets `ok = false`
and `doctor` exits 1;
* `cuda-gdb` contradicts `cargo oxide debug`, which resolves it through the
helper -- doctor calls absent a tool the command it is predicting would find.
The toolkit-root contract is doctor's own stated model; its `cuda.h` failure
prints "Set CUDA_TOOLKIT_PATH or CUDA_HOME to a CUDA Toolkit install root".
`COMPUTE_SANITIZER_FALLBACK_PATHS` states the rule the other two break, in its
own doc comment: "Shared by `sanitize` ... and `doctor` so both use the same
discovery order by construction." That helper arrived with the
compute-sanitizer probe in #537 and the older probes were never moved onto it.
Exactly three toolkit executables are referenced anywhere in `cargo-oxide`, so
this is the whole affected path, not the one symptom I noticed first.
## The change
All three probes now go through `DOCTOR_TOOLKIT_TOOLS`, one table pairing each
tool with its fallbacks, resolved by `doctor_toolkit_tool`. The `cuda-gdb`
fallback list becomes `CUDA_GDB_FALLBACK_PATHS`, shared by `doctor` and
`codegen_debug`, so the two answer identically by construction rather than by
coincidence -- `codegen_debug`'s inline copy is gone.
The required/optional tiers are deliberately untouched. Whether `nvcc` should be
required at all is a policy question; this is a discovery bug, and mixing the two
would make the change harder to judge.
## Behaviour change, deliberate
A discovered `nvcc` whose `--version` fails now reports `✓ <path>` instead of
failing doctor. Previously a broken `nvcc` on PATH fell to the catch-all arm and
printed `✗ nvcc not found`, which was also wrong -- it was found. The new arm
mirrors the `compute-sanitizer` probe, which has always reported the path when
the version banner cannot be read. Recording it because it is a real change in
verdict for one input, not only a discovery fix.
## Tests
* **Table pairing** -- every entry pairs a tool with its own fallback list.
Pure, so it covers all three tools on every host; pairing `nvcc` with
`CUDA_GDB_FALLBACK_PATHS` is a one-token slip no filesystem test could see.
* **Lookup** -- each tool gets its own list and an unknown name gets none
rather than another tool's.
* **Call sites** -- every `doctor_toolkit_tool` call names a tool the table
knows, since an unknown name silently loses its standard install roots.
* **Source invariant** -- no CUDA toolkit executable may be probed with a bare
`Command::new`. Read out of the source rather than from the table, so a tool
left out of the table is still caught.
* **Single list** -- `doctor` and `debug` reference one `cuda-gdb` fallback
list; a second inline copy fails.
Every test here is hermetic: pure or source-based, no filesystem and no
environment. That is deliberate. `find_cuda_toolkit_executable` probes PATH
first through `which`, and that probe has no injection point, so a test using
real tool names asserts a temp root while resolving whatever the host has
installed. An earlier version of this commit did exactly that and passed only
because this machine has no `nvcc` on PATH -- the very configuration the fix is
about. Toolkit-root resolution itself stays covered by the existing
`sanitizer_tool_lookup_uses_project_cuda_toolkit_root`, which fabricates a name
for the same reason.
Each test confirmed to bite by breaking what it guards: mispairing the table,
probing a tool absent from it, making the lookup return one list for every
tool, and re-adding an inline `cuda-gdb` list each fail their own test.
Reverting a probe to `Command::new` does not compile; restored to its original
form so it does, it fails the source invariant and the CLI returns to
`✗ nvcc not found`.
Suite runs clean in all three host shapes: toolkit on PATH, toolkit on PATH
with `CUDA_HOME` elsewhere, and no toolkit on PATH at all.
Verified: 185 tests pass, fmt clean, `clippy --all-targets -- -D warnings`
clean, `RUSTDOCFLAGS="-D warnings" cargo doc` clean, and all guard scripts pass.
Manual `doctor` runs agree in both configurations -- toolkit on PATH and not --
resolving the same `nvcc`. Exit status on this machine is still 1, for a
genuinely absent `clang`: the fix does not paper over a real failure.
Closes #1180.
Signed-off-by: Vyncint Ng <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compute-sanitizerincargo oxide doctorusing the same PATH/toolkit fallbacks assanitize.cuda-gdb); presence prints version/path when available.Closes #532
Test plan
cargo test -p cargo-oxide doctor_compute_sanitizerok = false