[llvm-branch-commits] [openmp] f6f28b4 - [OpenMP] libomp: fix mutexinoutset dependence for proxy tasks

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 30 13:18:19 PST 2020


Author: AndreyChurbanov
Date: 2020-12-01T00:13:31+03:00
New Revision: f6f28b44ad48e35d1300693d9c34f47782b519a4

URL: https://github.com/llvm/llvm-project/commit/f6f28b44ad48e35d1300693d9c34f47782b519a4
DIFF: https://github.com/llvm/llvm-project/commit/f6f28b44ad48e35d1300693d9c34f47782b519a4.diff

LOG: [OpenMP] libomp: fix mutexinoutset dependence for proxy tasks

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.

Differential Revision: https://reviews.llvm.org/D92326

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_taskdeps.h b/openmp/runtime/src/kmp_taskdeps.h
index 2a712b348af6..4e5f8851f6b2 100644
--- a/openmp/runtime/src/kmp_taskdeps.h
+++ b/openmp/runtime/src/kmp_taskdeps.h
@@ -89,6 +89,16 @@ static inline void __kmp_release_deps(kmp_int32 gtid, kmp_taskdata_t *task) {
   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",

diff  --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp
index 3dfc3c4030d4..283bb934cd8f 100644
--- a/openmp/runtime/src/kmp_tasking.cpp
+++ b/openmp/runtime/src/kmp_tasking.cpp
@@ -849,17 +849,6 @@ static void __kmp_task_finish(kmp_int32 gtid, kmp_task_t *task,
     }
   }
 
-  // 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(


        


More information about the llvm-branch-commits mailing list