[ROCm] Replace HIP_PATH with ROCM_PATH for rocm 6.0

This commit is contained in:
Ioannis Assiouras 2023-10-16 20:56:35 +00:00 committed by Antonio Sánchez
parent 5bdf58b8df
commit d9839718aa
2 changed files with 71 additions and 66 deletions

View File

@ -446,15 +446,20 @@ endif()
option(EIGEN_TEST_HIP "Add HIP support." OFF)
if (EIGEN_TEST_HIP)
set(HIP_PATH "/opt/rocm/hip" CACHE STRING "Path to the HIP installation.")
if (EXISTS ${HIP_PATH})
set(ROCM_PATH "/opt/rocm" CACHE STRING "Path to the ROCm installation.")
if (EXISTS ${ROCM_PATH}/hip)
set(HIP_PATH ${ROCM_PATH}/hip)
list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/cmake)
elseif (EXISTS ${ROCM_PATH}/lib/cmake/hip)
set(HIP_PATH ${ROCM_PATH})
list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/lib/cmake/hip)
else ()
message(FATAL_ERROR "EIGEN_TEST_HIP is ON, but could not find the ROCm installation under ${ROCM_PATH}")
endif()
find_package(HIP REQUIRED)
if (HIP_FOUND)
execute_process(COMMAND ${HIP_PATH}/bin/hipconfig --platform OUTPUT_VARIABLE HIP_PLATFORM)
if ((${HIP_PLATFORM} STREQUAL "hcc") OR (${HIP_PLATFORM} STREQUAL "amd"))
@ -472,9 +477,6 @@ if (EIGEN_TEST_HIP)
message(FATAL_ERROR "Unknown HIP_PLATFORM = ${HIP_PLATFORM}")
endif()
endif()
else ()
message(FATAL_ERROR "EIGEN_TEST_HIP is ON, but the specified HIP_PATH (${HIP_PATH}) does not exist")
endif()
endif()
if(EIGEN_TEST_SYCL)

View File

@ -287,10 +287,17 @@ endif()
# Add HIP specific tests
if (EIGEN_TEST_HIP)
set(HIP_PATH "/opt/rocm/hip" CACHE STRING "Path to the HIP installation.")
set(ROCM_PATH "/opt/rocm" CACHE STRING "Path to the ROCm installation.")
if (EXISTS ${HIP_PATH})
if (EXISTS ${ROCM_PATH}/hip)
set(HIP_PATH ${ROCM_PATH}/hip)
list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/cmake)
elseif (EXISTS ${ROCM_PATH}/lib/cmake/hip)
set(HIP_PATH ${ROCM_PATH})
list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/lib/cmake/hip)
else ()
message(FATAL_ERROR "EIGEN_TEST_HIP is ON, but could not find the ROCm installation under ${ROCM_PATH}")
endif()
find_package(HIP REQUIRED)
if (HIP_FOUND)
@ -328,8 +335,4 @@ if (EIGEN_TEST_HIP)
message(FATAL_ERROR "Unknown HIP_PLATFORM = ${HIP_PLATFORM}")
endif()
endif()
else ()
message(FATAL_ERROR "EIGEN_TEST_HIP is ON, but the specified HIP_PATH (${HIP_PATH}) does not exist")
endif()
endif()