Announcing The Rust CUDA Project; An ecosystem of crates and tools for writing and executing extremely fast GPU code fully in Rust

1024 points Rdambrosio016

https://github.com/RDambrosio016/Rust-CUDA

Hello everyone!
After over half a year of work, i am finally releasing a very early version of the project i have been working on with the goal of making Rust a Tier-1 language for fast GPU computing.

It is still early so expect bugs, things that don't work, and maybe needing to install llvm sometimes.

With this release comes a few crates:

  • rustc_codegen_nvvm for compiling rust to CUDA PTX code using rustc's custom codegen mechanisms and the libnvvm CUDA library.
  • cust for actually executing the PTX, it is a high level wrapper for the CUDA Driver API.
  • cuda_builder for easily building GPU crates.
  • cuda_std the GPU-side standard library which complements rustc_codegen_nvvm.
  • gpu_rand GPU-friendly random number generation (because curand doesn't work with the driver API).
  • nvvm High level bindings to libnvvm
  • ptx_compiler High level bindings to the PTX compiler APIs, currently incomplete (does not include compiler options).
  • find_cuda_helper for finding CUDA on the system.

As well as some more WIP projects (not published to crates.io):

  • optix for CPU-side OptiX, currently not published because it is actively being rewritten.
  • optix_gpu (on a different branch) for using rustc_codegen_nvvm for OptiX. Needs a lot of work on the codegen side.
  • ptx PTX lexing, parsing, and analysis. Eventually will be used for safety-checking launches.

The path tracer i previously posted as a teaser for this project has also been published in examples/cuda.

Leading this project are:

  • Riccardo D'Ambrosio (me): First year college student with interests in GPU computing and optimization, started this as a random project half a year ago.
  • Anders Langlands: VFX Supervisor at Weta FX, Author of the original optix-rs OptiX bindings. Currently works on wrapping OptiX and using the project for OptiX ray tracing.

I would also like to extend a big thanks to everyone on Zulip who helped in debugging and answering weird questions about rustc internals, especially bjorn3 and nagisa.