项目作者: rust-accel

项目描述 :
Compile Rust into PTX
高级语言: Rust
项目地址: git://github.com/rust-accel/nvptx.git
创建时间: 2018-07-15T07:22:58Z
项目社区:https://github.com/rust-accel/nvptx

开源协议:MIT License

下载


nvptx toolchain

Crate
docs.rs
CircleCI

Compile Rust into PTX/cubin

Install

nvptx command

nvptx is a CLI tool to

  • Build Rust crate into a PTX/cubin file
  • install accel-nvptx toolchain (for rustup)
  1. 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.

  1. nvptx install

This installs accel-nvptx toolchain to rustup like:

  1. $ rustup toolchain list
  2. stable-x86_64-unknown-linux-gnu
  3. nightly-x86_64-unknown-linux-gnu (default)
  4. accel-nvptx

This toolchain is built from

Build

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

  1. nvptx build

This consists of following three steps:

  • Compile Rust into LLVM bitcode. This step corresponds to the following command:
  1. 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