Skip to content

Commit 75bcfaf

Browse files
committed
Add HIP bindings patch version 42131
Fix CI
1 parent c78c696 commit 75bcfaf

File tree

6 files changed

+8215
-23
lines changed

6 files changed

+8215
-23
lines changed

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/build-script/src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::path::Path;
21
use std::fmt;
2+
use std::path::Path;
33

44
pub struct Version {
55
pub major: u8,
@@ -41,7 +41,11 @@ pub fn get_rocm_system_version(rocm_path: impl AsRef<Path>) -> std::io::Result<V
4141
.parse::<u32>()
4242
.expect("Invalid rocm_version.h file structure: Couldn't parse patch version.");
4343

44-
Ok(Version { major, minor, patch })
44+
Ok(Version {
45+
major,
46+
minor,
47+
patch,
48+
})
4549
}
4650

4751
/// Reads the HIP header inside the rocm folder that contains the HIP specific version
@@ -72,5 +76,9 @@ pub fn get_hip_system_version(rocm_path: impl AsRef<Path>) -> std::io::Result<Ve
7276
.parse::<u32>()
7377
.expect("Invalid hip_version.h file structure: Couldn't parse patch version.");
7478

75-
Ok(Version { major, minor, patch })
79+
Ok(Version {
80+
major,
81+
minor,
82+
patch,
83+
})
7684
}

crates/cubecl-hip-sys/build.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ fn check_rocm_version(rocm_path: impl AsRef<Path>) -> std::io::Result<bool> {
3333
let rocm_system_version = get_rocm_system_version(rocm_path)?;
3434
let rocm_feature_version = get_rocm_feature_version();
3535

36-
if rocm_system_version.major == rocm_feature_version.major {
37-
let mismatches = match (rocm_system_version.minor == rocm_feature_version.minor, rocm_system_version.patch == rocm_feature_version.patch) {
36+
if rocm_system_version.major == rocm_feature_version.major {
37+
let mismatches = match (
38+
rocm_system_version.minor == rocm_feature_version.minor,
39+
rocm_system_version.patch == rocm_feature_version.patch,
40+
) {
3841
// Perfect match, don't need a warning
3942
(true, true) => return Ok(true),
4043
(true, false) => "Patch",
@@ -59,7 +62,11 @@ fn get_rocm_feature_version() -> Version {
5962
parts[1].parse::<u8>(),
6063
parts[2].parse::<u32>(),
6164
) {
62-
return Version {major, minor, patch};
65+
return Version {
66+
major,
67+
minor,
68+
patch,
69+
};
6370
}
6471
}
6572
}
@@ -85,7 +92,6 @@ fn get_hip_feature_patch_version() -> u32 {
8592
}
8693

8794
fn main() {
88-
8995
println!("cargo::rerun-if-changed=build.rs");
9096
println!("cargo::rerun-if-env-changed=CUBECL_ROCM_PATH");
9197
println!("cargo::rerun-if-env-changed=ROCM_PATH");
@@ -110,11 +116,14 @@ fn main() {
110116

111117
if let Some(valid_rocm_path) = rocm_path {
112118
ensure_single_rocm_hip_feature_set();
113-
// verify HIP compatbility
114-
let Version {patch: hip_system_patch_version, ..} = get_hip_system_version(valid_rocm_path).unwrap();
119+
// verify HIP compatibility
120+
let Version {
121+
patch: hip_system_patch_version,
122+
..
123+
} = get_hip_system_version(valid_rocm_path).unwrap();
115124
let hip_feature_patch_version = get_hip_feature_patch_version();
116125
if hip_system_patch_version != hip_feature_patch_version {
117-
panic!("Imcompatible HIP bindings found. Expected to find HIP patch version {hip_feature_patch_version}, but found HIP patch version {hip_system_patch_version}.");
126+
panic!("Incompatible HIP bindings found. Expected to find HIP patch version {hip_feature_patch_version}, but found HIP patch version {hip_system_patch_version}.");
118127
}
119128

120129
println!("cargo::rustc-link-lib=dylib=hiprtc");
@@ -127,4 +136,3 @@ fn main() {
127136
panic!("HIP headers not found in any of the directories set in CUBECL_ROCM_PATH, ROCM_PATH or HIP_PATH environment variable.");
128137
}
129138
}
130-

0 commit comments

Comments
 (0)