[Openmp-commits] [PATCH] D79944: [OpenMP] Fix for https://bugs.llvm.org/show_bug.cgi?id=45904.
Andrey Churbanov via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon May 18 05:20:05 PDT 2020
AndreyChurbanov updated this revision to Diff 264592.
AndreyChurbanov added a comment.
Comments addressed.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79944/new/
https://reviews.llvm.org/D79944
Files:
openmp/runtime/src/kmp_tasking.cpp
openmp/runtime/test/tasking/omp_detach_taskwait.c
Index: openmp/runtime/test/tasking/omp_detach_taskwait.c
===================================================================
--- /dev/null
+++ openmp/runtime/test/tasking/omp_detach_taskwait.c
@@ -0,0 +1,26 @@
+// RUN: %libomp-compile -fopenmp-version=50 && env OMP_NUM_THREADS='3' %libomp-run
+// RUN: %libomp-compile -fopenmp-version=50 && env OMP_NUM_THREADS='1' %libomp-run
+
+// Checked gcc 9.2 still does not support detach clause on task construct.
+// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8, gcc-9
+// clang supports detach clause since version 11.
+// UNSUPPORTED: clang-10, clang-9, clang-8, clang-7
+// icc compiler does not support detach clause.
+// UNSUPPORTED: icc
+
+#include <omp.h>
+
+int main()
+{
+ #pragma omp parallel
+ #pragma omp master
+ {
+ omp_event_handle_t event;
+ #pragma omp task detach(event)
+ {
+ omp_fulfill_event(event);
+ }
+ #pragma omp taskwait
+ }
+ return 0;
+}
Index: openmp/runtime/src/kmp_tasking.cpp
===================================================================
--- openmp/runtime/src/kmp_tasking.cpp
+++ openmp/runtime/src/kmp_tasking.cpp
@@ -916,8 +916,9 @@
taskdata->td_flags.complete = 1; // mark the task as completed
// Only need to keep track of count if team parallel and tasking not
- // serialized
- if (!(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser)) {
+ // serialized, or task is detachable and event has already been fulfilled
+ if (!(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser) ||
+ taskdata->td_flags.detachable == TASK_DETACHABLE) {
// Predecrement simulated by "- 1" calculation
children =
KMP_ATOMIC_DEC(&taskdata->td_parent->td_incomplete_child_tasks) - 1;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79944.264592.patch
Type: text/x-patch
Size: 1761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200518/bd11d27c/attachment.bin>
More information about the Openmp-commits
mailing list