Skip to content

Commit 4cf3b56

Browse files
committed
Cleanup code for PR
1 parent 6bf8f0f commit 4cf3b56

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

src/index_notation/index_notation.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,12 +2366,8 @@ bool isConcreteNotation(IndexStmt stmt, std::string* reason) {
23662366
for (auto& var : op->indexVars) {
23672367
// non underived variables may appear in temporaries, but we don't check these
23682368
if (!boundVars.contains(var) && provGraph.isUnderived(var) && (provGraph.isFullyDerived(var) || !provGraph.isRecoverable(var, definedVars))) {
2369-
string string2 = "definedvars: ";
2370-
for (auto& d : definedVars)
2371-
string2.append(d.getName() + ", ");
2372-
23732369
*reason = "all variables in concrete notation must be bound by a "
2374-
"forall statement" + var.getName() + string2;
2370+
"forall statement";
23752371
isConcrete = false;
23762372
}
23772373
}

src/index_notation/provenance_graph.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,21 +1136,23 @@ bool ProvenanceGraph::isRecoverable(taco::IndexVar indexVar, std::set<taco::Inde
11361136
return isRecoverablePrecompute(indexVar, defined, producers, consumers);
11371137
}
11381138

1139-
bool ProvenanceGraph::isRecoverablePrecompute(taco::IndexVar indexVar, std::set<taco::IndexVar> defined, vector<IndexVar> producers, vector<IndexVar> consumers) const {
1139+
bool ProvenanceGraph::isRecoverablePrecompute(taco::IndexVar indexVar, std::set<taco::IndexVar> defined,
1140+
vector<IndexVar> producers, vector<IndexVar> consumers) const {
11401141
vector<IndexVar> childPrecompute;
11411142
if (std::find(consumers.begin(), consumers.end(), indexVar) != consumers.end()) {
11421143
return true;
11431144
}
1144-
if (!producers.empty() && (childRelMap.count(indexVar) && childRelMap.at(indexVar).getRelType() == IndexVarRelType::PRECOMPUTE)) {
1145+
if (!producers.empty() && (childRelMap.count(indexVar) &&
1146+
childRelMap.at(indexVar).getRelType() == IndexVarRelType::PRECOMPUTE)) {
11451147
auto precomputeChild = getChildren(indexVar)[0];
11461148
if (std::find(producers.begin(), producers.end(), precomputeChild) != producers.end()) {
11471149
return true;
11481150
}
11491151
return isRecoverablePrecompute(precomputeChild, defined, producers, consumers);
11501152
}
11511153
for (const IndexVar& child : getChildren(indexVar)) {
1152-
if (!defined.count(child) && (isFullyDerived(child)
1153-
|| !isRecoverablePrecompute(child, defined, producers, consumers))) {
1154+
if (!defined.count(child) && (isFullyDerived(child) ||
1155+
!isRecoverablePrecompute(child, defined, producers, consumers))) {
11541156
return false;
11551157
}
11561158
}
@@ -1315,12 +1317,6 @@ bool ProvenanceGraph::hasExactBound(IndexVar indexVar) const {
13151317
{
13161318
return rel.getNode<BoundRelNode>()->getBoundType() == BoundType::MaxExact;
13171319
}
1318-
// else if (rel.getRelType() == SPLIT)
1319-
// {
1320-
// return rel.getNode<SplitRelNode>()->getInnerVar() == indexVar;
1321-
// } else if (rel.getRelType() == PRECOMPUTE) {
1322-
// return hasExactBound(rel.getNode<PrecomputeRelNode>()->getParentVar());
1323-
// }
13241320
// TODO: include non-irregular variables
13251321
return false;
13261322
}

src/lower/lowerer_impl_imperative.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ Stmt LowererImplImperative::lowerForall(Forall forall)
840840

841841
Stmt LowererImplImperative::lowerForallCloned(Forall forall) {
842842
// want to emit guards outside of loop to prevent unstructured loop exits
843+
843844
// construct guard
844845
// underived or pos variables that have a descendant that has not been defined yet
845846
vector<IndexVar> varsWithGuard;
@@ -857,6 +858,7 @@ Stmt LowererImplImperative::lowerForallCloned(Forall forall) {
857858
}
858859
}
859860
}
861+
860862
// determine min and max values for vars given already defined variables.
861863
// we do a recovery where we fill in undefined variables with either 0's or the max of their iteration
862864
std::map<IndexVar, Expr> minVarValues;
@@ -901,6 +903,7 @@ Stmt LowererImplImperative::lowerForallCloned(Forall forall) {
901903
minVarValues[var] = provGraph.recoverVariable(var, currentDefinedVarOrder, underivedBounds, minChildValues, iterators);
902904
maxVarValues[var] = provGraph.recoverVariable(var, currentDefinedVarOrder, underivedBounds, maxChildValues, iterators);
903905
}
906+
904907
// Build guards
905908
Expr guardCondition;
906909
for (auto var : varsWithGuard) {

0 commit comments

Comments
 (0)