From f3394cf7a536a486e42a73d33bdd46250ff2d5dc Mon Sep 17 00:00:00 2001 From: Ranjith Ramakrishnan Date: Wed, 12 Oct 2022 15:45:19 -0700 Subject: [PATCH] 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 --- hipamd/hip-config.cmake.in | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/hipamd/hip-config.cmake.in b/hipamd/hip-config.cmake.in index 89d1224ea4..0c2ab3d26a 100755 --- a/hipamd/hip-config.cmake.in +++ b/hipamd/hip-config.cmake.in @@ -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= - 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)