[llvm-commits] [polly] r152319 - in /polly/trunk: include/polly/ScopInfo.h lib/Analysis/ScopInfo.cpp lib/Cloog.cpp lib/Exchange/JSONExporter.cpp lib/Exchange/OpenScopExporter.cpp lib/Exchange/OpenScopImporter.cpp lib/Exchange/ScopLib.cpp lib/Pocc.cpp lib/ScheduleOptimizer.cpp test/ScopInfo/loop_carry.ll

Tobias Grosser grosser at fim.uni-passau.de
Thu Mar 8 07:21:51 PST 2012


Author: grosser
Date: Thu Mar  8 09:21:51 2012
New Revision: 152319

URL: http://llvm.org/viewvc/llvm-project?rev=152319&view=rev
Log:
Remove FinalRead

The FinalRead statement represented a virtual read that is executed after the
SCoP. It was used when we verified the correctness of a schedule by checking if
it yields the same FLOW dependences as the original code. This is only works, if
we have a final read that reads all memory at the end of the SCoP.
We now switched to just checking if a schedule does not introduce negative
dependences and also consider WAW WAR dependences. This restricts the schedules
a little bit more, but we do not have any optimizer that would calculate a more
complex schedule. Hence, for now final reads are obsolete.

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/Cloog.cpp
    polly/trunk/lib/Exchange/JSONExporter.cpp
    polly/trunk/lib/Exchange/OpenScopExporter.cpp
    polly/trunk/lib/Exchange/OpenScopImporter.cpp
    polly/trunk/lib/Exchange/ScopLib.cpp
    polly/trunk/lib/Pocc.cpp
    polly/trunk/lib/ScheduleOptimizer.cpp
    polly/trunk/test/ScopInfo/loop_carry.ll

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=152319&r1=152318&r2=152319&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Thu Mar  8 09:21:51 2012
@@ -283,9 +283,6 @@
            BasicBlock &bb, SmallVectorImpl<Loop*> &NestLoops,
            SmallVectorImpl<unsigned> &Scatter);
 
-  /// Create the finalization statement.
-  ScopStmt(Scop &parent, SmallVectorImpl<unsigned> &Scatter);
-
   friend class Scop;
 public:
 
@@ -353,12 +350,6 @@
   /// @brief Return the SCEV for a loop dimension.
   const SCEVAddRecExpr *getSCEVForDimension(unsigned Dimension) const;
 
-  /// @brief Is this statement the final read statement?
-  ///
-  /// A final read statement is scheduled after all statements to model
-  /// that all data used in the Scop is read after the Scop.
-  bool isFinalRead() { return getBasicBlock() == NULL; }
-
   /// @brief Align the parameters in the statement to the scop context
   void realignParams();
 

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=152319&r1=152318&r2=152319&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Mar  8 09:21:51 2012
@@ -649,45 +649,6 @@
   buildAccesses(tempScop, CurRegion);
 }
 
-ScopStmt::ScopStmt(Scop &parent, SmallVectorImpl<unsigned> &Scatter)
-  : Parent(parent), BB(NULL), IVS(0) {
-
-  BaseName = "FinalRead";
-
-  // Build iteration domain.
-  std::string IterationDomainString = "{[i0] : i0 = 0}";
-  Domain = isl_set_read_from_str(getIslCtx(), IterationDomainString.c_str());
-  Domain = isl_set_set_tuple_name(Domain, getBaseName());
-
-  // Build scattering.
-  unsigned ScatSpace = Parent.getMaxLoopDepth() * 2 + 1;
-  isl_space *Space = isl_space_alloc(getIslCtx(), 0, 1, ScatSpace);
-  Space = isl_space_set_tuple_name(Space, isl_dim_out, "scattering");
-  Space = isl_space_set_tuple_name(Space, isl_dim_in, getBaseName());
-  Scattering = isl_map_universe(Space);
-
-  // TODO: This is incorrect. We should not use a very large number to ensure
-  // that this statement is executed last.
-  Scattering = isl_map_fix_si(Scattering, isl_dim_out, 0, 200000000);
-
-  // Build memory accesses, use SetVector to keep the order of memory accesses
-  // and prevent the same memory access inserted more than once.
-  SetVector<const Value*> BaseAddressSet;
-
-  for (Scop::const_iterator SI = Parent.begin(), SE = Parent.end(); SI != SE;
-       ++SI) {
-    ScopStmt *Stmt = *SI;
-
-    for (MemoryAccessVec::const_iterator I = Stmt->memacc_begin(),
-         E = Stmt->memacc_end(); I != E; ++I)
-      BaseAddressSet.insert((*I)->getBaseAddr());
-  }
-
-  for (SetVector<const Value*>::iterator BI = BaseAddressSet.begin(),
-       BE = BaseAddressSet.end(); BI != BE; ++BI)
-    MemAccs.push_back(new MemoryAccess(*BI, this));
-}
-
 std::string ScopStmt::getDomainStr() const {
   return stringFromIslObj(Domain);
 }
@@ -857,7 +818,6 @@
   // Build the iteration domain, access functions and scattering functions
   // traversing the region tree.
   buildScop(tempScop, getRegion(), NestLoops, Scatter, LI);
-  Stmts.push_back(new ScopStmt(*this, Scatter));
 
   realignParams();
 
@@ -942,9 +902,7 @@
   isl_union_set *Domain = NULL;
 
   for (Scop::iterator SI = begin(), SE = end(); SI != SE; ++SI)
-    if ((*SI)->isFinalRead())
-      continue;
-    else if (!Domain)
+    if (!Domain)
       Domain = isl_union_set_from_set((*SI)->getDomain());
     else
       Domain = isl_union_set_union(Domain,

Modified: polly/trunk/lib/Cloog.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Cloog.cpp?rev=152319&r1=152318&r2=152319&view=diff
==============================================================================
--- polly/trunk/lib/Cloog.cpp (original)
+++ polly/trunk/lib/Cloog.cpp Thu Mar  8 09:21:51 2012
@@ -168,10 +168,6 @@
 
   for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI) {
     ScopStmt *Stmt = *SI;
-
-    if (Stmt->isFinalRead())
-      continue;
-
     CloogScattering *Scattering;
     CloogDomain *Domain;
 

Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=152319&r1=152318&r2=152319&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Thu Mar  8 09:21:51 2012
@@ -102,9 +102,6 @@
   for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI) {
     ScopStmt *Stmt = *SI;
 
-    if (Stmt->isFinalRead())
-      continue;
-
     Json::Value statement;
 
     statement["name"] = Stmt->getBaseName();
@@ -246,12 +243,7 @@
   int index = 0;
 
   for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI) {
-    ScopStmt *Stmt = *SI;
-
-    if (Stmt->isFinalRead())
-      continue;
     Json::Value schedule = jscop["statements"][index]["schedule"];
-
     isl_map *m = isl_map_read_from_str(S->getIslCtx(), schedule.asCString());
     NewScattering[*SI] = m;
     index++;
@@ -274,9 +266,6 @@
   for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI) {
     ScopStmt *Stmt = *SI;
 
-    if (Stmt->isFinalRead())
-      continue;
-
     int memoryAccessIdx = 0;
     for (ScopStmt::memacc_iterator MI = Stmt->memacc_begin(),
          ME = Stmt->memacc_end(); MI != ME; ++MI) {

Modified: polly/trunk/lib/Exchange/OpenScopExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/OpenScopExporter.cpp?rev=152319&r1=152318&r2=152319&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/OpenScopExporter.cpp (original)
+++ polly/trunk/lib/Exchange/OpenScopExporter.cpp Thu Mar  8 09:21:51 2012
@@ -176,8 +176,6 @@
 void OpenScop::initializeStatements() {
   for (Scop::reverse_iterator SI = PollyScop->rbegin(), SE = PollyScop->rend();
        SI != SE; ++SI) {
-    if ((*SI)->isFinalRead())
-      continue;
     openscop_statement_p stmt = initializeStatement(*SI);
     stmt->next = openscop->statement;
     openscop->statement = stmt;

Modified: polly/trunk/lib/Exchange/OpenScopImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/OpenScopImporter.cpp?rev=152319&r1=152318&r2=152319&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/OpenScopImporter.cpp (original)
+++ polly/trunk/lib/Exchange/OpenScopImporter.cpp Thu Mar  8 09:21:51 2012
@@ -148,10 +148,6 @@
   openscop_statement_p stmt = OScop->statement;
 
   for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI) {
-
-    if ((*SI)->isFinalRead())
-      continue;
-
     if (!stmt) {
       errs() << "Not enough statements available in OpenScop file\n";
       delete &NewScattering;

Modified: polly/trunk/lib/Exchange/ScopLib.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/ScopLib.cpp?rev=152319&r1=152318&r2=152319&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/ScopLib.cpp (original)
+++ polly/trunk/lib/Exchange/ScopLib.cpp Thu Mar  8 09:21:51 2012
@@ -120,10 +120,6 @@
 void ScopLib::initializeStatements() {
   for (Scop::reverse_iterator SI = PollyScop->rbegin(), SE = PollyScop->rend();
        SI != SE; ++SI) {
-
-    if ((*SI)->isFinalRead())
-      continue;
-
     scoplib_statement_p stmt = initializeStatement(*SI);
     stmt->next = scoplib->statement;
     scoplib->statement = stmt;
@@ -706,10 +702,6 @@
   }
 
   for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI) {
-
-    if ((*SI)->isFinalRead())
-      continue;
-
     if (!stmt) {
       errs() << "Not enough statements available in OpenScop file\n";
       freeStmtToIslMap(&NewScattering);

Modified: polly/trunk/lib/Pocc.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Pocc.cpp?rev=152319&r1=152318&r2=152319&view=diff
==============================================================================
--- polly/trunk/lib/Pocc.cpp (original)
+++ polly/trunk/lib/Pocc.cpp Thu Mar  8 09:21:51 2012
@@ -168,9 +168,6 @@
     bool isSingleValued = true;
 
     for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
-      if ((*SI)->isFinalRead())
-        continue;
-
       isl_map *scat = (*SI)->getScattering();
       isl_map *projected = isl_map_project_out(scat, isl_dim_out, lastLoop,
                                                scatterDims - lastLoop);
@@ -189,8 +186,6 @@
 
   // Strip mine the innermost loop.
   for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
-    if ((*SI)->isFinalRead())
-      continue;
     isl_map *scat = (*SI)->getScattering();
     int scatDims = (*SI)->getNumScattering();
     isl_space *Space = isl_space_alloc(S.getIslCtx(), S.getNumParams(),

Modified: polly/trunk/lib/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/ScheduleOptimizer.cpp?rev=152319&r1=152318&r2=152319&view=diff
==============================================================================
--- polly/trunk/lib/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/ScheduleOptimizer.cpp Thu Mar  8 09:21:51 2012
@@ -104,10 +104,6 @@
 static void extendScattering(Scop &S, unsigned NewDimensions) {
   for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
     ScopStmt *Stmt = *SI;
-
-    if (Stmt->isFinalRead())
-      continue;
-
     unsigned OldDimensions = Stmt->getNumScattering();
     isl_space *Space;
     isl_basic_map *ChangeScattering;
@@ -529,10 +525,6 @@
 
   for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
     ScopStmt *Stmt = *SI;
-
-    if (Stmt->isFinalRead())
-      continue;
-
     isl_set *Domain = Stmt->getDomain();
     isl_union_map *StmtBand;
     StmtBand = isl_union_map_intersect_domain(isl_union_map_copy(ScheduleMap),

Modified: polly/trunk/test/ScopInfo/loop_carry.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/loop_carry.ll?rev=152319&r1=152318&r2=152319&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/loop_carry.ll (original)
+++ polly/trunk/test/ScopInfo/loop_carry.ll Thu Mar  8 09:21:51 2012
@@ -79,14 +79,3 @@
 ; CHECK:                 [n] -> { Stmt_bb[i0] -> MemRef_k_05_reg2mem[0] };
 ; CHECK:             WriteAccess :=
 ; CHECK:                 [n] -> { Stmt_bb[i0] -> MemRef__reg2mem[0] };
-; CHECK:     	FinalRead
-; CHECK:             Domain :=
-; CHECK:                 [n] -> { FinalRead[0] };
-; CHECK:             Scattering :=
-; CHECK:                 [n] -> { FinalRead[i0] -> scattering[200000000, o1, o2] };
-; CHECK:             ReadAccess :=
-; CHECK:                 [n] -> { FinalRead[i0] -> MemRef_a[o0] };
-; CHECK:             ReadAccess :=
-; CHECK:                 [n] -> { FinalRead[i0] -> MemRef_k_05_reg2mem[o0] };
-; CHECK:             ReadAccess :=
-; CHECK:                 -> { FinalRead[i0] -> MemRef__reg2mem[o0] };





More information about the llvm-commits mailing list