[Openmp-commits] [openmp] 9300b6d - [OpenMP][OMPT] Add OMPT support for `generic-elf-64bit` plugin
Michael Halkenhaeuser via Openmp-commits
openmp-commits at lists.llvm.org
Fri Aug 25 10:53:37 PDT 2023
Author: Michael Halkenhaeuser
Date: 2023-08-25T13:53:11-04:00
New Revision: 9300b6de3c1d2d35b3c38a5f80c2873f27699dce
URL: https://github.com/llvm/llvm-project/commit/9300b6de3c1d2d35b3c38a5f80c2873f27699dce
DIFF: https://github.com/llvm/llvm-project/commit/9300b6de3c1d2d35b3c38a5f80c2873f27699dce.diff
LOG: [OpenMP][OMPT] Add OMPT support for `generic-elf-64bit` plugin
Fixes: https://github.com/llvm/llvm-project/issues/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
Added:
Modified:
openmp/libomptarget/plugins-nextgen/CMakeLists.txt
openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp
openmp/libomptarget/test/ompt/veccopy.c
openmp/libomptarget/test/ompt/veccopy_data.c
openmp/libomptarget/test/ompt/veccopy_disallow_both.c
openmp/libomptarget/test/ompt/veccopy_emi.c
openmp/libomptarget/test/ompt/veccopy_emi_map.c
openmp/libomptarget/test/ompt/veccopy_map.c
openmp/libomptarget/test/ompt/veccopy_no_device_init.c
openmp/libomptarget/test/ompt/veccopy_wrong_return.c
Removed:
################################################################################
diff --git a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
index 89de0b0954e980..9b4f4a5866e798 100644
--- a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
+++ b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
@@ -49,7 +49,6 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
PRIVATE
elf_common
MemoryManager
- OMPT
PluginInterface
${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
${OPENMP_PTHREAD_LIB}
@@ -57,6 +56,10 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
NO_INSTALL_RPATH
)
+ if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
+ target_link_libraries("omptarget.rtl.${tmachine_libname}" PRIVATE OMPT)
+ endif()
+
if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
target_link_libraries("omptarget.rtl.${tmachine_libname}" PRIVATE
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
diff --git a/openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp
index 46b547e2442243..8f2022bac9d8ae 100644
--- a/openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp
@@ -19,6 +19,7 @@
#include "Debug.h"
#include "Environment.h"
#include "GlobalHandler.h"
+#include "OmptCallback.h"
#include "PluginInterface.h"
#include "omptarget.h"
@@ -378,7 +379,13 @@ struct GenELF64PluginTy final : public GenericPluginTy {
GenELF64PluginTy(GenELF64PluginTy &&) = delete;
/// Initialize the plugin and return the number of devices.
- Expected<int32_t> initImpl() override { return NUM_DEVICES; }
+ Expected<int32_t> initImpl() override {
+#ifdef OMPT_SUPPORT
+ ompt::connectLibrary();
+#endif
+
+ return NUM_DEVICES;
+ }
/// Deinitialize the plugin.
Error deinitImpl() override { return Plugin::success(); }
diff --git a/openmp/libomptarget/test/ompt/veccopy.c b/openmp/libomptarget/test/ompt/veccopy.c
index eb14f109890a4b..8a00ce9328f089 100644
--- a/openmp/libomptarget/test/ompt/veccopy.c
+++ b/openmp/libomptarget/test/ompt/veccopy.c
@@ -2,9 +2,6 @@
// REQUIRES: ompt
// UNSUPPORTED: aarch64-unknown-linux-gnu
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
/*
* Example OpenMP program that registers non-EMI callbacks
diff --git a/openmp/libomptarget/test/ompt/veccopy_data.c b/openmp/libomptarget/test/ompt/veccopy_data.c
index 5bbc47dc11a7d1..3bac258fbc7799 100644
--- a/openmp/libomptarget/test/ompt/veccopy_data.c
+++ b/openmp/libomptarget/test/ompt/veccopy_data.c
@@ -2,9 +2,6 @@
// REQUIRES: ompt
// UNSUPPORTED: aarch64-unknown-linux-gnu
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
/*
* Example OpenMP program that registers EMI callbacks.
diff --git a/openmp/libomptarget/test/ompt/veccopy_disallow_both.c b/openmp/libomptarget/test/ompt/veccopy_disallow_both.c
index 9d3498dc72d23f..5d40d785f837e5 100644
--- a/openmp/libomptarget/test/ompt/veccopy_disallow_both.c
+++ b/openmp/libomptarget/test/ompt/veccopy_disallow_both.c
@@ -2,9 +2,6 @@
// REQUIRES: ompt
// UNSUPPORTED: aarch64-unknown-linux-gnu
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
/*
* Example OpenMP program that shows that both EMI and non-EMI
diff --git a/openmp/libomptarget/test/ompt/veccopy_emi.c b/openmp/libomptarget/test/ompt/veccopy_emi.c
index 5adf302bd1fff4..28634540827222 100644
--- a/openmp/libomptarget/test/ompt/veccopy_emi.c
+++ b/openmp/libomptarget/test/ompt/veccopy_emi.c
@@ -2,9 +2,6 @@
// REQUIRES: ompt
// UNSUPPORTED: aarch64-unknown-linux-gnu
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
/*
* Example OpenMP program that registers EMI callbacks
diff --git a/openmp/libomptarget/test/ompt/veccopy_emi_map.c b/openmp/libomptarget/test/ompt/veccopy_emi_map.c
index edf08325c41ba1..1be7ae4766e76d 100644
--- a/openmp/libomptarget/test/ompt/veccopy_emi_map.c
+++ b/openmp/libomptarget/test/ompt/veccopy_emi_map.c
@@ -2,9 +2,6 @@
// REQUIRES: ompt
// UNSUPPORTED: aarch64-unknown-linux-gnu
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
/*
* Example OpenMP program that shows that map-EMI callbacks are not supported.
diff --git a/openmp/libomptarget/test/ompt/veccopy_map.c b/openmp/libomptarget/test/ompt/veccopy_map.c
index 6b3f4080e2e263..39b4ef0b705591 100644
--- a/openmp/libomptarget/test/ompt/veccopy_map.c
+++ b/openmp/libomptarget/test/ompt/veccopy_map.c
@@ -2,9 +2,6 @@
// REQUIRES: ompt
// UNSUPPORTED: aarch64-unknown-linux-gnu
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
/*
* Example OpenMP program that shows that map callbacks are not supported.
diff --git a/openmp/libomptarget/test/ompt/veccopy_no_device_init.c b/openmp/libomptarget/test/ompt/veccopy_no_device_init.c
index 0b4f0126375607..c1a03191c3b521 100644
--- a/openmp/libomptarget/test/ompt/veccopy_no_device_init.c
+++ b/openmp/libomptarget/test/ompt/veccopy_no_device_init.c
@@ -1,8 +1,5 @@
// RUN: %libomptarget-compile-run-and-check-generic
// REQUIRES: ompt
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
/*
* Example OpenMP program that shows that if no device init callback
diff --git a/openmp/libomptarget/test/ompt/veccopy_wrong_return.c b/openmp/libomptarget/test/ompt/veccopy_wrong_return.c
index a51a6dc10b9569..2d07b4e1bf04a0 100644
--- a/openmp/libomptarget/test/ompt/veccopy_wrong_return.c
+++ b/openmp/libomptarget/test/ompt/veccopy_wrong_return.c
@@ -1,8 +1,5 @@
// RUN: %libomptarget-compile-run-and-check-generic
// REQUIRES: ompt
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-oldDriver
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
/*
* Example OpenMP program that shows that if the initialize function
More information about the Openmp-commits
mailing list