NVlabs/cutile-rs
cuTile Rust provides a safe, tile-based kernel programming DSL for the Rust programming language. It features a safe host-side API for passing tensors to asynchronously executed kernel functions.
What it solves
Writing GPU kernels is traditionally error-prone, often leading to memory safety issues and data races. cuTile Rust provides a system for writing these kernels in Rust, extending Rust's strict ownership and borrowing rules to the GPU to ensure that kernels are memory-safe and free of data races by design.
How it works
It uses a tile-based approach where mutable outputs are split into disjoint pieces (tiles), while read-only inputs are shared. The system employs a #[cutile::module] macro to transform Rust functions into GPU kernels and generates a host-side launcher. These kernels are then JIT-compiled through CUDA Tile IR, allowing them to be executed synchronously, via async/await, or as CUDA graph replays.
Who it’s for
Developers who want to write high-performance GPU kernels using Rust's safety guarantees instead of traditional CUDA C++, as well as researchers building ML inference engines (like Grout or Candle) that require custom, optimized GPU operations.
Highlights
- Memory Safety: Extends Rust's ownership rules to the device to prevent data races.
- JIT Compilation: Compiles kernels on the fly using CUDA Tile IR.
- Flexible Execution: Supports synchronous, asynchronous, and CUDA graph replay execution modes.
- High Performance: Capable of reaching near-cuBLAS performance for GEMM operations and high throughput for LLM inference.
Related
- Dispatch
- Dispatch
- Project
- Project
- Dispatch