hn.today

CUDA Rust: Two Tracks for Writing GPU Kernels

developer.nvidia.com5 points0 comments
Screenshot of CUDA Rust: Two Tracks for Writing GPU Kernels

NVIDIA is delivering native GPU kernel programming in Rust through two complementary tracks that map to CUDA’s existing SIMT and Tile models. One track, cuda-oxide, is a custom rustc codegen backend that compiles SIMT-style Rust kernels to PTX via the Pliron IR framework and LLVM, letting developers write thread-centric kernels and launch thousands of lightweight threads. The other, cutile-rs, targets Tile programming: kernels operate on sub-tensors ("tiles") and are JIT-compiled through CUDA Tile IR so the compiler chooses how tiles map to hardware. Both tracks prioritize compile-time memory safety: cuda-oxide enforces exclusive per-thread writes with types like DisjointSlice and launch_contracts, while cutile-rs uses tensor partitioning and ownership to guarantee exclusive access for each tile.

The two approaches differ in practicality and trade-offs. cuda-oxide gives low-level control and keeps host and device code in one file, but requires a pinned nightly Rust toolchain, LLVM/clang headers, and is early-stage; building the codegen backend can be slow on first use. cutile-rs runs on stable Rust 1.89+ with CUDA 13.3, is published as a crate, and simplifies portable performance by letting the compiler and Tile IR handle thread mapping and memory layout; it’s recommended as the first choice unless explicit SIMT control or manual memory/thread management is needed. Inter-language interoperability across CUDA Rust, C++, and Python is planned so frontend choice won’t lock projects into one ecosystem.

Read on developer.nvidia.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in AI

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.