[Openmp-commits] [PATCH] D72472: [LIBOMPTARGET]Ignore empty target descriptors.

Alexey Bataev via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Jan 10 06:55:58 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb19c0810e56b: [LIBOMPTARGET]Ignore empty target descriptors. (authored by ABataev).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72472/new/

https://reviews.llvm.org/D72472

Files:
  openmp/libomptarget/src/rtl.cpp
  openmp/libomptarget/test/offloading/dynamic_module.c


Index: openmp/libomptarget/test/offloading/dynamic_module.c
===================================================================
--- /dev/null
+++ openmp/libomptarget/test/offloading/dynamic_module.c
@@ -0,0 +1,17 @@
+// RUN: %libomptarget-compile-aarch64-unknown-linux-gnu -DSHARED -shared -o %t.so && %libomptarget-compile-aarch64-unknown-linux-gnu %t.so && %libomptarget-run-aarch64-unknown-linux-gnu 2>&1 | %fcheck-aarch64-unknown-linux-gnu
+// RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu -DSHARED -shared -o %t.so && %libomptarget-compile-powerpc64-ibm-linux-gnu %t.so && %libomptarget-run-powerpc64-ibm-linux-gnu 2>&1 | %fcheck-powerpc64-ibm-linux-gnu
+// RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu -DSHARED -shared -o %t.so && %libomptarget-compile-powerpc64le-ibm-linux-gnu %t.so && %libomptarget-run-powerpc64le-ibm-linux-gnu 2>&1 | %fcheck-powerpc64le-ibm-linux-gnu
+// RUN: %libomptarget-compile-x86_64-pc-linux-gnu -DSHARED -shared -o %t.so && %libomptarget-compile-x86_64-pc-linux-gnu %t.so && %libomptarget-run-x86_64-pc-linux-gnu 2>&1 | %fcheck-x86_64-pc-linux-gnu
+
+#ifdef SHARED
+void foo() {}
+#else
+#include <stdio.h>
+int main() {
+#pragma omp target
+  ;
+  // CHECK: DONE.
+  printf("%s\n", "DONE.");
+  return 0;
+}
+#endif
Index: openmp/libomptarget/src/rtl.cpp
===================================================================
--- openmp/libomptarget/src/rtl.cpp
+++ openmp/libomptarget/src/rtl.cpp
@@ -234,6 +234,8 @@
   // Attempt to load all plugins available in the system.
   std::call_once(initFlag, &RTLsTy::LoadRTLs, this);
 
+  if (desc->HostEntriesBegin == desc->HostEntriesEnd)
+    return;
   RTLsMtx.lock();
   // Register the images with the RTLs that understand them, if any.
   for (int32_t i = 0; i < desc->NumDeviceImages; ++i) {
@@ -320,6 +322,8 @@
 void RTLsTy::UnregisterLib(__tgt_bin_desc *desc) {
   DP("Unloading target library!\n");
 
+  if (desc->HostEntriesBegin == desc->HostEntriesEnd)
+    return;
   RTLsMtx.lock();
   // Find which RTL understands each image, if any.
   for (int32_t i = 0; i < desc->NumDeviceImages; ++i) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72472.237307.patch
Type: text/x-patch
Size: 2102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200110/afe186ec/attachment-0001.bin>


More information about the Openmp-commits mailing list