File tree Expand file tree Collapse file tree 3 files changed +26
-11
lines changed Expand file tree Collapse file tree 3 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -110,10 +110,6 @@ set(LIBOMPTARGET_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
110
110
message (STATUS "OpenMP tools dir in libomptarget: ${LIBOMP_OMP_TOOLS_INCLUDE_DIR} " )
111
111
include_directories (${LIBOMP_OMP_TOOLS_INCLUDE_DIR} )
112
112
113
- # Build target agnostic offloading library.
114
- set (LIBOMPTARGET_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} /src )
115
- add_subdirectory (${LIBOMPTARGET_SRC_DIR} )
116
-
117
113
# Definitions for testing, for reuse when testing libomptarget-nvptx.
118
114
set (LIBOMPTARGET_OPENMP_HEADER_FOLDER "${LIBOMP_INCLUDE_DIR} " CACHE STRING
119
115
"Path to folder containing omp.h" )
@@ -129,5 +125,9 @@ add_subdirectory(plugins-nextgen)
129
125
add_subdirectory (DeviceRTL )
130
126
add_subdirectory (tools )
131
127
128
+ # Build target agnostic offloading library.
129
+ set (LIBOMPTARGET_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} /src )
130
+ add_subdirectory (${LIBOMPTARGET_SRC_DIR} )
131
+
132
132
# Add tests.
133
133
add_subdirectory (test )
Original file line number Diff line number Diff line change @@ -55,6 +55,27 @@ target_compile_definitions(omptarget PRIVATE
55
55
DEBUG_PREFIX= "omptarget"
56
56
)
57
57
58
+ macro (check_plugin_target target )
59
+ if (TARGET omptarget.rtl.${target} )
60
+ list (APPEND LIBOMPTARGET_PLUGINS_TO_LOAD ${target} )
61
+ endif ()
62
+ endmacro ()
63
+
64
+ set (LIBOMPTARGET_PLUGINS_TO_LOAD "" CACHE STRING
65
+ "Comma separated list of plugin names to look for at runtime" )
66
+ if (NOT LIBOMPTARGET_PLUGINS_TO_LOAD )
67
+ check_plugin_target (ppc64 )
68
+ check_plugin_target (x86_64 )
69
+ check_plugin_target (cuda )
70
+ check_plugin_target (aarch64 )
71
+ check_plugin_target (amdgpu )
72
+ endif ()
73
+
74
+ list (TRANSFORM LIBOMPTARGET_PLUGINS_TO_LOAD PREPEND "\" libomptarget.rtl." )
75
+ list (TRANSFORM LIBOMPTARGET_PLUGINS_TO_LOAD APPEND "\" " )
76
+ list (JOIN LIBOMPTARGET_PLUGINS_TO_LOAD "," ENABLED_OFFLOAD_PLUGINS )
77
+ target_compile_definitions (omptarget PRIVATE ENABLED_OFFLOAD_PLUGINS=${ENABLED_OFFLOAD_PLUGINS} )
78
+
58
79
# libomptarget.so needs to be aware of where the plugins live as they
59
80
# are now separated in the build directory.
60
81
set_target_properties (omptarget PROPERTIES
Original file line number Diff line number Diff line change @@ -23,13 +23,7 @@ using namespace llvm::sys;
23
23
PluginManager *PM;
24
24
25
25
// List of all plugins that can support offloading.
26
- static const char *RTLNames[] = {
27
- /* PowerPC target */ " libomptarget.rtl.ppc64" ,
28
- /* x86_64 target */ " libomptarget.rtl.x86_64" ,
29
- /* CUDA target */ " libomptarget.rtl.cuda" ,
30
- /* AArch64 target */ " libomptarget.rtl.aarch64" ,
31
- /* AMDGPU target */ " libomptarget.rtl.amdgpu" ,
32
- };
26
+ static const char *RTLNames[] = {ENABLED_OFFLOAD_PLUGINS};
33
27
34
28
Expected<std::unique_ptr<PluginAdaptorTy>>
35
29
PluginAdaptorTy::create (const std::string &Name) {
You can’t perform that action at this time.
0 commit comments