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.
rocm-rs: Rust Bindings for AMD ROCm Libraries
This project provides Rust bindings for AMD's ROCm (Radeon Open Compute) libraries, allowing Rust developers to leverage AMD GPUs for high-performance computing.
Current Status
Note: This project is in early development.
Currently implemented:
- ✅ rocFFT - Fast Fourier Transform library (raw bindings + safe wrappers)
- ✅ HIP - Heterogeneous-Compute Interface for Portability (raw bindings only)
- ✅ rocBLAS - Basic Linear Algebra Subprograms (raw bindings only)
- ✅ MIOpen - Deep learning primitives (raw bindings only)
- ✅ rocRAND - Random number generation (raw bindings only)
- ✅ rocSOLVER - Linear system solvers (raw bindings only)
- ✅ rocSPARSE - Sparse linear algebra (raw bindings only)
The project currently focuses on providing raw FFI bindings for most libraries, with safe Rust wrappers available for rocFFT. Additional safe wrappers for other libraries are planned for future development.
Prerequisites
- AMD ROCm installed (version 6.0 or later recommended)
- Rust toolchain (1.65.0 or later recommended)
- A compatible AMD GPU
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage
First, ensure that the ROCm libraries are in your library path or set the ROCM_PATH environment variable.
Using rocFFT with safe wrappers:
use ;
Using other libraries with raw bindings:
use *;
Building from Source
Important: When building from source, you need to run cargo build first to generate the bindings files before you can use the library or run tests.
# Clone the repository
# Set the ROCm path if not in the default location
# Build the project (generates bindings)
# Run tests
Project Structure
rocm-rs/
├── Cargo.toml
├── build.rs # Build script to generate bindings
├── include/ # C/C++ headers
│ ├── hip.h
│ ├── miopen.h
│ ├── rocblas.h
│ ├── rocfft.h
│ ├── rocrand.h
│ ├── rocsolver.h
│ └── rocsparse.h
├── src/
│ ├── lib.rs # Main library entry point
│ ├── hip/ # HIP module
│ │ ├── mod.rs
│ │ └── bindings.rs # Auto-generated bindings (do not edit)
│ ├── miopen/ # MIOpen module
│ │ ├── mod.rs
│ │ └── bindings.rs
│ ├── rocblas/ # rocBLAS module
│ │ ├── mod.rs
│ │ └── bindings.rs
│ ├── rocfft/ # rocFFT module (with safe wrappers)
│ │ ├── mod.rs
│ │ ├── bindings.rs
│ │ ├── cache.rs
│ │ ├── description.rs
│ │ ├── error.rs
│ │ ├── execution.rs
│ │ ├── fft.rs
│ │ ├── field.rs
│ │ └── plan.rs
│ ├── rocrand/ # rocRAND module
│ │ ├── mod.rs
│ │ └── bindings.rs
│ ├── rocsolver/ # rocSOLVER module
│ │ ├── mod.rs
│ │ └── bindings.rs
│ └── rocsparse/ # rocSPARSE module
│ ├── mod.rs
│ └── bindings.rs
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
When contributing:
- Run
cargo buildfirst to generate the bindings - Add tests for new functionality
- Update documentation as needed
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- AMD for developing and maintaining ROCm
- The Rust community for bindgen and other tools used in this project