diff options
author | Tobias Grosser <tobias@grosser.es> | 2015-04-21 14:37:25 +0300 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2015-04-21 14:37:25 +0300 |
commit | 54839311177600cda6fa8f4daedc5e7524bfb638 (patch) | |
tree | 356c4774bf80dbe0d408214b2a1eaff15ad9ae96 /polly/lib | |
parent | 8e086cedfa36cd3badb6cfcb1b19811dcdc4c3b3 (diff) |
Rename 'scattering' to 'schedule'
In Polly we used both the term 'scattering' and the term 'schedule' to describe
the execution order of a statement without actually distinguishing between them.
We now uniformly use the term 'schedule' for the execution order. This
corresponds to the terminology of isl.
History: CLooG introduced the term scattering as the generated code can be used
as a sequential execution order (schedule) or as a parallel dimension
enumerating different threads of execution (placement). In Polly and/or isl the
term placement was never used, but we uniformly refer to an execution order as a
schedule and only later introduce parallelism. When doing so we do not talk
about about specific placement dimensions.
llvm-svn: 235380
Diffstat (limited to 'polly/lib')
-rw-r--r-- | polly/lib/Analysis/DependenceInfo.cpp | 44 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 96 | ||||
-rw-r--r-- | polly/lib/CodeGen/IslCodeGeneration.cpp | 2 | ||||
-rw-r--r-- | polly/lib/Exchange/JSONExporter.cpp | 20 | ||||
-rw-r--r-- | polly/lib/Transform/ScheduleOptimizer.cpp | 2 |
5 files changed, 82 insertions, 82 deletions
diff --git a/polly/lib/Analysis/DependenceInfo.cpp b/polly/lib/Analysis/DependenceInfo.cpp index 2a9cfefdf4c0..51383df6c2cb 100644 --- a/polly/lib/Analysis/DependenceInfo.cpp +++ b/polly/lib/Analysis/DependenceInfo.cpp @@ -91,23 +91,23 @@ static void collectInfo(Scop &S, isl_union_map **Read, isl_union_map **Write, accdom = isl_map_intersect_domain(accdom, domcp); if (ReductionBaseValues.count(MA->getBaseAddr())) { - // Wrap the access domain and adjust the scattering accordingly. + // Wrap the access domain and adjust the schedule accordingly. // // An access domain like // Stmt[i0, i1] -> MemAcc_A[i0 + i1] // will be transformed into // [Stmt[i0, i1] -> MemAcc_A[i0 + i1]] -> MemAcc_A[i0 + i1] // - // The original scattering looks like + // The original schedule looks like // Stmt[i0, i1] -> [0, i0, 2, i1, 0] - // but as we transformed the access domain we need the scattering + // but as we transformed the access domain we need the schedule // to match the new access domains, thus we need // [Stmt[i0, i1] -> MemAcc_A[i0 + i1]] -> [0, i0, 2, i1, 0] - isl_map *Scatter = Stmt->getScattering(); - Scatter = isl_map_apply_domain( - Scatter, isl_map_reverse(isl_map_domain_map(isl_map_copy(accdom)))); + isl_map *Schedule = Stmt->getSchedule(); + Schedule = isl_map_apply_domain( + Schedule, isl_map_reverse(isl_map_domain_map(isl_map_copy(accdom)))); accdom = isl_map_range_map(accdom); - *AccessSchedule = isl_union_map_add_map(*AccessSchedule, Scatter); + *AccessSchedule = isl_union_map_add_map(*AccessSchedule, Schedule); } if (MA->isRead()) @@ -115,7 +115,7 @@ static void collectInfo(Scop &S, isl_union_map **Read, isl_union_map **Write, else *Write = isl_union_map_add_map(*Write, accdom); } - *StmtSchedule = isl_union_map_add_map(*StmtSchedule, Stmt->getScattering()); + *StmtSchedule = isl_union_map_add_map(*StmtSchedule, Stmt->getSchedule()); } *StmtSchedule = @@ -463,41 +463,41 @@ void Dependences::calculateDependences(Scop &S) { DEBUG(dump()); } -bool Dependences::isValidScattering(Scop &S, - StatementToIslMapTy *NewScattering) const { +bool Dependences::isValidSchedule(Scop &S, + StatementToIslMapTy *NewSchedule) const { if (LegalityCheckDisabled) return true; isl_union_map *Dependences = getDependences(TYPE_RAW | TYPE_WAW | TYPE_WAR); isl_space *Space = S.getParamSpace(); - isl_union_map *Scattering = isl_union_map_empty(Space); + isl_union_map *Schedule = isl_union_map_empty(Space); - isl_space *ScatteringSpace = nullptr; + isl_space *ScheduleSpace = nullptr; for (ScopStmt *Stmt : S) { isl_map *StmtScat; - if (NewScattering->find(Stmt) == NewScattering->end()) - StmtScat = Stmt->getScattering(); + if (NewSchedule->find(Stmt) == NewSchedule->end()) + StmtScat = Stmt->getSchedule(); else - StmtScat = isl_map_copy((*NewScattering)[Stmt]); + StmtScat = isl_map_copy((*NewSchedule)[Stmt]); - if (!ScatteringSpace) - ScatteringSpace = isl_space_range(isl_map_get_space(StmtScat)); + if (!ScheduleSpace) + ScheduleSpace = isl_space_range(isl_map_get_space(StmtScat)); - Scattering = isl_union_map_add_map(Scattering, StmtScat); + Schedule = isl_union_map_add_map(Schedule, StmtScat); } Dependences = - isl_union_map_apply_domain(Dependences, isl_union_map_copy(Scattering)); - Dependences = isl_union_map_apply_range(Dependences, Scattering); + isl_union_map_apply_domain(Dependences, isl_union_map_copy(Schedule)); + Dependences = isl_union_map_apply_range(Dependences, Schedule); - isl_set *Zero = isl_set_universe(isl_space_copy(ScatteringSpace)); + isl_set *Zero = isl_set_universe(isl_space_copy(ScheduleSpace)); for (unsigned i = 0; i < isl_set_dim(Zero, isl_dim_set); i++) Zero = isl_set_fix_si(Zero, isl_dim_set, i, 0); isl_union_set *UDeltas = isl_union_map_deltas(Dependences); - isl_set *Deltas = isl_union_set_extract_set(UDeltas, ScatteringSpace); + isl_set *Deltas = isl_union_set_extract_set(UDeltas, ScheduleSpace); isl_union_set_free(UDeltas); isl_map *NonPositive = isl_set_lex_le_set(Deltas, Zero); diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 911c662e3b91..e7120bdacf8f 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -818,45 +818,45 @@ void MemoryAccess::setNewAccessRelation(isl_map *newAccess) { //===----------------------------------------------------------------------===// -isl_map *ScopStmt::getScattering() const { return isl_map_copy(Scattering); } +isl_map *ScopStmt::getSchedule() const { return isl_map_copy(Schedule); } void ScopStmt::restrictDomain(__isl_take isl_set *NewDomain) { assert(isl_set_is_subset(NewDomain, Domain) && "New domain is not a subset of old domain!"); isl_set_free(Domain); Domain = NewDomain; - Scattering = isl_map_intersect_domain(Scattering, isl_set_copy(Domain)); + Schedule = isl_map_intersect_domain(Schedule, isl_set_copy(Domain)); } -void ScopStmt::setScattering(__isl_take isl_map *NewScattering) { - assert(NewScattering && "New scattering is nullptr"); - isl_map_free(Scattering); - Scattering = NewScattering; +void ScopStmt::setSchedule(__isl_take isl_map *NewSchedule) { + assert(NewSchedule && "New schedule is nullptr"); + isl_map_free(Schedule); + Schedule = NewSchedule; } -void ScopStmt::buildScattering(SmallVectorImpl<unsigned> &Scatter) { +void ScopStmt::buildSchedule(SmallVectorImpl<unsigned> &ScheduleVec) { unsigned NbIterators = getNumIterators(); - unsigned NbScatteringDims = Parent.getMaxLoopDepth() * 2 + 1; + unsigned NbScheduleDims = Parent.getMaxLoopDepth() * 2 + 1; - isl_space *Space = isl_space_set_alloc(getIslCtx(), 0, NbScatteringDims); + isl_space *Space = isl_space_set_alloc(getIslCtx(), 0, NbScheduleDims); - Scattering = isl_map_from_domain_and_range(isl_set_universe(getDomainSpace()), + Schedule = isl_map_from_domain_and_range(isl_set_universe(getDomainSpace()), isl_set_universe(Space)); // Loop dimensions. for (unsigned i = 0; i < NbIterators; ++i) - Scattering = - isl_map_equate(Scattering, isl_dim_out, 2 * i + 1, isl_dim_in, i); + Schedule = + isl_map_equate(Schedule, isl_dim_out, 2 * i + 1, isl_dim_in, i); // Constant dimensions for (unsigned i = 0; i < NbIterators + 1; ++i) - Scattering = isl_map_fix_si(Scattering, isl_dim_out, 2 * i, Scatter[i]); + Schedule = isl_map_fix_si(Schedule, isl_dim_out, 2 * i, ScheduleVec[i]); - // Fill scattering dimensions. - for (unsigned i = 2 * NbIterators + 1; i < NbScatteringDims; ++i) - Scattering = isl_map_fix_si(Scattering, isl_dim_out, i, 0); + // Fill schedule dimensions. + for (unsigned i = 2 * NbIterators + 1; i < NbScheduleDims; ++i) + Schedule = isl_map_fix_si(Schedule, isl_dim_out, i, 0); - Scattering = isl_map_align_params(Scattering, Parent.getParamSpace()); + Schedule = isl_map_align_params(Schedule, Parent.getParamSpace()); } void ScopStmt::buildAccesses(TempScop &tempScop, BasicBlock *Block, @@ -896,7 +896,7 @@ void ScopStmt::realignParams() { MA->realignParams(); Domain = isl_set_align_params(Domain, Parent.getParamSpace()); - Scattering = isl_map_align_params(Scattering, Parent.getParamSpace()); + Schedule = isl_map_align_params(Schedule, Parent.getParamSpace()); } __isl_give isl_set *ScopStmt::buildConditionSet(const Comparison &Comp) { @@ -1056,7 +1056,7 @@ void ScopStmt::deriveAssumptions(BasicBlock *Block) { ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion, Region &R, SmallVectorImpl<Loop *> &Nest, - SmallVectorImpl<unsigned> &Scatter) + SmallVectorImpl<unsigned> &ScheduleVec) : Parent(parent), BB(nullptr), R(&R), Build(nullptr), NestLoops(Nest.size()) { // Setup the induction variables. @@ -1066,7 +1066,7 @@ ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion, BaseName = getIslCompatibleName("Stmt_(", R.getNameStr(), ")"); Domain = buildDomain(tempScop, CurRegion); - buildScattering(Scatter); + buildSchedule(ScheduleVec); BasicBlock *EntryBB = R.getEntry(); for (BasicBlock *Block : R.blocks()) { @@ -1078,7 +1078,7 @@ ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion, ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion, BasicBlock &bb, SmallVectorImpl<Loop *> &Nest, - SmallVectorImpl<unsigned> &Scatter) + SmallVectorImpl<unsigned> &ScheduleVec) : Parent(parent), BB(&bb), R(nullptr), Build(nullptr), NestLoops(Nest.size()) { // Setup the induction variables. @@ -1088,7 +1088,7 @@ ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion, BaseName = getIslCompatibleName("Stmt_", &bb, ""); Domain = buildDomain(tempScop, CurRegion); - buildScattering(Scatter); + buildSchedule(ScheduleVec); buildAccesses(tempScop, BB); deriveAssumptions(BB); checkForReductions(); @@ -1225,16 +1225,16 @@ void ScopStmt::checkForReductions() { std::string ScopStmt::getDomainStr() const { return stringFromIslObj(Domain); } -std::string ScopStmt::getScatteringStr() const { - return stringFromIslObj(Scattering); +std::string ScopStmt::getScheduleStr() const { + return stringFromIslObj(Schedule); } unsigned ScopStmt::getNumParams() const { return Parent.getNumParams(); } unsigned ScopStmt::getNumIterators() const { return NestLoops.size(); } -unsigned ScopStmt::getNumScattering() const { - return isl_map_dim(Scattering, isl_dim_out); +unsigned ScopStmt::getNumSchedule() const { + return isl_map_dim(Schedule, isl_dim_out); } const char *ScopStmt::getBaseName() const { return BaseName.c_str(); } @@ -1262,7 +1262,7 @@ ScopStmt::~ScopStmt() { } isl_set_free(Domain); - isl_map_free(Scattering); + isl_map_free(Schedule); } void ScopStmt::print(raw_ostream &OS) const { @@ -1274,10 +1274,10 @@ void ScopStmt::print(raw_ostream &OS) const { } else OS.indent(16) << "n/a\n"; - OS.indent(12) << "Scattering :=\n"; + OS.indent(12) << "Schedule :=\n"; if (Domain) { - OS.indent(16) << getScatteringStr() << ";\n"; + OS.indent(16) << getScheduleStr() << ";\n"; } else OS.indent(16) << "n/a\n"; @@ -1680,9 +1680,9 @@ void Scop::dropConstantScheduleDims() { } for (auto *S : *this) { - isl_map *Schedule = S->getScattering(); + isl_map *Schedule = S->getSchedule(); Schedule = isl_map_apply_range(Schedule, isl_map_copy(DropDimMap)); - S->setScattering(Schedule); + S->setSchedule(Schedule); } isl_set_free(ScheduleSpace); isl_map_free(DropDimMap); @@ -1697,13 +1697,13 @@ Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution, buildContext(); SmallVector<Loop *, 8> NestLoops; - SmallVector<unsigned, 8> Scatter; + SmallVector<unsigned, 8> Schedule; - Scatter.assign(MaxLoopDepth + 1, 0); + Schedule.assign(MaxLoopDepth + 1, 0); - // Build the iteration domain, access functions and scattering functions + // Build the iteration domain, access functions and schedule functions // traversing the region tree. - buildScop(tempScop, getRegion(), NestLoops, Scatter, LI, SD); + buildScop(tempScop, getRegion(), NestLoops, Schedule, LI, SD); realignParams(); addParameterBounds(); @@ -1932,7 +1932,7 @@ __isl_give isl_union_map *Scop::getSchedule() { isl_union_map *Schedule = isl_union_map_empty(getParamSpace()); for (ScopStmt *Stmt : *this) - Schedule = isl_union_map_add_map(Schedule, Stmt->getScattering()); + Schedule = isl_union_map_add_map(Schedule, Stmt->getSchedule()); return isl_union_map_coalesce(Schedule); } @@ -1977,16 +1977,16 @@ bool Scop::isTrivialBB(BasicBlock *BB, TempScop &tempScop) { void Scop::addScopStmt(BasicBlock *BB, Region *R, TempScop &tempScop, const Region &CurRegion, SmallVectorImpl<Loop *> &NestLoops, - SmallVectorImpl<unsigned> &Scatter) { + SmallVectorImpl<unsigned> &ScheduleVec) { ScopStmt *Stmt; if (BB) { - Stmt = new ScopStmt(*this, tempScop, CurRegion, *BB, NestLoops, Scatter); + Stmt = new ScopStmt(*this, tempScop, CurRegion, *BB, NestLoops, ScheduleVec); StmtMap[BB] = Stmt; } else { assert(R && "Either a basic block or a region is needed to " "create a new SCoP stmt."); - Stmt = new ScopStmt(*this, tempScop, CurRegion, *R, NestLoops, Scatter); + Stmt = new ScopStmt(*this, tempScop, CurRegion, *R, NestLoops, ScheduleVec); for (BasicBlock *BB : R->blocks()) StmtMap[BB] = Stmt; } @@ -1994,18 +1994,18 @@ void Scop::addScopStmt(BasicBlock *BB, Region *R, TempScop &tempScop, // Insert all statements into the statement map and the statement vector. Stmts.push_back(Stmt); - // Increasing the Scattering function is OK for the moment, because + // Increasing the Schedule function is OK for the moment, because // we are using a depth first iterator and the program is well structured. - ++Scatter[NestLoops.size()]; + ++ScheduleVec[NestLoops.size()]; } void Scop::buildScop(TempScop &tempScop, const Region &CurRegion, SmallVectorImpl<Loop *> &NestLoops, - SmallVectorImpl<unsigned> &Scatter, LoopInfo &LI, + SmallVectorImpl<unsigned> &ScheduleVec, LoopInfo &LI, ScopDetection &SD) { if (SD.isNonAffineSubRegion(&CurRegion, &getRegion())) return addScopStmt(nullptr, const_cast<Region *>(&CurRegion), tempScop, - CurRegion, NestLoops, Scatter); + CurRegion, NestLoops, ScheduleVec); Loop *L = castToLoop(CurRegion, LI); @@ -2013,29 +2013,29 @@ void Scop::buildScop(TempScop &tempScop, const Region &CurRegion, NestLoops.push_back(L); unsigned loopDepth = NestLoops.size(); - assert(Scatter.size() > loopDepth && "Scatter not big enough!"); + assert(ScheduleVec.size() > loopDepth && "Schedule not big enough!"); for (Region::const_element_iterator I = CurRegion.element_begin(), E = CurRegion.element_end(); I != E; ++I) if (I->isSubRegion()) { - buildScop(tempScop, *I->getNodeAs<Region>(), NestLoops, Scatter, LI, SD); + buildScop(tempScop, *I->getNodeAs<Region>(), NestLoops, ScheduleVec, LI, SD); } else { BasicBlock *BB = I->getNodeAs<BasicBlock>(); if (isTrivialBB(BB, tempScop)) continue; - addScopStmt(BB, nullptr, tempScop, CurRegion, NestLoops, Scatter); + addScopStmt(BB, nullptr, tempScop, CurRegion, NestLoops, ScheduleVec); } if (!L) return; // Exiting a loop region. - Scatter[loopDepth] = 0; + ScheduleVec[loopDepth] = 0; NestLoops.pop_back(); - ++Scatter[loopDepth - 1]; + ++ScheduleVec[loopDepth - 1]; } ScopStmt *Scop::getStmtForBasicBlock(BasicBlock *BB) const { diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp index 901f865867da..fd59a2d246ca 100644 --- a/polly/lib/CodeGen/IslCodeGeneration.cpp +++ b/polly/lib/CodeGen/IslCodeGeneration.cpp @@ -15,7 +15,7 @@ // in the Scop. ISL is used to generate an abstract syntax tree that reflects // the updated execution order. This clast is used to create new LLVM-IR that is // computationally equivalent to the original control flow region, but executes -// its code in the new execution order defined by the changed scattering. +// its code in the new execution order defined by the changed schedule. // //===----------------------------------------------------------------------===// #include "polly/Config/config.h" diff --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp index cc762c572cab..8489e8f823fe 100644 --- a/polly/lib/Exchange/JSONExporter.cpp +++ b/polly/lib/Exchange/JSONExporter.cpp @@ -102,7 +102,7 @@ Json::Value JSONExporter::getJSON(Scop &S) const { statement["name"] = Stmt->getBaseName(); statement["domain"] = Stmt->getDomainStr(); - statement["schedule"] = Stmt->getScatteringStr(); + statement["schedule"] = Stmt->getScheduleStr(); statement["accesses"]; for (MemoryAccess *MA : *Stmt) { @@ -223,7 +223,7 @@ bool JSONImporter::runOnScop(Scop &S) { isl_set_free(OldContext); S.setContext(NewContext); - StatementToIslMapTy NewScattering; + StatementToIslMapTy NewSchedule; int index = 0; @@ -233,19 +233,19 @@ bool JSONImporter::runOnScop(Scop &S) { isl_space *Space = (*SI)->getDomainSpace(); // Copy the old tuple id. This is necessary to retain the user pointer, - // that stores the reference to the ScopStmt this scattering belongs to. + // that stores the reference to the ScopStmt this schedule belongs to. m = isl_map_set_tuple_id(m, isl_dim_in, isl_space_get_tuple_id(Space, isl_dim_set)); isl_space_free(Space); - NewScattering[*SI] = m; + NewSchedule[*SI] = m; index++; } - if (!D.isValidScattering(S, &NewScattering)) { - errs() << "JScop file contains a scattering that changes the " + if (!D.isValidSchedule(S, &NewSchedule)) { + errs() << "JScop file contains a schedule that changes the " << "dependences. Use -disable-polly-legality to continue anyways\n"; - for (StatementToIslMapTy::iterator SI = NewScattering.begin(), - SE = NewScattering.end(); + for (StatementToIslMapTy::iterator SI = NewSchedule.begin(), + SE = NewSchedule.end(); SI != SE; ++SI) isl_map_free(SI->second); return false; @@ -254,8 +254,8 @@ bool JSONImporter::runOnScop(Scop &S) { for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) { ScopStmt *Stmt = *SI; - if (NewScattering.find(Stmt) != NewScattering.end()) - Stmt->setScattering(NewScattering[Stmt]); + if (NewSchedule.find(Stmt) != NewSchedule.end()) + Stmt->setSchedule(NewSchedule[Stmt]); } int statementIdx = 0; diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp index 836eeeaf157d..5df024487ed9 100644 --- a/polly/lib/Transform/ScheduleOptimizer.cpp +++ b/polly/lib/Transform/ScheduleOptimizer.cpp @@ -486,7 +486,7 @@ bool IslScheduleOptimizer::runOnScop(Scop &S) { StmtSchedule = isl_map_from_union_map(StmtBand); } - Stmt->setScattering(StmtSchedule); + Stmt->setSchedule(StmtSchedule); } isl_schedule_free(Schedule); |