amdgpu-device-libs-build 0.2.0

Support library for the amdgpu target, build script utility to link device-libs
Documentation
  • Coverage
  • 57.14%
    4 out of 7 items documented2 out of 4 items with examples
  • Size
  • Source code size: 42.57 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 183.26 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Flakebi

amdgpu-device-libs-build docs.rs

Build script support for amdgpu-device-libs.

Adds linker flags to link device-libs. Add amdgpu-device-libs-build as a build-dependency and call it in the build script.

// build.rs
fn main() {
    amdgpu_device_libs_build::build();
}

This links to the ROCm device-libs and a pre-compiled helper library. The libraries are linked from a ROCm installation. If libraries are found not found by default, set the environment variable HIP_DEVICE_LIB_PATH to the bitcode files. The path should end with amdgcn/bitcode and contain .bc files. See the documentation of amdgpu-device-libs for more information.

Build utility library

The code to emit device code for printf is in clang, therefore it cannot be used easily from rustc or any Rust library. We workaround this by compiling a simple hip file (util.hip) with clang and that exposes a print function. util.hip is compiled to LLVM bitcode, we then massage this bitcode, stripping unnecessary parts to make it generic over the gfx hardware architecture. The bitcode files resulting from this ship with this library as bitcode binaries. They are fairly small (can be inspected by hand) and not needing a hip-enabled clang makes it much easier to compile Rust programs for amdgpu. The compile-util.sh script is used to create the bitcode. It needs ROCM_DEVICE_LIB_PATH pointing to a path that contains amdgcn/bitcode/*.bc files.