Skip to content

Commit 9300b6d

Browse files
committed
[OpenMP][OMPT] Add OMPT support for generic-elf-64bit plugin
Fixes: llvm#64487 Connect OMPT during plugin initialization and enable corresponding tests. Avoid linking OMPT when corresponding support is disabled. Depends on D158542 Reviewed By: tianshilei1992 Differential Revision: https://reviews.llvm.org/D158543
1 parent e7294db commit 9300b6d

File tree

10 files changed

+12
-26
lines changed

10 files changed

+12
-26
lines changed

openmp/libomptarget/plugins-nextgen/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,17 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
4949
PRIVATE
5050
elf_common
5151
MemoryManager
52-
OMPT
5352
PluginInterface
5453
${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
5554
${OPENMP_PTHREAD_LIB}
5655

5756
NO_INSTALL_RPATH
5857
)
5958

59+
if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
60+
target_link_libraries("omptarget.rtl.${tmachine_libname}" PRIVATE OMPT)
61+
endif()
62+
6063
if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
6164
target_link_libraries("omptarget.rtl.${tmachine_libname}" PRIVATE
6265
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")

openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "Debug.h"
2020
#include "Environment.h"
2121
#include "GlobalHandler.h"
22+
#include "OmptCallback.h"
2223
#include "PluginInterface.h"
2324
#include "omptarget.h"
2425

@@ -378,7 +379,13 @@ struct GenELF64PluginTy final : public GenericPluginTy {
378379
GenELF64PluginTy(GenELF64PluginTy &&) = delete;
379380

380381
/// Initialize the plugin and return the number of devices.
381-
Expected<int32_t> initImpl() override { return NUM_DEVICES; }
382+
Expected<int32_t> initImpl() override {
383+
#ifdef OMPT_SUPPORT
384+
ompt::connectLibrary();
385+
#endif
386+
387+
return NUM_DEVICES;
388+
}
382389

383390
/// Deinitialize the plugin.
384391
Error deinitImpl() override { return Plugin::success(); }

openmp/libomptarget/test/ompt/veccopy.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// REQUIRES: ompt
33
// UNSUPPORTED: aarch64-unknown-linux-gnu
44
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
5-
// UNSUPPORTED: x86_64-pc-linux-gnu
6-
// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
7-
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
85

96
/*
107
* Example OpenMP program that registers non-EMI callbacks

openmp/libomptarget/test/ompt/veccopy_data.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// REQUIRES: ompt
33
// UNSUPPORTED: aarch64-unknown-linux-gnu
44
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
5-
// UNSUPPORTED: x86_64-pc-linux-gnu
6-
// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
7-
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
85

96
/*
107
* Example OpenMP program that registers EMI callbacks.

openmp/libomptarget/test/ompt/veccopy_disallow_both.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// REQUIRES: ompt
33
// UNSUPPORTED: aarch64-unknown-linux-gnu
44
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
5-
// UNSUPPORTED: x86_64-pc-linux-gnu
6-
// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
7-
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
85

96
/*
107
* Example OpenMP program that shows that both EMI and non-EMI

openmp/libomptarget/test/ompt/veccopy_emi.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// REQUIRES: ompt
33
// UNSUPPORTED: aarch64-unknown-linux-gnu
44
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
5-
// UNSUPPORTED: x86_64-pc-linux-gnu
6-
// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
7-
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
85

96
/*
107
* Example OpenMP program that registers EMI callbacks

openmp/libomptarget/test/ompt/veccopy_emi_map.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// REQUIRES: ompt
33
// UNSUPPORTED: aarch64-unknown-linux-gnu
44
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
5-
// UNSUPPORTED: x86_64-pc-linux-gnu
6-
// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
7-
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
85

96
/*
107
* Example OpenMP program that shows that map-EMI callbacks are not supported.

openmp/libomptarget/test/ompt/veccopy_map.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// REQUIRES: ompt
33
// UNSUPPORTED: aarch64-unknown-linux-gnu
44
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
5-
// UNSUPPORTED: x86_64-pc-linux-gnu
6-
// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
7-
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
85

96
/*
107
* Example OpenMP program that shows that map callbacks are not supported.

openmp/libomptarget/test/ompt/veccopy_no_device_init.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// RUN: %libomptarget-compile-run-and-check-generic
22
// REQUIRES: ompt
3-
// UNSUPPORTED: x86_64-pc-linux-gnu
4-
// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
5-
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
63

74
/*
85
* Example OpenMP program that shows that if no device init callback

openmp/libomptarget/test/ompt/veccopy_wrong_return.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// RUN: %libomptarget-compile-run-and-check-generic
22
// REQUIRES: ompt
3-
// UNSUPPORTED: x86_64-pc-linux-gnu
4-
// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
5-
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
63

74
/*
85
* Example OpenMP program that shows that if the initialize function

0 commit comments

Comments
 (0)