Skip to content

Update toolchain to nightly-03-02. #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 13, 2025

Conversation

jorge-ortega
Copy link
Collaborator

The purpose of this change is to update the rust toolchain to a more recent release; specifically, nightly-2025-03-02.

New toolchain means new rustc internal interface changes that needed to be made. Much of the logic is just copied from the llvm backend, with some changes to conform to nvvm specific logic and where assumptions of opaque pointers deviate with typed pointers. A major refactor to the debug metadata in the llvm backend was also brought in (though likely very unnecessary).

LLVM rust wrapper changes includes:

  • backporting opaque pointer specific APIs straight into our wrapper and will be conditionally compiled when using LLVM 7.
  • Safer LLVMRust APIs that accept char* and size_t lengths to create StringRefs internally.

Changes to cuda_builder when building cuda targets include:

  • building all crates with no_std
  • building all crates with saturating_float_casts=false as nvvm does not support saturating float to int casts.
  • registering nvvm_internal as a tool attribute in all crates

Complies and runs the add example. Neither path_tracer or optix examples have been tested with these changes.

Thanks to @apriori for attempting the previous port, which served as a helpful guide for this port.

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.
Nvvm codegen compiles with latest nightly, and is able to codegen `core` and other essential crates. `libm` causes ICE and is next on the list to fix.
Previous change was just to get the backend to compile. This gets libm to compile now.
`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
@LegNeato
Copy link
Contributor

I'm not qualified to review the LLVM side, the rust backend stuff looks sane. Let's land and iterate as it is strictly better than what is there.

@LegNeato LegNeato merged commit 8fc34d5 into Rust-GPU:main Mar 13, 2025
0 of 2 checks passed
@jorge-ortega jorge-ortega deleted the nightly-03-02 branch March 13, 2025 19:34
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.

2 participants