-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Libomptarget] Consolidate CPU offloading into 'host' directory #86014
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
return() | ||
endif() | ||
|
||
# build_generic_elf64("s390x" "S390X" "s390x" "systemz" "s390x-ibm-linux-gnu" "22") | ||
# build_generic_elf64("aarch64" "aarch64" "aarch64" "aarch64" "aarch64-unknown-linux-gnu" "183") | ||
# build_generic_elf64("ppc64" "PPC64" "ppc64" "ppc64" "powerpc64-ibm-linux-gnu" "21") | ||
# build_generic_elf64("x86_64" "x86_64" "x86_64" "x86_64" "x86_64-pc-linux-gnu" "62") | ||
# build_generic_elf64("ppc64le" "PPC64le" "ppc64" "ppc64le" "powerpc64le-ibm-linux-gnu" "21") | ||
set(supported_targets x86_64 aarch64 ppc64 ppc64le s390x) | ||
if(NOT ${CMAKE_SYSTEM_PROCESSOR} IN_LIST supported_targets) | ||
libomptarget_say("Not building ${machine} NextGen offloading plugin") | ||
return() | ||
endif() | ||
|
||
set(machine ${CMAKE_SYSTEM_PROCESSOR}) | ||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le$") | ||
set(machine ppc64) | ||
endif() | ||
|
||
add_llvm_library(omptarget.rtl.${machine} SHARED | ||
src/rtl.cpp | ||
ADDITIONAL_HEADER_DIRS | ||
${LIBOMPTARGET_INCLUDE_DIR} | ||
LINK_LIBS PRIVATE | ||
PluginCommon | ||
${OPENMP_PTHREAD_LIB} | ||
NO_INSTALL_RPATH | ||
BUILDTREE_ONLY | ||
) | ||
|
||
if(LIBOMPTARGET_DEP_LIBFFI_FOUND) | ||
libomptarget_say("Building ${machine} plugin linked with libffi") | ||
if(FFI_STATIC_LIBRARIES) | ||
target_link_libraries(omptarget.rtl.${machine} PRIVATE FFI::ffi_static) | ||
else() | ||
target_link_libraries(omptarget.rtl.${machine} PRIVATE FFI::ffi) | ||
endif() | ||
else() | ||
libomptarget_say("Building ${machine} plugin for dlopened libffi") | ||
target_sources(omptarget.rtl.${machine} PRIVATE dynamic_ffi/ffi.cpp) | ||
target_include_directories(omptarget.rtl.${machine} PRIVATE dynamic_ffi) | ||
endif() | ||
|
||
if(OMPT_TARGET_DEFAULT AND LIBOMPTARGET_OMPT_SUPPORT) | ||
target_link_libraries(omptarget.rtl.${machine} PRIVATE OMPT) | ||
endif() | ||
|
||
if(LIBOMP_HAVE_VERSION_SCRIPT_FLAG) | ||
target_link_libraries(omptarget.rtl.${machine} PRIVATE | ||
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports") | ||
endif() | ||
|
||
# Install plugin under the lib destination folder. | ||
install(TARGETS omptarget.rtl.${machine} | ||
LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}") | ||
set_target_properties(omptarget.rtl.${machine} PROPERTIES | ||
INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/.." | ||
POSITION_INDEPENDENT_CODE ON | ||
CXX_VISIBILITY_PRESET protected) | ||
|
||
target_include_directories(omptarget.rtl.${machine} PRIVATE | ||
${LIBOMPTARGET_INCLUDE_DIR}) | ||
|
||
if(LIBOMPTARGET_DEP_LIBFFI_FOUND) | ||
list(APPEND LIBOMPTARGET_TESTED_PLUGINS omptarget.rtl.${machine}) | ||
set(LIBOMPTARGET_TESTED_PLUGINS | ||
"${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE) | ||
else() | ||
libomptarget_say("Not generating ${tmachine_name} tests. LibFFI not found.") | ||
endif() | ||
|
||
# Define macro to be used as prefix of the runtime messages for this target. | ||
target_compile_definitions(omptarget.rtl.${machine} PRIVATE TARGET_NAME=${machine}) | ||
# TODO: This should be automatized in Debug.h. | ||
target_compile_definitions(omptarget.rtl.${machine} PRIVATE | ||
DEBUG_PREFIX="TARGET ${machine} RTL") | ||
|
||
# Define the target specific triples and ELF machine values. | ||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le$" OR | ||
CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64$") | ||
target_compile_definitions(omptarget.rtl.${machine} PRIVATE TARGET_ELF_ID=EM_PPC64) | ||
target_compile_definitions(omptarget.rtl.${machine} PRIVATE | ||
LIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE="powerpc64-ibm-linux-gnu") | ||
list(APPEND LIBOMPTARGET_SYSTEM_TARGETS | ||
"powerpc64-ibm-linux-gnu" "powerpc64-ibm-linux-gnu-LTO") | ||
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) | ||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64$") | ||
target_compile_definitions(omptarget.rtl.${machine} PRIVATE TARGET_ELF_ID=EM_X86_64) | ||
target_compile_definitions(omptarget.rtl.${machine} PRIVATE | ||
LIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE="x86_64-pc-linux-gnu") | ||
list(APPEND LIBOMPTARGET_SYSTEM_TARGETS | ||
"x86_64-pc-linux-gnu" "x86_64-pc-linux-gnu-LTO") | ||
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) | ||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64$") | ||
target_compile_definitions(omptarget.rtl.${machine} PRIVATE TARGET_ELF_ID=EM_AARCH64) | ||
target_compile_definitions(omptarget.rtl.${machine} PRIVATE | ||
LIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE="aarch64-unknown-linux-gnu") | ||
list(APPEND LIBOMPTARGET_SYSTEM_TARGETS | ||
"aarch64-unknown-linux-gnu" "aarch64-unknown-linux-gnu-LTO") | ||
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) | ||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x$") | ||
target_compile_definitions(omptarget.rtl.${machine} TARGET_ELF_ID=EM_S390) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a missing "PRIVATE" on this line, which caused the build to break on SystemZ. Fixed in cb07194. |
||
target_compile_definitions(omptarget.rtl.${machine} PRIVATE | ||
LIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE="s390x-ibm-linux-gnu") | ||
list(APPEND LIBOMPTARGET_SYSTEM_TARGETS | ||
"s390x-ibm-linux-gnu" "s390x-ibm-linux-gnu-LTO") | ||
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) | ||
endif() |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect, because it is specifying a big-endian triple (powerpc64-ibm-linux-gnu) when the host is little-endian (ppc64le). The ppc64le and ppc64 $CMAKE_SYSTEM_PROCESSOR values need to be handled separately.
cc @tuliom
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tstellar Agreed. It's worth mentioning that using
powerpc64le
in triples is more frequent thanppc64le
.This is the first time I see
-ibm
being used for appc64*-linux
system.Is the usage of
-ibm
really necessary? And what it means?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made #88773. Using the vendor field doesn't really do anything for these triples. It's the same as
x86_64-pc-linux-gnu
which doesn't make a difference except for runtime directory stuff.