nvptx 0.2.3

Rust to PTX compiler using LLVM/NVPTX target
docs.rs failed to build nvptx-0.2.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: nvptx-0.2.2

nvptx toolchain

Crate docs.rs CircleCI

Compile Rust into PTX/cubin


nvptx command

nvptx is a CLI tool to

  • Build Rust crate into a PTX/cubin file
  • install accel-nvptx toolchain (for rustup)
cargo install nvptx

accel-nvptx toolchain

accel-nvptx is a toolchain name for rustup. It contains rustc and runtime libraries with nvptx64-nvidia-cuda target.

nvptx install

This installs accel-nvptx toolchain to rustup like:

$ rustup toolchain list
nightly-x86_64-unknown-linux-gnu (default)

This toolchain is built from


You can build your crate using accel-nvptx toolchain into a PTX file

nvptx build

This consists of following three steps:

  • Compile Rust into LLVM bitcode. This step corresponds to the following command:
cargo +accel-nvptx build --target nvptx64-nvidia-cuda
  • Link rlib into a LLVM bitcode using llvm-link
  • Drop unused bitcode using opt
  • Compile LLVM bitcode into PTX using llc
  • (Optional) Convert PTX to cubin using nvcc