SWDEV-303745 - Add new path of clangrt lib (#2385)
Change-Id: I3bfe28ac5c50884653187d733a466e661ff32f7d
[ROCm/hip commit: 5d57c55c4a]
Šī revīzija ir iekļauta:
revīziju iesūtīja
GitHub
vecāks
3351c0a2f7
revīzija
c02f8be0ac
@@ -146,11 +146,15 @@ $setStdLib = 0; # TODO - set to 0
|
||||
$default_amdgpu_target = 1;
|
||||
|
||||
if ($HIP_PLATFORM eq "amd") {
|
||||
$HIPCC="\"$HIP_CLANG_PATH/clang++\"";
|
||||
$execExtension = "";
|
||||
if($isWindows) {
|
||||
$execExtension = ".exe";
|
||||
}
|
||||
$HIPCC="$HIP_CLANG_PATH/clang++" . $execExtension;
|
||||
|
||||
# If $HIPCC clang++ is not compiled, use clang instead
|
||||
if ( ! -e $HIPCC ) {
|
||||
$HIPCC="\"$HIP_CLANG_PATH/clang\"";
|
||||
$HIPCC="$HIP_CLANG_PATH/clang" . $execExtension;
|
||||
$HIPLDFLAGS = "--driver-mode=g++";
|
||||
}
|
||||
|
||||
@@ -158,6 +162,9 @@ if ($HIP_PLATFORM eq "amd") {
|
||||
$HIP_CLANG_VERSION=~/.*clang version (\S+).*/;
|
||||
$HIP_CLANG_VERSION=$1;
|
||||
|
||||
# Figure out the target with which llvm is configured
|
||||
$HIP_CLANG_TARGET = `$HIPCC -print-target-triple`;
|
||||
|
||||
if (! defined $HIP_CLANG_INCLUDE_PATH) {
|
||||
$HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include");
|
||||
}
|
||||
@@ -177,6 +184,7 @@ if ($HIP_PLATFORM eq "amd") {
|
||||
print ("HIP_INCLUDE_PATH=$HIP_INCLUDE_PATH\n");
|
||||
print ("HIP_LIB_PATH=$HIP_LIB_PATH\n");
|
||||
print ("DEVICE_LIB_PATH=$DEVICE_LIB_PATH\n");
|
||||
print ("HIP_CLANG_TARGET=$HIP_CLANG_TARGET\n");
|
||||
}
|
||||
|
||||
if ($isWindows) {
|
||||
@@ -711,7 +719,12 @@ if ($HIP_PLATFORM eq "amd") {
|
||||
$toolArgs = " -Wl,--enable-new-dtags -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 " . ${toolArgs};
|
||||
}
|
||||
# To support __fp16 and _Float16, explicitly link with compiler-rt
|
||||
$toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/linux -lclang_rt.builtins-x86_64 "
|
||||
$HIP_CLANG_BUILTIN_LIB="$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a";
|
||||
if (-e $HIP_CLANG_BUILTIN_LIB) {
|
||||
$toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET -lclang_rt.builtins "
|
||||
} else {
|
||||
$toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/linux -lclang_rt.builtins-x86_64 "
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,15 @@ if (HSA_HEADER-NOTFOUND)
|
||||
message (FATAL_ERROR "HSA header not found! ROCM_PATH environment not set")
|
||||
endif()
|
||||
|
||||
file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${CMAKE_HIP_COMPILER}/../lib/clang/*/lib/*")
|
||||
find_library(CLANGRT_BUILTINS
|
||||
NAMES
|
||||
clang_rt.builtins
|
||||
clang_rt.builtins-x86_64
|
||||
PATHS
|
||||
${HIP_CLANGRT_LIB_SEARCH_PATHS}
|
||||
${HIP_CLANG_INCLUDE_PATH}/../lib/linux)
|
||||
|
||||
set_target_properties(hip-lang::device PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "$<$<COMPILE_LANGUAGE:HIP>:${_IMPORT_PREFIX}/../include;${HIP_CLANG_INCLUDE_PATH}>"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "$<$<COMPILE_LANGUAGE:HIP>:${_IMPORT_PREFIX}/../include;${HIP_CLANG_INCLUDE_PATH}>"
|
||||
@@ -123,9 +132,13 @@ set_property(TARGET hip-lang::device APPEND PROPERTY
|
||||
)
|
||||
|
||||
# Add support for __fp16 and _Float16, explicitly link with compiler-rt
|
||||
set_property(TARGET hip-lang::device APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES "$<$<LINK_LANGUAGE:HIP>:${HIP_CLANG_INCLUDE_PATH}/lib/linux/libclang_rt.builtins-x86_64.a>"
|
||||
)
|
||||
if(CLANGRT_BUILTINS-NOTFOUND)
|
||||
message(FATAL_ERROR "clangrt builtins lib not found")
|
||||
else()
|
||||
set_property(TARGET hip-lang::device APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES "$<$<LINK_LANGUAGE:HIP>:${CLANGRT_BUILTINS}>"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Approved by CMake to use this name. This is used so that HIP can
|
||||
# change the name of the target and not require any modifications in CMake
|
||||
|
||||
Atsaukties uz šo jaunā problēmā
Block a user