Skip to content

Commit 9b13622

Browse files
committed
[AMD] Enable reordering across ops with nested regions
1 parent 5b66aa6 commit 9b13622

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

third_party/amd/lib/TritonAMDGPUTransforms/ReorderInstructions.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)