[Openmp-commits] [PATCH] D158544: [OpenMP] Optimized trivial multiple edges from task dependency graph

Romain PEREIRA via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Aug 23 11:43:05 PDT 2023


rpereira-dev updated this revision to Diff 552824.
rpereira-dev edited the summary of this revision.
rpereira-dev added a comment.
Herald added a subscriber: tstellar.

Reverted (`source`, `sink`) names swap of the `__kmp_depnode_link_successor` function; added a comment instead


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

https://reviews.llvm.org/D158544

Files:
  openmp/runtime/src/kmp_taskdeps.cpp


Index: openmp/runtime/src/kmp_taskdeps.cpp
===================================================================
--- openmp/runtime/src/kmp_taskdeps.cpp
+++ openmp/runtime/src/kmp_taskdeps.cpp
@@ -307,6 +307,7 @@
     if (dep->dn.task) {
       KMP_ACQUIRE_DEPNODE(gtid, dep);
       if (dep->dn.task) {
+        if (!dep->dn.successors || dep->dn.successors->node != node) {
 #if OMPX_TASKGRAPH
         if (!(__kmp_tdg_is_recording(tdg_status)) && task)
 #endif
@@ -317,6 +318,7 @@
                       gtid, KMP_TASK_TO_TASKDATA(dep->dn.task),
                       KMP_TASK_TO_TASKDATA(task)));
         npredecessors++;
+        }
       }
       KMP_RELEASE_DEPNODE(gtid, dep);
     }
@@ -324,6 +326,7 @@
   return npredecessors;
 }
 
+// Add the edge 'sink' -> 'source' in the task dependency graph
 static inline kmp_int32 __kmp_depnode_link_successor(kmp_int32 gtid,
                                                      kmp_info_t *thread,
                                                      kmp_task_t *task,
@@ -346,6 +349,7 @@
     // synchronously add source to sink' list of successors
     KMP_ACQUIRE_DEPNODE(gtid, sink);
     if (sink->dn.task) {
+      if (!sink->dn.successors || sink->dn.successors->node != source) {
 #if OMPX_TASKGRAPH
       if (!(__kmp_tdg_is_recording(tdg_status)) && task)
 #endif
@@ -369,6 +373,7 @@
       }
 #endif
       npredecessors++;
+      }
     }
     KMP_RELEASE_DEPNODE(gtid, sink);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158544.552824.patch
Type: text/x-patch
Size: 1448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230823/928b1a6b/attachment.bin>


More information about the Openmp-commits mailing list