When linking `libnvvm.so.4` into `librustc_codegen_nvvm.so` shared
library via the `cust_raw` package, we specified the following
parameters in the `build.rs`:
- cargo::rustc-link-search=native=xxx
- cargo::rustc-link-lib=dylib=nvvm
According to the [Cargo documentation](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-search),
the path we added to the `rustc-link-search` parameter is not further
populated to the `LD_LIBRARY_PATH` for search by the transitive
dependencies.
> These paths are also added to the dynamic library search path
> environment variable if they are within the OUT_DIR.
The behavior is intended to be limited to the OUT_DIR so the
`libnvvm.so.4`, which lives as a part of the CUDA SDK, is excluded.
Therefore, we must add it to the LD_LIBRARY_PATH manually in our
container build stage.
Adds a custom bindgen callback that prevents function renames due to macro defines while still linking to the intend function after macro expansion. It does this by tracking macros when generating the bindings, so that it can change the name of the function back to what it was before the macro changed and link to the macro expanded function name. Doing so helps prevents breaking changes across CUDA versions when generating the bindings, and generates function bindings that match those used in Nvidia's CUDA documentation.
misc.: optix-sys rebuilds if related optix environment variables change.
misc.: unpin cc and jobserver from add example.
Added a new workflow, container_images.yml, to automate building and
pushing CI container images to GitHub Container Registry, ensuring
consistent environments for CI runs across Linux distributions.
Added a dedicated CI workflow for Linux to streamline testing across
multiple CUDA and OS configurations. It reuses the images built from
container_images.yml workflow to avoid installing CUDA toolkits every
time to save time.
Key changes:
- Matrix configurations for Ubuntu 22/24, RockyLinux 9 with CUDA 12.8.1
- Dockerfiles updated with required dependencies (clang, CUDA
toolchains, etc.) to support bindgen and build examples.
- Removed redundant CI steps from `rust.yml` now handled in
`ci_linux.yml`
The network installer is a smaller initial download, which will only
download the require packages to install. This should reduce the install
times on Windows CI.
1. Consolidation of bindgen related "*-sys" packages
- Remove the common dependency of `find_cuda_helper`. Use the cargo
metadata mechanism instead.
- Merged all CUDA bindgen-generated code into the cust_raw crate for
simplicity and maintainability.
- Add CUDA Runtime API bindgen support.
2. cuDNN and OptiX Integration
- Split cudnn into cudnn (high-level API) and cudnn-sys (low-level
bindgens) for better abstraction.
- Split optix into optix (high-level API) and optix-sys (low-level
bindgens) for better abstraction.
3. CUDA 12+ Support
- Updated cust to support CUDA versions >= 12.
- Added compatibility for CUDA 12.3+ graph API changes:
- Renamed cuGraphKernelNodeGetParams →
cuGraphKernelNodeGetParams_v2.
- Enabled conditional node support for CUDA >= 12.3.
4. Temporarily disable cuDNN in CI
- Windows CI pipelines have no cuDNN support yet.
Co-authored-by: Jorge Ortega <jorge-ortega@outlook.com>
The Docker setup has been refactored to support Ubuntu 20.04, 24.04, and
Rocky Linux 9 with CUDA 11/12. The original Dockerfile (Ubuntu 18.04 +
CUDA 11.4) has been replaced with a matrix of distribution-specific
Dockerfiles. Dependencies like LLVM 7 and Rust are now configured to
work across these environments.
`cc` already sets rustc-link-search and rustc-link-lib after compiling. Since other rerun-if-changed instructions are emitted, specifying build.rs is redudant.
The stubs were a copy of optix_stubs.h, but without `inline` so they end up in the binary when compiling them. This change instead includes optix_stubs.h and uses the preprocessor to erase `inline` in the header.
The latest version of CUDA ships libnvvm with version 2.0, which fails the check for an appropriate version number. This commit fixes this so that 2.0 correctly passes the minimum version number check.
Updated `bitflags` has a few breaking changes:
- it no longer adds traits like `Clone`, `Copy`, etc.. Add those explicitly.
- An internal wrapper over the underlying flag type is used that isn't `DeviceCopy`. Define the struct wrapping the underlying type explictly, and use `bitflags!` to define the impl.
`register_attr` was removed in favor of `register_tool`. This updates how the nvvm attributes are applied in our proc_macros and how the nvvm backend parses them. Also removes redundant applications of no_std, as cuda_builder applies it to all crates built on the cuda target via rustc flags.
The add example crate now compiles and runs the geneated ptx! :D
This includes several updates to the backend based on changes in
rustc_codegen_llvm, which brings some bug fixes and a refactor to debug
info. This fixes failing dependencies that resolved to newer versions
that failed to build on the previous nightly.
Removes depending on rustc_codegen_llvm as it can't be imported with the
new toolchain for some reason.
The example cuda kernals fail to build. Their dependencies
cause nvvm to abort with ICE.
std::process::Command.output() doesn't return error on non-zero exit, only
when command.inner() fails.
If `which nvcc` can't find `nvcc` it returns like (ExitStatus(-1), "", "")
and causes a panic in the return of the function.
Instead, panic on non-zero return with an informational diagnostic message.
* Dependencies updated and toolchain updated to a modern version of rust nightly. Had to update the vek, sysinfo, and rayon crates, since they wer pulling in code from dependencies that has long since been broken.
rustc codegen nvvm is still broken, seems to have a number of issues. Once I got Optix installed and setup, I started having trouble with llvm. The build file seems to need llvm-config, which does not ship with precompiled binaries for llvm. I compiled llvm from source, but am still unable to get the build file to find that correctly. There are also a number of regular errors which will need to resolved slowly.
* Dependencies for all crates should be updated to the latest available versions. Going to tackle any breaking changes next
* Two bit flag fields in cust/texture.rs did not implement traits required by the structs they were contained in. This has been resolved
* I both of these files, the field access was replaced with a getter method, which was previously throwing an error
* ArrayObjectFlags needed Debug and PartialEq traits to be derived, was throwing an error before
* updating another file
* removed once_cell as dependency from rustc_codegen_nvvm. The goal was to replace with the standardized version from the std library, but the dependency does not seem to be in use anyway