[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 08:04:19 PDT 2020


jdenny updated this revision to Diff 258997.
jdenny edited the summary of this revision.
jdenny added reviewers: Hahnfeld, grokos, AlexEichenberger.
jdenny added a comment.

Extracted test infrastructure changes to D78566 <https://reviews.llvm.org/D78566>.

Rebased.


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.258997.patch
Type: text/x-patch
Size: 1672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200421/b8fd339a/attachment-0001.bin>


More information about the Openmp-commits mailing list