Skip to content

Commit

Permalink
Merge pull request #1170 from jchlanda/jakub/hip_custom_dirs
Browse files Browse the repository at this point in the history
[HIP] Allow custom location of ROCm components
  • Loading branch information
kbenzie committed Jan 10, 2024
2 parents 9f88cf8 + 66d52ac commit c53953a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ List of options provided by CMake:
| UR_ENABLE_COMGR | Enable comgr lib usage | AMD/NVIDIA | AMD |
| UR_DPCXX | Path of the DPC++ compiler executable to build CTS device binaries | File path | `""` |
| UR_SYCL_LIBRARY_DIR | Path of the SYCL runtime library directory to build CTS device binaries | Directory path | `""` |
| UR_HIP_ROCM_DIR | Path of the default ROCm HIP installation | Directory path | `/opt/rocm` |
| UR_HIP_INCLUDE_DIR | Path of the ROCm HIP include directory | Directory path | `${UR_HIP_ROCM_DIR}/include` |
| 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` |
| UR_HIP_LIB_DIR | Path of the ROCm HIP library directory | Directory path | `${UR_HIP_ROCM_DIR}/lib` |

### Additional make targets

Expand Down
17 changes: 9 additions & 8 deletions source/adapters/hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ set(UR_HIP_PLATFORM "AMD" CACHE STRING "UR HIP platform, AMD or NVIDIA")

# Set default ROCm installation directory
set(UR_HIP_ROCM_DIR "/opt/rocm" CACHE STRING "ROCm installation dir")

set(UR_HIP_INCLUDE_DIR "${UR_HIP_ROCM_DIR}/include")

# Allow custom location of HIP/HSA include and HIP library directories
set(UR_HIP_INCLUDE_DIR "${UR_HIP_ROCM_DIR}/include" CACHE PATH
"Custom ROCm HIP include dir")
set(UR_HIP_HSA_INCLUDE_DIRS
"${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include")

# Set HIP lib dir
set(UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR}/lib")
"${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include" CACHE FILEPATH
"Custom ROCm HSA include dir")
set(UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR}/lib" CACHE PATH
"Custom ROCm HIP library dir")

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

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

0 comments on commit c53953a

Please sign in to comment.