# cuTile Rust

> Write GPU kernels in safe Rust, one tile at a time

- Category: Models & Inference / GPU Kernels & Compilers
- Language: Rust
- Licence: Apache-2.0
- Repository: https://github.com/NVlabs/cutile-rs
- Website: https://nvlabs.github.io/cutile-rs/
- Canonical page: https://ai-tldr.dev/tools/cutile-rs/
- Updated: 2026-06-16

## In short

cuTile Rust is NVIDIA Labs' kernel-programming DSL for Rust. It sits in the GPU Kernels & Compilers category of the Models & Inference tools and is open-source, written in Rust and licensed Apache-2.0. To get started: install Rust and CUDA.

## Overview

cuTile Rust is NVIDIA Labs' kernel-programming DSL for Rust. Instead of writing CUDA C++ and reasoning about threads and synchronisation by hand, you write kernels over tiles — whole blocks of a tensor — inside a `#[cutile::module]` block, and the macro embeds the Rust AST so the kernel can be JIT-compiled for the GPU.

The point of building it in Rust is the ownership model. cuTile extends Rust's borrow discipline across the GPU launch boundary: a mutable tensor is partitioned into disjoint pieces before a kernel runs, so the compiler rules out the data races that manual kernel synchronisation is famous for. On the host side the same API covers synchronous launches, asynchronous pipelines and CUDA graph replay.

It targets NVIDIA GPUs with compute capability sm_80 or higher, is developed against CUDA 13.3 and Rust 1.89+, and is tested on Linux (Ubuntu 24.04). The project is Apache-2.0 licensed with documentation at nvlabs.github.io/cutile-rs.

## What it does

- Tile-based kernel authoring — operate on blocks of a tensor rather than individual threads
- Rust ownership extended across the launch boundary, with mutable tensors partitioned into disjoint pieces
- JIT compilation through the `#[cutile::module]` macro, which embeds the Rust AST
- Host API covering synchronous launches, asynchronous pipelines and CUDA graph replay
- Data-race freedom enforced by the compiler instead of by hand-written synchronisation

## Getting started

You need a Rust toolchain (1.89+), a CUDA install (13.3 recommended) and an NVIDIA GPU of compute capability sm_80 or newer, on Linux.

1. Install Rust and CUDA

   Install the Rust toolchain, then the CUDA toolkit from NVIDIA's downloads page.

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default stable
```

2. Point the build at your CUDA toolkit

   Set the toolkit path in `.cargo/config.toml`.

```toml
[env]
CUDA_TOOLKIT_PATH = { value = "/usr/local/cuda-13", relative = false }
```

3. Run an example, then write a kernel

   `hello_world` verifies the toolchain end to end. A kernel is a function inside a `#[cutile::module]` block that loads tiles, computes, and stores.

```bash
cargo run -p cutile-examples --example hello_world
```

4. A minimal kernel

   Element-wise add over tiles, with the output tensor taken by mutable reference.

```rust
#[cutile::module]
mod kernel {
    use cutile::core::*;
    #[cutile::entry()]
    fn add<const B: i32>(
        z: &mut Tensor<f32, { [B] }>,
        x: &Tensor<f32, { [-1] }>,
        y: &Tensor<f32, { [-1] }>,
    ) {
        let tx = x.load_like(z);
        let ty = y.load_like(z);
        z.store(tx + ty);
    }
}
```

## When to use it

- Write custom GPU kernels from a Rust codebase without dropping to CUDA C++
- Rule out data races in kernel code at compile time rather than in a debugger
- Build asynchronous or CUDA-graph-replayed pipelines behind a safe host API
- Prototype tile-level numerical kernels for inference or training workloads

## Version history

- 2026-06-16 v0.2.0: NVIDIA Labs released cuTile Rust v0.2.0, adding NVFP4 packing and block-scaled GEMM on B200 alongside the companion paper "Fearless Concurrency on the GPU".
