Skip to content

Commit c53953a

Browse files
authored
Merge pull request #1170 from jchlanda/jakub/hip_custom_dirs
[HIP] Allow custom location of ROCm components
2 parents 9f88cf8 + 66d52ac commit c53953a

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ List of options provided by CMake:
137137
| UR_ENABLE_COMGR | Enable comgr lib usage | AMD/NVIDIA | AMD |
138138
| UR_DPCXX | Path of the DPC++ compiler executable to build CTS device binaries | File path | `""` |
139139
| UR_SYCL_LIBRARY_DIR | Path of the SYCL runtime library directory to build CTS device binaries | Directory path | `""` |
140+
| UR_HIP_ROCM_DIR | Path of the default ROCm HIP installation | Directory path | `/opt/rocm` |
141+
| UR_HIP_INCLUDE_DIR | Path of the ROCm HIP include directory | Directory path | `${UR_HIP_ROCM_DIR}/include` |
142+
| UR_HIP_HSA_INCLUDE_DIRS | Path of the ROCm HSA include directory | Directory path | `${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include` |
143+
| UR_HIP_LIB_DIR | Path of the ROCm HIP library directory | Directory path | `${UR_HIP_ROCM_DIR}/lib` |
140144

141145
### Additional make targets
142146

source/adapters/hip/CMakeLists.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ set(UR_HIP_PLATFORM "AMD" CACHE STRING "UR HIP platform, AMD or NVIDIA")
1010

1111
# Set default ROCm installation directory
1212
set(UR_HIP_ROCM_DIR "/opt/rocm" CACHE STRING "ROCm installation dir")
13-
14-
set(UR_HIP_INCLUDE_DIR "${UR_HIP_ROCM_DIR}/include")
15-
13+
# Allow custom location of HIP/HSA include and HIP library directories
14+
set(UR_HIP_INCLUDE_DIR "${UR_HIP_ROCM_DIR}/include" CACHE PATH
15+
"Custom ROCm HIP include dir")
1616
set(UR_HIP_HSA_INCLUDE_DIRS
17-
"${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include")
18-
19-
# Set HIP lib dir
20-
set(UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR}/lib")
17+
"${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include" CACHE FILEPATH
18+
"Custom ROCm HSA include dir")
19+
set(UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR}/lib" CACHE PATH
20+
"Custom ROCm HIP library dir")
2121

2222
# Check if HIP library path exists (AMD platform only)
2323
if("${UR_HIP_PLATFORM}" STREQUAL "AMD")
@@ -31,7 +31,8 @@ if("${UR_HIP_PLATFORM}" STREQUAL "AMD")
3131
" please check ROCm installation.")
3232
endif()
3333

34-
# Check if HSA include path exists
34+
# Check if HSA include path exists. In rocm-6.0.0 the layout of HSA
35+
# directory has changed, check for the new location as well.
3536
foreach(D IN LISTS UR_HIP_HSA_INCLUDE_DIRS)
3637
if(EXISTS "${D}")
3738
set(UR_HIP_HSA_INCLUDE_DIR "${D}")

0 commit comments

Comments
 (0)