NVlabs/cuda-oxide
cuda-oxide is an experimental Rust-to-CUDA compiler that lets you write (SIMT) GPU kernels in safe(ish), idiomatic Rust. It compiles standard Rust code directly to PTX — no DSLs, no foreign language bindings, just Rust.
What it solves
cuda-oxide allows developers to write GPU kernels using pure Rust instead of relying on CUDA C++ or domain-specific languages (DSLs). It eliminates the need for foreign language bindings by providing a custom compiler backend that enables single-source compilation, where both host and device code reside in the same file and are built with a single command.
How it works
The project implements a custom rustc codegen backend. It transforms Rust code through a multi-stage pipeline: Rust source is converted to Rust MIR, then to a custom MLIR-like intermediate representation called Pliron IR, then to LLVM IR, and finally to CUDA PTX. It provides a set of device-side abstractions for type-safe indexing, shared memory, and warp/cluster operations, alongside a host-side runtime (cuda-core and cuda-async) for memory management and kernel launching.
Who it’s for
It is designed for Rust developers who want to build high-performance GPU kernels with the safety and expressiveness of Rust, as well as researchers and engineers working with NVIDIA hardware (including Hopper and Blackwell architectures) who want to avoid the complexities of CUDA C++.
Highlights
- Single-Source Compilation: Host and device code are managed in one file and built via
cargo oxide build. - Pure Rust Kernels: Supports generic functions with monomorphization, closures with captures, and standard Rust features like enums and pattern matching.
- Comprehensive GPU Support: Full access to GPU intrinsics including TMA, clusters, barriers, and atomics.
- Async Execution: A dedicated
cuda-asynclayer for composable, asynchronous GPU operations. - Device Interop: Supports Device FFI for Rust and C++/CCCL interop via LTOIR.
- Advanced Hardware Support: Includes specialized examples for Blackwell tensor cores and GEMM implementations.
Related
- Dispatch
- Project
- Project
- Dispatch
- Dispatch