[polly] r311127 - [GPGPU] Only collect the access that belong to an array [NFC]

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 15:04:53 PDT 2017


Author: grosser
Date: Thu Aug 17 15:04:53 2017
New Revision: 311127

URL: http://llvm.org/viewvc/llvm-project?rev=311127&view=rev
Log:
[GPGPU] Only collect the access that belong to an array [NFC]

This avoid the construction of very large sets and in many cases also keeps the
number of parameters low. As a result, we see a compile time reduction from 5
minutes to only slightly above 1 minute for one of our larger test cases.

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=311127&r1=311126&r2=311127&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Thu Aug 17 15:04:53 2017
@@ -2913,6 +2913,11 @@ public:
   /// Get a union map of all memory accesses performed in the SCoP.
   isl::union_map getAccesses();
 
+  /// Get a union map of all memory accesses performed in the SCoP.
+  ///
+  /// @param Array The array to which the accesses should belong.
+  isl::union_map getAccesses(ScopArrayInfo *Array);
+
   /// Get the schedule of all the statements in the SCoP.
   ///
   /// @return The schedule of all the statements in the SCoP, if the schedule of

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=311127&r1=311126&r2=311127&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Aug 17 15:04:53 2017
@@ -4705,6 +4705,11 @@ isl::union_map Scop::getAccesses() {
   return getAccessesOfType([](MemoryAccess &MA) { return true; });
 }
 
+isl::union_map Scop::getAccesses(ScopArrayInfo *Array) {
+  return getAccessesOfType(
+      [Array](MemoryAccess &MA) { return MA.getScopArrayInfo() == Array; });
+}
+
 // Check whether @p Node is an extension node.
 //
 // @return true if @p Node is an extension node.

Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=311127&r1=311126&r2=311127&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Thu Aug 17 15:04:53 2017
@@ -2762,9 +2762,11 @@ public:
   /// @returns An isl_set describing the extent of the array.
   isl::set getExtent(ScopArrayInfo *Array) {
     unsigned NumDims = Array->getNumberOfDimensions();
-    isl::union_map Accesses = S->getAccesses();
-    Accesses = Accesses.intersect_domain(S->getDomains());
-    Accesses = Accesses.detect_equalities();
+
+    if (Array->getNumberOfDimensions() == 0)
+      return isl::set::universe(Array->getSpace());
+
+    isl::union_map Accesses = S->getAccesses(Array);
     isl::union_set AccessUSet = Accesses.range();
     AccessUSet = AccessUSet.coalesce();
     AccessUSet = AccessUSet.detect_equalities();
@@ -2773,9 +2775,6 @@ public:
     if (AccessUSet.is_empty())
       return isl::set::empty(Array->getSpace());
 
-    if (Array->getNumberOfDimensions() == 0)
-      return isl::set::universe(Array->getSpace());
-
     isl::set AccessSet = AccessUSet.extract_set(Array->getSpace());
 
     isl::local_space LS = isl::local_space(Array->getSpace());




More information about the llvm-commits mailing list