@@ -227,22 +227,17 @@ static void scheduleGlobalLoadLocalStore(triton::FuncOp funcOp) {
227227 // Gather use-def chain in block.
228228 Block *block = op->getBlock ();
229229 bool leadsToLoad = false ;
230- bool dontReorder = false ;
231230 SetVector<Operation *> backwardSet;
232231
233232 BackwardSliceOptions options;
234233 options.omitBlockArguments = true ;
235234 options.inclusive = false ;
235+ // Slice should inlcude values flowing into op regions
236+ options.omitUsesFromAbove = false ;
236237 options.filter = [&](Operation *defOp) -> bool {
237238 Block *defBlock = defOp->getBlock ();
238239 if (!block->findAncestorOpInBlock (*defOp))
239240 return false ;
240- // Don't hoist control flow as we don't track backtraces of ops within
241- // their regions.
242- if (isa<scf::IfOp, scf::ForOp, scf::WhileOp>(defOp)) {
243- dontReorder = true ;
244- return false ;
245- }
246241
247242 // Check for a `load` dependent path.
248243 leadsToLoad |= isa<triton::LoadOp>(defOp);
@@ -252,9 +247,6 @@ static void scheduleGlobalLoadLocalStore(triton::FuncOp funcOp) {
252247 mlir::getBackwardSlice (op, &backwardSet, options);
253248 backwardSet.insert (op);
254249
255- // If we found ops in the slice we don't want to hoist.
256- if (dontReorder)
257- continue ;
258250 // Don't move a local_store if its source is a load from
259251 // the same iteration.
260252 if (isa<ttg::LocalStoreOp>(op) && leadsToLoad)
0 commit comments