NVIDIA/cuda-rust

NVIDIA's CUDA platform for Rust. Host runtime crates plus Tile (cutile-rs) and SIMT (cuda-oxide) kernel programming models in idiomatic Rust.

What it solves

It enables developers to write GPU kernels in pure Rust instead of using C++ or domain-specific languages (DSLs). By providing a custom compiler backend, it removes the need for foreign language bindings and allows host and device code to coexist in the same file, simplifying the development of high-performance CUDA applications.

How it works

The project implements a custom rustc backend that compiles Rust code directly to CUDA PTX. It uses a native Rust compilation pipeline (Rust $\rightarrow$ Rust MIR $\rightarrow$ Pliron IR $\rightarrow$ LLVM IR $\rightarrow$ PTX). It includes a host-side runtime for memory management and kernel launching, as well as device-side abstractions for type-safe indexing, shared memory, and warp/cluster operations.

Who it’s for

Systems programmers and AI researchers who want the safety and expressiveness of Rust for GPU programming, specifically those targeting NVIDIA hardware.

Highlights

  • Single-source compilation: Host and device code are managed in one file and built with a single command (cargo oxide build).
  • Pure Rust kernels: Supports generic functions with monomorphization and closures with captures.
  • Comprehensive GPU support: Full access to CUDA intrinsics, including thread/warp operations, shared memory, barriers, TMA, and clusters.
  • Advanced Interop: Supports device-side FFI for Rust and C++/CCCL interop via LTOIR.
  • Async Runtime: Provides a cuda-async layer for composable, asynchronous GPU operations.

Related

  • Project
  • Project
  • Project
  • Project