@@ -10,13 +10,14 @@ set(UR_HIP_PLATFORM "AMD" CACHE STRING "UR HIP platform, AMD or NVIDIA")
1010
1111# Set default ROCm installation directory
1212set (UR_HIP_ROCM_DIR "/opt/rocm" CACHE STRING "ROCm installation dir" )
13-
14- set (UR_HIP_INCLUDE_DIR "${UR_HIP_ROCM_DIR} /include" )
15-
16- set (UR_HIP_HSA_INCLUDE_DIR "${UR_HIP_ROCM_DIR} /hsa/include" )
17-
18- # Set HIP lib dir
19- set (UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR} /lib" )
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" )
16+ set (UR_HIP_HSA_INCLUDE_DIRS
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" )
2021
2122# Check if HIP library path exists (AMD platform only)
2223if ("${UR_HIP_PLATFORM} " STREQUAL "AMD" )
@@ -30,10 +31,18 @@ if("${UR_HIP_PLATFORM}" STREQUAL "AMD")
3031 " please check ROCm installation." )
3132 endif ()
3233
33- # Check if HSA include path exists
34- if (NOT EXISTS "${UR_HIP_HSA_INCLUDE_DIR} " )
35- message (FATAL_ERROR "Couldn't find the HSA include directory at '${UR_HIP_HSA_INCLUDE_DIR} ',"
36- " please check ROCm installation." )
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.
36+ foreach (D IN LISTS UR_HIP_HSA_INCLUDE_DIRS)
37+ if (EXISTS "${D} " )
38+ set (UR_HIP_HSA_INCLUDE_DIR "${D} " )
39+ break ()
40+ endif ()
41+ endforeach ()
42+ if (NOT UR_HIP_HSA_INCLUDE_DIR)
43+ message (FATAL_ERROR "Couldn't find the HSA include directory in any of "
44+ "these paths: '${UR_HIP_HSA_INCLUDE_DIRS} '. Please check ROCm "
45+ "installation." )
3746 endif ()
3847endif ()
3948
0 commit comments