[Openmp-commits] [PATCH] D97907: [OpenMP] Fix lone target exit data

Joel E. Denny via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 4 09:13:07 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbfe5452b93a7: [OpenMP] Fix lone target exit data (authored by jdenny).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97907

Files:
  openmp/libomptarget/src/interface.cpp
  openmp/libomptarget/test/offloading/lone_target_exit_data.c


Index: openmp/libomptarget/test/offloading/lone_target_exit_data.c
===================================================================
--- /dev/null
+++ openmp/libomptarget/test/offloading/lone_target_exit_data.c
@@ -0,0 +1,18 @@
+// Check that a target exit data directive behaves correctly when the runtime
+// has not yet been initialized.
+
+// RUN: %libomptarget-compile-run-and-check-aarch64-unknown-linux-gnu
+// RUN: %libomptarget-compile-run-and-check-powerpc64-ibm-linux-gnu
+// RUN: %libomptarget-compile-run-and-check-powerpc64le-ibm-linux-gnu
+// RUN: %libomptarget-compile-run-and-check-x86_64-pc-linux-gnu
+// RUN: %libomptarget-compile-run-and-check-nvptx64-nvidia-cuda
+
+#include <stdio.h>
+
+int main() {
+  // CHECK: x = 98
+  int x = 98;
+  #pragma omp target exit data map(from:x)
+  printf("x = %d\n", x);
+  return 0;
+}
Index: openmp/libomptarget/src/interface.cpp
===================================================================
--- openmp/libomptarget/src/interface.cpp
+++ openmp/libomptarget/src/interface.cpp
@@ -272,21 +272,13 @@
     return;
   }
 
-  PM->RTLsMtx.lock();
-  size_t DevicesSize = PM->Devices.size();
-  PM->RTLsMtx.unlock();
-  if (DevicesSize <= (size_t)device_id) {
-    DP("Device ID  %" PRId64 " does not have a matching RTL.\n", device_id);
+  if (CheckDeviceAndCtors(device_id) != OFFLOAD_SUCCESS) {
+    DP("Failed to get device %" PRId64 " ready\n", device_id);
     HandleTargetOutcome(false, loc);
     return;
   }
 
   DeviceTy &Device = PM->Devices[device_id];
-  if (!Device.IsInit) {
-    DP("Uninit device: ignore");
-    HandleTargetOutcome(false, loc);
-    return;
-  }
 
   if (getInfoLevel() & OMP_INFOTYPE_KERNEL_ARGS)
     printKernelArguments(loc, device_id, arg_num, arg_sizes, arg_types,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97907.328203.patch
Type: text/x-patch
Size: 1765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210304/05631cad/attachment.bin>


More information about the Openmp-commits mailing list