Skip to content

cuda-bindings: handle CUDA header discovery errors#88

Open
yagna-1 wants to merge 2 commits into
NVlabs:mainfrom
yagna-1:fix/cuda-bindings-header-discovery
Open

cuda-bindings: handle CUDA header discovery errors#88
yagna-1 wants to merge 2 commits into
NVlabs:mainfrom
yagna-1:fix/cuda-bindings-header-discovery

Conversation

@yagna-1
Copy link
Copy Markdown

@yagna-1 yagna-1 commented May 26, 2026

Summary

  • Make the cuda-bindings build script report missing or unreadable CUDA headers directly instead of falling through to a bindgen panic.
  • Discover CUDA headers in both the standard include/ layout and target-specific redistributable layouts such as targets/x86_64-linux/include/ and targets/sbsa-linux/include/.
  • Pass discovered include paths to bindgen and matching target-layout library paths to rustc.

Fixes #87.

Test plan

  • cargo fmt --check --all
  • cargo test -p cuda-device -p oxide-artifacts -p reserved-oxide-symbols --lib --tests
  • cargo test -p cargo-oxide --all-targets on a host without CUDA headers now fails with the direct cuda-bindings: could not find cuda.h... build-script error instead of a bindgen panic.

@yagna-1 yagna-1 force-pushed the fix/cuda-bindings-header-discovery branch from cfa4b39 to eb140b1 Compare May 26, 2026 05:40
@fbrv
Copy link
Copy Markdown
Contributor

fbrv commented May 27, 2026

I think this is not enough: in sbsa environment this wouldn’t work, even if cuda is installed.
Also it doesn’t take in consideration environments where cuda is not installed in the default path but I think it’s a project decision to support or not default paths (@nihalpasham)

@yagna-1
Copy link
Copy Markdown
Author

yagna-1 commented May 27, 2026

Updated to scan CUDA target-layout directories via targets/* instead of hardcoding targets/x86_64-linux, so SBSA layouts such as targets/sbsa-linux are covered as well.

Report missing or unreadable CUDA headers directly from the build script and
discover CUDA headers and libraries in both the standard toolkit layout and
target-specific layouts such as targets/x86_64-linux and targets/sbsa-linux.

Signed-off-by: yagna-1 <yagna-1@users.noreply.github.com>
@yagna-1 yagna-1 force-pushed the fix/cuda-bindings-header-discovery branch from eb140b1 to fbf7a7a Compare May 27, 2026 06:08
Discover CUDA headers and libraries across target-specific toolkit layouts
such as targets/x86_64-linux and targets/sbsa-linux instead of hardcoding a
single target directory.

Signed-off-by: yagna-1 <yagna-1@users.noreply.github.com>
@fbrv
Copy link
Copy Markdown
Contributor

fbrv commented May 28, 2026

I think this introduces another problem: if multiple CUDA targets are installed, we may end up mixing dependencies and likely cause build/link errors. We should probably first discover the CUDA host target, and only then look for cuda.h under that target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo oxide doctor cannot diagnose missing CUDA headers because cuda-bindings panics first

3 participants