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

Conversation

ye-luo
Copy link

@ye-luo ye-luo commented Jun 29, 2022

Still need to address #2433
Make the following two cases work with https://github.com/ye-luo/cmake_gpu/tree/master/test_rocm

Case 1.

cmake -DCMAKE_HIP_COMPILER=/opt/rocm/bin/amdclang++ ..

Case 2 AOMP or upstream clang doesn't use ROCm layout.

cmake -DCMAKE_HIP_COMPILER=/usr/lib/aomp/bin/clang++ ..
cmake -DCMAKE_HIP_COMPILER=/soft/llvm/main-20220627/bin/clang++ ..

#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.

@@ -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++

# generic case
file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "${HIP_COMPILER_INSTALL_PATH}/../lib/clang/*/include")
# <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.

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.

@ye-luo
Copy link
Author

ye-luo commented Nov 28, 2022

#3065 keeps doing in the wrong way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant