Skip to content

Make CUDA library discovery platform-aware - #1173

Closed
uurl wants to merge 1 commit into
NVIDIA:mainfrom
uurl:portability/cuda-dylib-discovery
Closed

uurl wants to merge 1 commit into
NVIDIA:mainfrom
uurl:portability/cuda-dylib-discovery

Conversation

@uurl

@uurl uurl commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Related to #139.

Summary

Make runtime discovery in libnvvm-sys and nvjitlink-sys platform-aware while preserving the existing Linux discovery behavior.

This is intentionally a narrow portability change related to #139. It does not attempt to provide complete Windows support for cuda-oxide.

Changes

  • Preserve the existing Linux CUDA Toolkit discovery order.
  • Add Windows/MSVC CUDA Toolkit DLL candidates for:
    • libNVVM
    • nvJitLink
  • Discover versioned CUDA DLLs from known Toolkit directories.
  • Scan candidate directories case-insensitively.
  • Prefer versioned DLL candidates deterministically.
  • Avoid Unix CUDA root defaults on Windows.
  • Update the corresponding crate documentation.
  • Add deterministic tests for Windows Toolkit layouts and versioned DLL discovery.

Validation

Validated on Linux with:

cargo fmt --all -- --check

cargo test -p libnvvm-sys
cargo test -p nvjitlink-sys

cargo clippy \
  -p libnvvm-sys \
  -p nvjitlink-sys \
  --all-targets \
  -- -D warnings

cargo check --workspace --locked

git diff --check

Cross-target compilation was also validated with:

rustup target add x86_64-pc-windows-msvc

cargo check -p libnvvm-sys --target x86_64-pc-windows-msvc
cargo check -p nvjitlink-sys --target x86_64-pc-windows-msvc

The tests requiring an installed CUDA Toolkit remain ignored as before.

Scope

This PR is limited to CUDA runtime-library discovery.

It does not include:

  • COFF support in oxide-artifacts
  • Windows-specific cargo-oxide command handling
  • rustc codegen backend export changes
  • Windows CI
  • packaging changes
  • full Windows support

@uurl
uurl force-pushed the portability/cuda-dylib-discovery branch from fdff67f to c5b07e3 Compare August 23, 2026 22:12
@nihalpasham nihalpasham added on-hold Paused: valid but deferred until a prerequisite decision or dependency resolves Depends Blocked on another PR/issue or an upstream dependency build-related Build scripts, toolchain discovery, or compilation setup platform-support OS / target platform support (Windows, macOS, non-Linux toolchains) labels Aug 24, 2026
@nihalpasham

nihalpasham commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Closing this PR because #139 has not established Windows ownership or library-discovery policy, and this branch needs a redesign rather than an indefinite hold.

  • The same Windows scanning and selection logic is duplicated in both sys crates instead of using one source of truth.
  • Toolkit versions are ordered lexically, which can select an older installation as the newest.
  • The PR body reports Windows cross-target cargo check; what remains missing is independently verified native-Windows discovery, library-load, and CI evidence.

A fresh proposal can be considered after #139 sets the ownership and design. It should share the scanner, parse versions numerically, and meet the Discord acceptance criteria.

@nihalpasham nihalpasham added declined PR intentionally not merged (closed without merging) and removed on-hold Paused: valid but deferred until a prerequisite decision or dependency resolves Depends Blocked on another PR/issue or an upstream dependency labels Aug 24, 2026
@uurl
uurl deleted the portability/cuda-dylib-discovery branch August 31, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-related Build scripts, toolchain discovery, or compilation setup declined PR intentionally not merged (closed without merging) platform-support OS / target platform support (Windows, macOS, non-Linux toolchains)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants