Skip to content

Commit 1a562c2

Browse files
committed
[Parser/Launcher] Fixed dim ordering (was backwards)
1 parent dcdd07b commit 1a562c2

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

src/lang/modes/withLauncher.cpp

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,9 @@ namespace occa {
183183
);
184184
forSmnt.up->addBefore(forSmnt, launchBlock);
185185

186+
// Get max count
186187
int outerCount = 0;
187188
int innerCount = 0;
188-
189-
// **TODO 1.1: Properly fix this
190189
const int pathCount = (int) path.size();
191190
for (int i = 0; i < pathCount; ++i) {
192191
forStatement &pathSmnt = *((forStatement*) path[i]);
@@ -195,10 +194,22 @@ namespace occa {
195194
success = false;
196195
return;
197196
}
197+
const bool isOuter = pathSmnt.hasAttribute("outer");
198+
outerCount += isOuter;
199+
innerCount += !isOuter;
200+
}
201+
202+
// TODO 1.1: Properly fix this
203+
for (int i = 0; i < pathCount; ++i) {
204+
forStatement &pathSmnt = *((forStatement*) path[i]);
205+
oklForStatement oklForSmnt(pathSmnt);
198206

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

201209
const bool isOuter = pathSmnt.hasAttribute("outer");
210+
outerCount -= isOuter;
211+
innerCount -= !isOuter;
212+
202213
const int index = (isOuter
203214
? outerCount
204215
: innerCount);
@@ -213,9 +224,6 @@ namespace occa {
213224
oklForSmnt.getIterationCount())
214225
))
215226
);
216-
217-
outerCount += isOuter;
218-
innerCount += !isOuter;
219227
}
220228

221229
launchBlock.addFirst(
@@ -539,12 +547,13 @@ namespace occa {
539547
}
540548

541549
bool withLauncher::writesToShared(exprNode &expr) {
542-
exprOpNode &opNode = (exprOpNode&) expr;
543-
if (!(opNode.opType() & (operatorType::increment |
544-
operatorType::decrement |
545-
operatorType::assignment))) {
546-
return false;
547-
}
550+
// TODO 1.1: Propertly check read<-->write or write<-->write ordering
551+
// exprOpNode &opNode = (exprOpNode&) expr;
552+
// if (!(opNode.opType() & (operatorType::increment |
553+
// operatorType::decrement |
554+
// operatorType::assignment))) {
555+
// return false;
556+
// }
548557

549558
// Get updated variable
550559
variable_t *var = expr.getVariable();

0 commit comments

Comments
 (0)