Skip to content

Commit

Permalink
Add support of ROCm 6. (#27)
Browse files Browse the repository at this point in the history
* Add support of ROCm 6.1.2 for Windows.

* Fix CI.

* Use llvm.sqrt.f64.
  • Loading branch information
lshqqytiger authored Jul 13, 2024
1 parent d23b3f4 commit d7714d8
Show file tree
Hide file tree
Showing 28 changed files with 11,385 additions and 8,257 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

env:
CARGO_TERM_COLOR: always
ROCM_VERSION: "5.7.3"
ROCM_VERSION: "6.1.3"

jobs:
build_lin:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
submodules: true
- name: Install AMD HIP SDK
run: |
C:\msys64\usr\bin\wget.exe https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-23.Q4-Win10-Win11-For-HIP.exe -O "amdgpu-install.exe"
C:\msys64\usr\bin\wget.exe https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-24.Q3-Win10-Win11-For-HIP.exe -O "amdgpu-install.exe"
.\amdgpu-install.exe -Install -View:1
Start-Sleep -Seconds 60
$setupId = (Get-Process ATISetup).id
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

env:
CARGO_TERM_COLOR: always
ROCM_VERSION: "5.7.3"
ROCM_VERSION: "6.1.3"

jobs:
release:
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
submodules: true
- name: Install AMD HIP SDK
run: |
C:\msys64\usr\bin\wget.exe https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-23.Q4-Win10-Win11-For-HIP.exe -O "amdgpu-install.exe"
C:\msys64\usr\bin\wget.exe https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-24.Q3-Win10-Win11-For-HIP.exe -O "amdgpu-install.exe"
.\amdgpu-install.exe -Install -View:1
Start-Sleep -Seconds 60
$setupId = (Get-Process ATISetup).id
Expand Down
2 changes: 1 addition & 1 deletion comgr/README
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bindgen .\include\amd_comgr.h --size_t-is-usize --must-use-type "amd_comgr_status_t" --no-layout-tests --no-derive-debug --default-enum-style=newtype --dynamic-loading LibComgr --dynamic-link-require-all -o src/amd_comgr.rs --whitelist-function="^amd_comgr_action_data_get_data$|^amd_comgr_action_info_set_isa_name$|^amd_comgr_action_info_set_option_list$|^amd_comgr_create_action_info$|^amd_comgr_create_data$|^amd_comgr_create_data_set$|^amd_comgr_data_set_add$|^amd_comgr_destroy_action_info$|^amd_comgr_destroy_data_set$|^amd_comgr_do_action$|^amd_comgr_get_data$|^amd_comgr_release_data$|^amd_comgr_set_data$|^amd_comgr_set_data_name$|^amd_comgr_action_info_set_language$|^amd_comgr_set_data_name$"
bindgen $Env:HIP_PATH/include/amd_comgr.h --must-use-type "amd_comgr_status_t" --no-layout-tests --no-derive-debug --default-enum-style=newtype --dynamic-loading LibComgr --dynamic-link-require-all -o src/amd_comgr.rs --allowlist-function="^amd_comgr_action_data_get_data$|^amd_comgr_action_info_set_isa_name$|^amd_comgr_action_info_set_option_list$|^amd_comgr_create_action_info$|^amd_comgr_create_data$|^amd_comgr_create_data_set$|^amd_comgr_data_set_add$|^amd_comgr_destroy_action_info$|^amd_comgr_destroy_data_set$|^amd_comgr_do_action$|^amd_comgr_get_data$|^amd_comgr_release_data$|^amd_comgr_set_data$|^amd_comgr_set_data_name$|^amd_comgr_action_info_set_language$|^amd_comgr_set_data_name$"
646 changes: 75 additions & 571 deletions comgr/src/amd_comgr.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion comgr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Comgr {

#[cfg(windows)]
unsafe fn load_library() -> std::result::Result<LibComgr, libloading::Error> {
LibComgr::new("amd_comgr.dll")
LibComgr::new("amd_comgr_2.dll")
}

#[cfg(not(windows))]
Expand Down
4 changes: 2 additions & 2 deletions hip_common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub enum CompilationMode {
impl CompilationMode {
pub unsafe fn from_device(device: i32) -> Result<CompilationMode, hipError_t> {
let mut device_props = mem::zeroed();
hip! { hipGetDeviceProperties(&mut device_props, device) };
hip! { hipGetDevicePropertiesR0600(&mut device_props, device) };
if device_props.warpSize == 32 {
Ok(CompilationMode::Wave32)
} else {
Expand All @@ -96,7 +96,7 @@ impl CompilationMode {

pub unsafe fn comgr_isa(device: i32) -> Result<CString, hipError_t> {
let mut device_props = mem::zeroed();
hip! { hipGetDeviceProperties(&mut device_props, device) };
hip! { hipGetDevicePropertiesR0600(&mut device_props, device) };
let gcn_arch = CStr::from_ptr(device_props.gcnArchName.as_ptr() as _);
let mut arch_name = b"amdgcn-amd-amdhsa--".to_vec();
arch_name.extend_from_slice(gcn_arch.to_bytes_with_nul());
Expand Down
2 changes: 1 addition & 1 deletion hip_runtime-sys/README
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bindgen include/hip_runtime_api.h -o src/hip_runtime_api.rs --no-layout-tests --size_t-is-usize --default-enum-style=newtype --whitelist-function "hip.*" --whitelist-type "hip.*" --no-derive-debug --must-use-type hipError_t --new-type-alias "^hipDeviceptr_t$" --whitelist-var "^hip.*$" -- -I/opt/rocm/include -D__HIP_PLATFORM_AMD__
bindgen $Env:HIP_PATH/include/hip/hip_runtime_api.h -o src/hip_runtime_api.rs --no-layout-tests --default-enum-style=newtype --allowlist-function "hip.*" --allowlist-type "hip.*" --no-derive-debug --must-use-type hipError_t --new-type-alias "^hipDeviceptr_t$" --allowlist-var "^hip.*$" -- -I"$Env:HIP_PATH/include" -D__HIP_PLATFORM_AMD__
2 changes: 1 addition & 1 deletion hip_runtime-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() -> Result<(), VarError> {
if cfg!(windows) {
let env = env::var("CARGO_CFG_TARGET_ENV")?;
if env == "msvc" {
let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
let mut path = PathBuf::from(env::var("HIP_PATH")?);
path.push("lib");
println!("cargo:rustc-link-search=native={}", path.display());
} else {
Expand Down
Loading

0 comments on commit d7714d8

Please sign in to comment.