[polly] r280557 - Dependences: Exit early, if no reduction dependences are needed.

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 16:29:38 PDT 2016


Author: grosser
Date: Fri Sep  2 18:29:38 2016
New Revision: 280557

URL: http://llvm.org/viewvc/llvm-project?rev=280557&view=rev
Log:
Dependences: Exit early, if no reduction dependences are needed.

In case we do not compute reduction dependences or dependences that are more
fine-grained than statement level dependences, we can avoid the corresponding
part of the dependence analysis all together. For the 3mm benchmark, this
reduces scheduling + dependence analysis time from 62ms to 33ms for a no-asserts
build.  The majority of the compile time is anyhow spent in the LLVM backends,
when doing code generation. Nevertheless, there is no need to waste compile time
either.

Modified:
    polly/trunk/lib/Analysis/DependenceInfo.cpp

Modified: polly/trunk/lib/Analysis/DependenceInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/DependenceInfo.cpp?rev=280557&r1=280556&r2=280557&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/DependenceInfo.cpp (original)
+++ polly/trunk/lib/Analysis/DependenceInfo.cpp Fri Sep  2 18:29:38 2016
@@ -335,13 +335,15 @@ void Dependences::calculateDependences(S
   collectInfo(S, &Read, &Write, &MayWrite, &AccessSchedule, &StmtSchedule,
               Level);
 
+  bool HasReductions = !isl_union_map_is_empty(AccessSchedule);
+
   DEBUG(dbgs() << "Read: " << Read << '\n';
         dbgs() << "Write: " << Write << '\n';
         dbgs() << "MayWrite: " << MayWrite << '\n';
         dbgs() << "AccessSchedule: " << AccessSchedule << '\n';
         dbgs() << "StmtSchedule: " << StmtSchedule << '\n';);
 
-  if (isl_union_map_is_empty(AccessSchedule)) {
+  if (!HasReductions) {
     isl_union_map_free(AccessSchedule);
     Schedule = S.getScheduleTree();
     // Tag the schedule tree if we want fine-grain dependence info
@@ -444,6 +446,15 @@ void Dependences::calculateDependences(S
   isl_ctx_reset_operations(IslCtx.get());
   isl_ctx_set_max_operations(IslCtx.get(), MaxOpsOld);
 
+  // Drop out early, as the remaining computations are only needed for
+  // reduction dependences or dependences that are finer than statement
+  // level dependences.
+  if (!HasReductions && Level == AL_Statement) {
+    TC_RED = isl_union_map_empty(isl_union_map_get_space(StmtSchedule));
+    isl_union_map_free(StmtSchedule);
+    return;
+  }
+
   isl_union_map *STMT_RAW, *STMT_WAW, *STMT_WAR;
   STMT_RAW = isl_union_map_intersect_domain(
       isl_union_map_copy(RAW),




More information about the llvm-commits mailing list