Skip to content

Add support for standard Rust atomic compare exchange intrinsics.#263

Merged
LegNeato merged 7 commits into
Rust-GPU:mainfrom
FractalFir:main
Sep 17, 2025
Merged

Add support for standard Rust atomic compare exchange intrinsics.#263
LegNeato merged 7 commits into
Rust-GPU:mainfrom
FractalFir:main

Conversation

@FractalFir
Copy link
Copy Markdown
Collaborator

Currently, Rust-CUDA only supports CUDA-specifc atomics, and does not support the atomic operations provided by the Rust standard library.

This PR aims to address that, and emulate those intrinsics(by using CUDA-specific ones). The fix I implement is described in: #253

Once this PR(with the basic infrastructure for intrinsics) gets merged, we can add support for all the other intrinsics, allowing a lot more Rust code to run on the GPU - out of the box.

@FractalFir
Copy link
Copy Markdown
Collaborator Author

Now, we should support almost all atomics(including loads and stores), besides atomic nand, which is rarely used(and pretty straightforward to emulate).

Comment thread crates/rustc_codegen_nvvm/src/builder.rs Outdated
Comment thread crates/rustc_codegen_nvvm/src/builder.rs
@LegNeato
Copy link
Copy Markdown
Contributor

@FractalFir sorry, I had to force push while rebasing for some reason

LegNeato and others added 3 commits September 13, 2025 00:08
c_char depends on platform, so clippy will complain
on linux when it passes on macOS
@FractalFir
Copy link
Copy Markdown
Collaborator Author

Should be good to go, once the CI finishes.

Copy link
Copy Markdown
Contributor

@LegNeato LegNeato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥂 welcome to rust cuda!

@LegNeato LegNeato merged commit 8b2ad3f into Rust-GPU:main Sep 17, 2025
12 checks passed
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