Skip to content

Commit

Permalink
[Parser/Launcher] Fixed dim ordering (was backwards)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmed256 committed Jun 13, 2018
1 parent dcdd07b commit 1a562c2
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/lang/modes/withLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,9 @@ namespace occa {
);
forSmnt.up->addBefore(forSmnt, launchBlock);

// Get max count
int outerCount = 0;
int innerCount = 0;

// **TODO 1.1: Properly fix this
const int pathCount = (int) path.size();
for (int i = 0; i < pathCount; ++i) {
forStatement &pathSmnt = *((forStatement*) path[i]);
Expand All @@ -195,10 +194,22 @@ namespace occa {
success = false;
return;
}
const bool isOuter = pathSmnt.hasAttribute("outer");
outerCount += isOuter;
innerCount += !isOuter;
}

// TODO 1.1: Properly fix this
for (int i = 0; i < pathCount; ++i) {
forStatement &pathSmnt = *((forStatement*) path[i]);
oklForStatement oklForSmnt(pathSmnt);

launchBlock.add(pathSmnt.init->clone(&launchBlock));

const bool isOuter = pathSmnt.hasAttribute("outer");
outerCount -= isOuter;
innerCount -= !isOuter;

const int index = (isOuter
? outerCount
: innerCount);
Expand All @@ -213,9 +224,6 @@ namespace occa {
oklForSmnt.getIterationCount())
))
);

outerCount += isOuter;
innerCount += !isOuter;
}

launchBlock.addFirst(
Expand Down Expand Up @@ -539,12 +547,13 @@ namespace occa {
}

bool withLauncher::writesToShared(exprNode &expr) {
exprOpNode &opNode = (exprOpNode&) expr;
if (!(opNode.opType() & (operatorType::increment |
operatorType::decrement |
operatorType::assignment))) {
return false;
}
// TODO 1.1: Propertly check read<-->write or write<-->write ordering
// exprOpNode &opNode = (exprOpNode&) expr;
// if (!(opNode.opType() & (operatorType::increment |
// operatorType::decrement |
// operatorType::assignment))) {
// return false;
// }

// Get updated variable
variable_t *var = expr.getVariable();
Expand Down

0 comments on commit 1a562c2

Please sign in to comment.