[Openmp-commits] [PATCH] D78170: [OpenMP] target_data_begin: fail on device alloc fail

Joel E. Denny via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Apr 21 14:39:25 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5f6aa9680c19: [OpenMP] target_data_begin: fail on device alloc fail (authored by jdenny).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78170

Files:
  openmp/libomptarget/src/omptarget.cpp
  openmp/libomptarget/test/mapping/alloc_fail.c


Index: openmp/libomptarget/test/mapping/alloc_fail.c
===================================================================
--- /dev/null
+++ openmp/libomptarget/test/mapping/alloc_fail.c
@@ -0,0 +1,25 @@
+// RUN: %libomptarget-compile-aarch64-unknown-linux-gnu
+// RUN: %libomptarget-run-fail-aarch64-unknown-linux-gnu 2>&1 \
+// RUN: | %fcheck-aarch64-unknown-linux-gnu
+
+// RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu
+// RUN: %libomptarget-run-fail-powerpc64-ibm-linux-gnu 2>&1 \
+// RUN: | %fcheck-powerpc64-ibm-linux-gnu
+
+// RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu
+// RUN: %libomptarget-run-fail-powerpc64le-ibm-linux-gnu 2>&1 \
+// RUN: | %fcheck-powerpc64le-ibm-linux-gnu
+
+// RUN: %libomptarget-compile-x86_64-pc-linux-gnu
+// RUN: %libomptarget-run-fail-x86_64-pc-linux-gnu 2>&1 \
+// RUN: | %fcheck-x86_64-pc-linux-gnu
+
+// CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
+
+int main() {
+  int arr[4] = {0, 1, 2, 3};
+#pragma omp target data map(alloc: arr[0:2])
+#pragma omp target data map(alloc: arr[1:2])
+  ;
+  return 0;
+}
Index: openmp/libomptarget/src/omptarget.cpp
===================================================================
--- openmp/libomptarget/src/omptarget.cpp
+++ openmp/libomptarget/src/omptarget.cpp
@@ -286,6 +286,7 @@
       // NULL, so getOrAlloc() returning NULL is not an error.
       DP("Call to getOrAllocTgtPtr returned null pointer (device failure or "
           "illegal mapping).\n");
+      return OFFLOAD_FAIL;
     }
     DP("There are %" PRId64 " bytes allocated at target address " DPxMOD
         " - is%s new\n", data_size, DPxPTR(TgtPtrBegin),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78170.259108.patch
Type: text/x-patch
Size: 1672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200421/535b8645/attachment.bin>


More information about the Openmp-commits mailing list