NVIDIATanya LenzTutorial
Translating CUDA Tile Operations from Python to Rust Using Agentic AI
Summary
cuTile Rust (cutile-rs) extends Rust’s ownership model to tile-based GPU kernels, and this post describes an agentic workflow for translating cuTile Python and Triton-TileIR implementations. Because all three front ends target CUDA Tile IR and share the tileiras compiler, the workflow compares reference and translated IR while making Python’s implicit specializations explicit through Rust const generics, fixed dtype symbols, and FFI checks. A bounded multi-agent pipeline covers analysis, device kernels, host and FFI code, correctness, and benchmarking, with machine-checkable verdicts controlling progress. It ported all 24 public TileGym operators, roughly 40 kernels, and reported 99.5% average cuTile Python performance across 347 paired configurations on NVIDIA DGX B200. The skill ships with TileGym and uses acceptance checks requiring correctness, backend execution, and a geomean speedup of at least 0.95.
Context
cuTile Python, Triton-TileIR, and cuTile Rust are front ends over CUDA Tile IR and share the tileiras compiler. This makes translation a re-expression of an existing tile program rather than a separate re-optimization effort, while exposing differences in specialization, ABI handling, and Rust source checking.
Approach / What changed
The workflow uses a bounded multi-agent pipeline covering kernel analysis, device-kernel implementation, host and FFI code, correctness validation, and benchmarking. Each stage produces a machine-checkable verdict; validator scripts, Tile IR diffs, numerical tests, backend-execution checks, and CUPTI performance thresholds determine whether work proceeds. A production driver runs conversions in isolated branches, permits at most two attempts per operator, and commits only passing results.
Takeaways
All 24 public TileGym operators were ported, covering roughly 40 kernels from element-wise operations through flash-attention decode, MLA, and MoE models.
Tile IR diffs verify memory-operation families, tile shapes, reductions, cost hints, and attributes before tests, helping detect plausible translations that could fail outside test coverage.
Rust requires specializations to be declared in kernel signatures, so the port makes tile shapes, element types, dtype dispatch, structural branches, and ABI validation explicit.
FAQ
Why does the workflow compare Tile IR instead of relying only on functional tests?
A translation can pass tests while still changing a TMA load’s cost hint or dropping a divisibility attribute. Comparing reference and translated Tile IR checks the structure directly before execution and can expose performance or correctness risks outside test coverage.
What makes specialization harder in cuTile Rust than in cuTile Python?
cuTile Python specializes implicitly at call time, while cuTile Rust specializes only what the kernel signature declares. Rust therefore needs explicit const generics, fixed dtype symbols, and separate structural entries when compile-time branches change a kernel’s shape or rank.
How was the reported performance measured?
The final numbers use CUPTI device time on an NVIDIA DGX B200, with one exclusive GPU per backend and 347 paired configurations across the 24 operators. The best measurement from four CI runs was used for each configuration, producing an overall geomean of 0.995 versus cuTile Python.
Source and freshness
- Source
- developer.nvidia.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.