[Openmp-commits] [PATCH] D92326: [OpenMP] libomp: fix mutexinoutset dependence for proxy tasks

Andrey Churbanov via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Nov 30 08:02:42 PST 2020


AndreyChurbanov created this revision.
AndreyChurbanov added reviewers: hbae, jlpeyton, tlwilmar, Nawrin.
AndreyChurbanov added a project: OpenMP.
Herald added subscribers: openmp-commits, guansong, yaxunl.
AndreyChurbanov requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

Once __kmp_task_finish is not executed for proxy tasks, 
move mutexinoutset dependency code to __kmp_release_deps 
which is executed for all task kinds.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92326

Files:
  openmp/runtime/src/kmp_taskdeps.h
  openmp/runtime/src/kmp_tasking.cpp


Index: openmp/runtime/src/kmp_tasking.cpp
===================================================================
--- openmp/runtime/src/kmp_tasking.cpp
+++ openmp/runtime/src/kmp_tasking.cpp
@@ -849,17 +849,6 @@
     }
   }
 
-  // Check mutexinoutset dependencies, release locks
-  kmp_depnode_t *node = taskdata->td_depnode;
-  if (node && (node->dn.mtx_num_locks < 0)) {
-    // negative num_locks means all locks were acquired
-    node->dn.mtx_num_locks = -node->dn.mtx_num_locks;
-    for (int i = node->dn.mtx_num_locks - 1; i >= 0; --i) {
-      KMP_DEBUG_ASSERT(node->dn.mtx_locks[i] != NULL);
-      __kmp_release_lock(node->dn.mtx_locks[i], gtid);
-    }
-  }
-
   // bookkeeping for resuming task:
   // GEH - note tasking_ser => task_serial
   KMP_DEBUG_ASSERT(
Index: openmp/runtime/src/kmp_taskdeps.h
===================================================================
--- openmp/runtime/src/kmp_taskdeps.h
+++ openmp/runtime/src/kmp_taskdeps.h
@@ -89,6 +89,16 @@
   kmp_info_t *thread = __kmp_threads[gtid];
   kmp_depnode_t *node = task->td_depnode;
 
+  // Check mutexinoutset dependencies, release locks
+  if (UNLIKELY(node && (node->dn.mtx_num_locks < 0))) {
+    // negative num_locks means all locks were acquired
+    node->dn.mtx_num_locks = -node->dn.mtx_num_locks;
+    for (int i = node->dn.mtx_num_locks - 1; i >= 0; --i) {
+      KMP_DEBUG_ASSERT(node->dn.mtx_locks[i] != NULL);
+      __kmp_release_lock(node->dn.mtx_locks[i], gtid);
+    }
+  }
+
   if (task->td_dephash) {
     KA_TRACE(
         40, ("__kmp_release_deps: T#%d freeing dependencies hash of task %p.\n",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92326.308370.patch
Type: text/x-patch
Size: 1600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201130/449e67af/attachment.bin>


More information about the Openmp-commits mailing list