2
0

SWDEV-345870 - Correct HIP path for new directory layout

With file reorganization changes HIP is installed in /opt/rocm-ver
Using HIP path as /opt/rocm-ver/hip will generate warnings
Use real path with symlinks resolved, so that HIP path always points to the installed path
Removed redundant code for finding hsa header files. find_dependency to hsa-runtime should handle hsa dependency

Change-Id: Iccea3c1c7297c705244bf752f38fbff71929d64c
Este cometimento está contido em:
Ranjith Ramakrishnan
2022-10-12 15:45:19 -07:00
ascendente d7b27989b4
cometimento f3394cf7a5
+7 -21
Ver ficheiro
@@ -197,25 +197,11 @@ if(NOT WIN32)
find_dependency(Threads)
endif()
# From hip config directory, do three level up
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH)
# Windows doesn't need HSA
if(NOT WIN32)
#if HSA is not under ROCm then provide CMAKE_PREFIX_PATH=<HSA_PATH>
find_path(HSA_HEADER hsa/hsa.h
PATHS
"${_IMPORT_PREFIX}/include"
#FILE_REORG_BACKWARD_COMPATIBILITY ${_IMPORT_PREFIX}/../include is for Backward compatibility
"${_IMPORT_PREFIX}/../include"
${ROCM_PATH}/include
)
if (NOT HSA_HEADER)
message (FATAL_ERROR "HSA header not found! ROCM_PATH environment not set")
endif()
endif()
# Find the real path to hip-config file with symlinks resolved
# Real Path : /opt/rocm-ver/lib/cmake/hip/hip-config.cmake
# Go up 4 levels to get /opt/rocm-ver
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" REALPATH)
get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../../" ABSOLUTE)
# Right now this is only supported for amd platforms
set_target_properties(hip::host PROPERTIES
@@ -224,8 +210,8 @@ set_target_properties(hip::host PROPERTIES
if(HIP_RUNTIME MATCHES "rocclr")
set_target_properties(hip::amdhip64 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${HSA_HEADER}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${HSA_HEADER}"
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)
get_target_property(amdhip64_type hip::amdhip64 TYPE)