[polly] r246917 - Allow the import of multi-dimensional access functions

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 5 00:46:48 PDT 2015


Author: grosser
Date: Sat Sep  5 02:46:47 2015
New Revision: 246917

URL: http://llvm.org/viewvc/llvm-project?rev=246917&view=rev
Log:
Allow the import of multi-dimensional access functions

Originally, we disallowed the import of multi-dimensional access functions due
to our code generation not supporting the generation of new address expressions
for multi-dimensional memory accesses. When building our run-time alias check
infrastructure we added code generation support for multi-dimensional address
calculations.  Hence, we can now savely allow the import of new
multi-dimensional access functions.

Added:
    polly/trunk/test/Isl/CodeGen/new_multidim_access___%bb1---%bb17.jscop
Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/Exchange/JSONExporter.cpp

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=246917&r1=246916&r2=246917&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Sat Sep  5 02:46:47 2015
@@ -386,6 +386,9 @@ public:
   /// @brief Get an isl string representing the access function read from IR.
   std::string getOriginalAccessRelationStr() const;
 
+  /// @brief Get an isl string representing a new access function, if available.
+  std::string getNewAccessRelationStr() const;
+
   /// @brief Get the base address of this access (e.g. A for A[i+j]).
   Value *getBaseAddr() const { return BaseAddr; }
 

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=246917&r1=246916&r2=246917&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sat Sep  5 02:46:47 2015
@@ -324,6 +324,10 @@ __isl_give isl_map *MemoryAccess::getNew
   return isl_map_copy(NewAccessRelation);
 }
 
+std::string MemoryAccess::getNewAccessRelationStr() const {
+  return stringFromIslObj(NewAccessRelation);
+}
+
 __isl_give isl_basic_map *
 MemoryAccess::createBasicAccessMap(ScopStmt *Statement) {
   isl_space *Space = isl_space_set_alloc(Statement->getIslCtx(), 0, 1);
@@ -580,6 +584,8 @@ void MemoryAccess::print(raw_ostream &OS
   OS << "[Reduction Type: " << getReductionType() << "] ";
   OS << "[Scalar: " << isScalar() << "]\n";
   OS.indent(16) << getOriginalAccessRelationStr() << ";\n";
+  if (hasNewAccessRelation())
+    OS.indent(11) << "new: " << getNewAccessRelationStr() << ";\n";
 }
 
 void MemoryAccess::dump() const { print(errs()); }

Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=246917&r1=246916&r2=246917&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Sat Sep  5 02:46:47 2015
@@ -343,12 +343,6 @@ bool JSONImporter::runOnScop(Scop &S) {
         isl_map_free(newAccessMap);
         return false;
       }
-      if (isl_map_dim(newAccessMap, isl_dim_out) != 1) {
-        errs() << "New access map in JScop file should be single dimensional\n";
-        isl_map_free(currentAccessMap);
-        isl_map_free(newAccessMap);
-        return false;
-      }
 
       auto NewAccessDomain = isl_map_domain(isl_map_copy(newAccessMap));
       auto CurrentAccessDomain = isl_map_domain(isl_map_copy(currentAccessMap));

Added: polly/trunk/test/Isl/CodeGen/new_multidim_access___%bb1---%bb17.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/new_multidim_access___%25bb1---%25bb17.jscop?rev=246917&view=auto
==============================================================================
--- polly/trunk/test/Isl/CodeGen/new_multidim_access___%bb1---%bb17.jscop (added)
+++ polly/trunk/test/Isl/CodeGen/new_multidim_access___%bb1---%bb17.jscop Sat Sep  5 02:46:47 2015
@@ -0,0 +1,21 @@
+{
+   "context" : "[n, m] -> {  : n <= 9223372036854775807 and n >= -9223372036854775808 and m <= 9223372036854775807 and m >= -9223372036854775808 }",
+   "name" : "bb1 => bb17",
+   "statements" : [
+      {
+         "accesses" : [
+            {
+               "kind" : "read",
+               "relation" : "[n, m] -> { Stmt_bb4[i0, i1] -> MemRef_A[i0, i1 + 13] }"
+            },
+            {
+               "kind" : "write",
+               "relation" : "[n, m] -> { Stmt_bb4[i0, i1] -> MemRef_A[i0, i1 + 43] }"
+            }
+         ],
+         "domain" : "[n, m] -> { Stmt_bb4[i0, i1] : i0 >= 0 and n >= 1 and i0 <= -1 + n and i1 >= 0 and i1 <= 99 }",
+         "name" : "Stmt_bb4",
+         "schedule" : "[n, m] -> { Stmt_bb4[i0, i1] -> [i0, i1] }"
+      }
+   ]
+}




More information about the llvm-commits mailing list