Skip to content

Commit 17835bc

Browse files
committed
merge main into amd-stg-open
Change-Id: I47487c3cb3caadcd82a2601c6010e76377f71383
2 parents f624294 + db96a9c commit 17835bc

File tree

21 files changed

+102
-13
lines changed

21 files changed

+102
-13
lines changed

openmp/libomptarget/plugins-nextgen/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
4747

4848
LINK_LIBS
4949
PRIVATE
50-
PluginInterface
50+
PluginCommon
5151
${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
5252
${OPENMP_PTHREAD_LIB}
5353

openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ add_llvm_library(omptarget.rtl.amdgpu SHARED
9797
LINK_LIBS
9898
PRIVATE
9999
OMPT
100-
PluginInterface
100+
PluginCommon
101101
${LIBOMPTARGET_DEP_LIBRARIES}
102102
${OPENMP_PTHREAD_LIB}
103103
-Wl,--whole-archive amdgcn_hostexec_services -Wl,--no-whole-archive

openmp/libomptarget/plugins-nextgen/amdgpu/dynamic_hsa/hsa.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include "Shared/Debug.h"
1717

18-
#include "dlwrap.h"
18+
#include "DLWrap.h"
1919
#include "hsa.h"
2020
#include "hsa_ext_amd.h"
2121
#include <memory>

openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
using namespace llvm::ELF;
3030

31-
#include "Utils/ELF.h"
31+
#include "ELF.h"
3232

3333
namespace llvm {
3434
namespace omp {

openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,94 @@
1010
#
1111
##===----------------------------------------------------------------------===##
1212

13+
# NOTE: Don't try to build `PluginInterface` using `add_llvm_library` because we
14+
# don't want to export `PluginInterface` while `add_llvm_library` requires that.
15+
add_library(PluginCommon OBJECT
16+
src/PluginInterface.cpp
17+
src/GlobalHandler.cpp
18+
src/JIT.cpp
19+
src/RPC.cpp
20+
src/Utils/ELF.cpp
21+
)
22+
23+
# Only enable JIT for those targets that LLVM can support.
24+
string(TOUPPER "${LLVM_TARGETS_TO_BUILD}" TargetsSupported)
25+
foreach(Target ${TargetsSupported})
26+
target_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${Target}")
27+
endforeach()
28+
29+
# This is required when using LLVM libraries.
30+
llvm_update_compile_flags(PluginCommon)
31+
32+
if (LLVM_LINK_LLVM_DYLIB)
33+
set(llvm_libs LLVM)
34+
else()
35+
llvm_map_components_to_libnames(llvm_libs
36+
${LLVM_TARGETS_TO_BUILD}
37+
AggressiveInstCombine
38+
Analysis
39+
BinaryFormat
40+
BitReader
41+
BitWriter
42+
CodeGen
43+
Core
44+
Extensions
45+
InstCombine
46+
Instrumentation
47+
IPO
48+
IRReader
49+
Linker
50+
MC
51+
Object
52+
Passes
53+
Remarks
54+
ScalarOpts
55+
Support
56+
Target
57+
TargetParser
58+
TransformUtils
59+
Vectorize
60+
)
61+
endif()
62+
63+
target_link_libraries(PluginCommon
64+
PUBLIC
65+
${llvm_libs}
66+
)
67+
68+
# Include the RPC server from the `libc` project if availible.
69+
if(TARGET llvmlibc_rpc_server AND ${LIBOMPTARGET_GPU_LIBC_SUPPORT})
70+
target_link_libraries(PluginCommon PRIVATE llvmlibc_rpc_server)
71+
target_compile_definitions(PluginCommon PRIVATE LIBOMPTARGET_RPC_SUPPORT)
72+
elseif(${LIBOMPTARGET_GPU_LIBC_SUPPORT})
73+
find_library(llvmlibc_rpc_server NAMES llvmlibc_rpc_server
74+
PATHS ${LIBOMPTARGET_LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
75+
if(llvmlibc_rpc_server)
76+
target_link_libraries(PluginCommon PRIVATE llvmlibc_rpc_server)
77+
target_compile_definitions(PluginCommon PRIVATE LIBOMPTARGET_RPC_SUPPORT)
78+
endif()
79+
endif()
80+
81+
if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
82+
target_link_libraries(PluginCommon PUBLIC OMPT)
83+
endif()
84+
85+
# Define the TARGET_NAME and DEBUG_PREFIX.
86+
target_compile_definitions(PluginCommon PRIVATE
87+
TARGET_NAME="PluginInterface"
88+
DEBUG_PREFIX="PluginInterface"
89+
)
90+
91+
target_include_directories(PluginCommon
92+
PRIVATE
93+
${LIBOMPTARGET_INCLUDE_DIR}
94+
PUBLIC
95+
${CMAKE_CURRENT_SOURCE_DIR}/include
96+
)
97+
98+
set_target_properties(PluginCommon PROPERTIES
99+
POSITION_INDEPENDENT_CODE ON
100+
CXX_VISIBILITY_PRESET protected)
101+
13102
add_subdirectory(OMPT)
14-
add_subdirectory(PluginInterface)
103+

openmp/libomptarget/include/dlwrap.h renamed to openmp/libomptarget/plugins-nextgen/common/include/DLWrap.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===------- dlwrap.h - Convenience wrapper around dlopen/dlsym -- C++ -*-===//
1+
//===-- Shared/DLWrap.h - Convenience wrapper for dlopen/dlsym --*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -38,8 +38,8 @@
3838
//
3939
//===----------------------------------------------------------------------===//
4040

41-
#ifndef DLWRAP_H_INCLUDED
42-
#define DLWRAP_H_INCLUDED
41+
#ifndef OMPTARGET_SHARED_DLWRAP_H
42+
#define OMPTARGET_SHARED_DLWRAP_H
4343

4444
#include <array>
4545
#include <cstddef>
@@ -283,4 +283,4 @@ template <size_t Requested, size_t Required> constexpr void verboseAssert() {
283283
x9, x10); \
284284
}
285285

286-
#endif
286+
#endif // OMPTARGET_SHARED_DLWRAP_H

openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp renamed to openmp/libomptarget/plugins-nextgen/common/src/GlobalHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include "GlobalHandler.h"
1414
#include "PluginInterface.h"
15-
#include "Utils/ELF.h"
15+
#include "ELF.h"
1616

1717
#include "Shared/Utils.h"
1818

openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp renamed to openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include "GlobalHandler.h"
1717
#include "JIT.h"
18-
#include "Utils/ELF.h"
18+
#include "ELF.h"
1919
#include "omptarget.h"
2020
#include "omptargetplugin.h"
2121
#include "print_tracing.h"

openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ add_llvm_library(omptarget.rtl.cuda SHARED
3535

3636
LINK_LIBS PRIVATE
3737
OMPT
38-
PluginInterface
38+
PluginCommon
3939
${OPENMP_PTHREAD_LIB}
4040

4141
NO_INSTALL_RPATH

openmp/libomptarget/plugins-nextgen/cuda/dynamic_cuda/cuda.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
#include "Shared/Debug.h"
1717

18+
#include "DLWrap.h"
1819
#include "cuda.h"
19-
#include "dlwrap.h"
2020

2121
#include <memory>
2222
#include <string>

0 commit comments

Comments
 (0)