@@ -183,10 +183,9 @@ namespace occa {
183
183
);
184
184
forSmnt.up ->addBefore (forSmnt, launchBlock);
185
185
186
+ // Get max count
186
187
int outerCount = 0 ;
187
188
int innerCount = 0 ;
188
-
189
- // **TODO 1.1: Properly fix this
190
189
const int pathCount = (int ) path.size ();
191
190
for (int i = 0 ; i < pathCount; ++i) {
192
191
forStatement &pathSmnt = *((forStatement*) path[i]);
@@ -195,10 +194,22 @@ namespace occa {
195
194
success = false ;
196
195
return ;
197
196
}
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);
198
206
199
207
launchBlock.add (pathSmnt.init ->clone (&launchBlock));
200
208
201
209
const bool isOuter = pathSmnt.hasAttribute (" outer" );
210
+ outerCount -= isOuter;
211
+ innerCount -= !isOuter;
212
+
202
213
const int index = (isOuter
203
214
? outerCount
204
215
: innerCount);
@@ -213,9 +224,6 @@ namespace occa {
213
224
oklForSmnt.getIterationCount ())
214
225
))
215
226
);
216
-
217
- outerCount += isOuter;
218
- innerCount += !isOuter;
219
227
}
220
228
221
229
launchBlock.addFirst (
@@ -539,12 +547,13 @@ namespace occa {
539
547
}
540
548
541
549
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
+ // }
548
557
549
558
// Get updated variable
550
559
variable_t *var = expr.getVariable ();
0 commit comments