Offloading Rust To GPUs Proves Capable Of High Performance With Memory Safety

A new research paper published on LLVM offloading to GPU accelerators using the Rust programming language is talking up the prospects of making use of safe Rust code for GPU kernels while retaining Rust's memory safety and other advantages over C++ / CUDA / HIP.

The research paper by Manuel S. Drehwald, Marcelo Domínguez, Kevin Sala, Alán Aspuru-Guzik, and Johannes Doerfert finds that using LLVM's Offload infrastructure and the characteristics of the Rust programming language can still lead to competitive performance against native, hand-optimized CUDA and HIP C++ kernels. All of this resides within the LLVM back-ends and Rust compiler.

The benchmark results shared in the paper found that their LLVM offload implementation with Rust was generally competitive to native AMD HIP and NVIDIA CUDA solutions for most of the tests -- and winning some, losing others. The researchers are aware of other performance avenues to pursue for closing some of those gaps moving forward around the code generation and other IR differences.


Their front-end is considered safe and allows most GPU kernels to avoid using raw pointers.

Those interested in learning more about this LLVM offload work in Rust can see the paper on arxiv.org .

The upstream tracking for Rust offload support can be found via this Rust-Lang ticket .