This repository contains Rust bindings for AMD ROCm HIP runtime libraries (hiprtc, amdhip64) used by CubeCL.
⚠️ Notes
These bindings are unsafe as they are just the raw bindings generated by bindgen with no improvements.
Limitations
- Works only on Linux
- Bindings generated for AMD GPUs only
Prerequisites
Install ROCm following the ROCm documentation:
Versioning Scheme
The crates in this repository follow the same versioning as HIP. Note that HIP version is somewhat different than ROCm version. The patch number of HIP version is a monotonic number that uniquely identify the version of HIP.
We had a pre-release number (that acts as official release number), for instance 6.4.43482-1 represents the first release of the
bindings for HIP 43482 of ROCm 6.4.x and 6.4.43482-2 represents the second release for these same bindings.
This versioning scheme is in place as of October 2025, any previous version of this crate followed a different versioning scheme based on ROCm version instead of HIP.
Note also that multiple versions of ROCm can ship the same version of HIP.
Usage
Add the crate cubecl-hip-sys to the Cargo.toml file of your project. Cargo will select the HIP version returned by
the hipconfig utility.
To specify a different version of HIP manually set the environment variable HIP_PATH to a valid HIP installation path. You can
verify that your system points to the expected version with the command hipconfig --version.
Remark: Don't set manually the hip_xxx feature for this crate. This is the responsibility of the build.rs script to set it
accordingly to your hipconfig output.
Here is the table of currently available bindings:
| HIP Version | ROCm Version Range |
|---|---|
| 41134 | 6.2.2~6.2.4 |
| 42131 | 6.3.0 |
| 42133 | 6.3.1 |
| 42134 | 6.3.2~6.3.4 |
| 43482 | 6.4.0 |
| 43483 | 6.4.1 |
Running tests
To run tests you need to first meet the expectations for Prerequisites section.
Then execute the following xtask command:
# test ROCm bindings againt the system default ROCm installation if found
# test a specific version that is not the default by providing a value for HIP_PATH using -p
Generate bindings for a given version of ROCm
-
To generate the bindings you first need to meet the expectations for
Prerequisitessection. -
Make sure that
hipconfigreturns the path of the HIP version you want to wrap. Adapt theHIP_PATHenvironment variable to point to the version you are interested in. -
Generate the bindings using the dedicated xtask command
bindgen:
- Declare a new
hipfeature in theCargo.tomlincubecl-hip-syscrate with the formathip_<patch_version>. You can retrieve the patch version with the commandhipconfig --version. For instance for a new HIP patch version which is42131add the following feature:
[]
= []
- Add the generated bindings module to the file
crates/cubecl-hip-sys/src/bindings/mod.rsconditionally to the new feature you just declared as well as the re-exports:
pub use *;
-
Run the tests as explain in the previous section.
-
Open a pull request with the modifications, do not forget to add the new generated bindings file in the
crates/cubecl-hip-sys/src/bindings/directory. -
Note that the CI runner might need to be updated by an administrator so that the new HIP version is available on the runner.