Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make hip-lang-config.cmake.in more robust. #2776

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Make hip-lang-config.cmake.in more robust.
  • Loading branch information
ye-luo committed Jun 29, 2022
commit 2a78479b85569f2efc2c9a3d7bdfb1845a78cdab
25 changes: 15 additions & 10 deletions hip-lang-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ include( "${CMAKE_CURRENT_LIST_DIR}/hip-lang-targets.cmake" )
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH)


#need _IMPORT_PREFIX to be set #FILE_REORG_BACKWARD_COMPATIBILITY
file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "${_IMPORT_PREFIX}/../llvm/lib/clang/*/include")
file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "${_IMPORT_PREFIX}/llvm/lib/clang/*/include")
find_path(HIP_CLANG_INCLUDE_PATH __clang_cuda_math.h
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since __clang_cuda_math.h is used for device compilation.
isn't it better to have it following the compiler installation?

HINTS ${HIP_CLANG_INCLUDE_SEARCH_PATHS}
${HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG}
NO_DEFAULT_PATH)
get_filename_component(HIP_CLANG_INCLUDE_PATH "${HIP_CLANG_INCLUDE_PATH}" DIRECTORY)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line break case 1 CLANGRT_BUILTINS-NOTFOUND.
It removes "include" and make HIP_CLANG_INCLUDE_PATH just wrong and line 109 bad.
Thus removed.


#If HIP isnot installed under ROCm, need this to find HSA assuming HSA is under ROCm
if( DEFINED ENV{ROCM_PATH} )
set(ROCM_PATH "$ENV{ROCM_PATH}")
Expand All @@ -99,6 +89,21 @@ if (NOT HSA_HEADER)
endif()

get_filename_component(HIP_COMPILER_INSTALL_PATH ${CMAKE_HIP_COMPILER} DIRECTORY)
# locate device compilation include path HIP_CLANG_INCLUDE_PATH
# generic case
file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "${HIP_COMPILER_INSTALL_PATH}/../lib/clang/*/include")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should take care CMAKE_HIP_COMPILER

/usr/lib/aomp/bin/clang++
/soft/llvm/main-20220627/bin/clang++
/opt/rocm/llvm/bin/clang++

# <ROCM_PATH>/bin/amdclang++
file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "${HIP_COMPILER_INSTALL_PATH}/../llvm/lib/clang/*/include")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this one is unique for the soft link being used.

find_path(HIP_CLANG_INCLUDE_PATH __clang_cuda_math.h
HINTS ${HIP_CLANG_INCLUDE_SEARCH_PATHS}
${HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG}
NO_DEFAULT_PATH)

if (NOT HIP_CLANG_INCLUDE_PATH)
message (FATAL_ERROR "Incorrect HIP_CLANG_INCLUDE_PATH. __clang_cuda_math.h not found!")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early trap needed.

endif()

# locate device library CLANGRT_BUILTINS
file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${HIP_COMPILER_INSTALL_PATH}/../lib/clang/*/lib/*")
find_library(CLANGRT_BUILTINS
NAMES
Expand Down