Skip to content
forked from iree-org/iree

Commit eacf16f

Browse files
committed
[fixup] Address review comments
1 parent 3337b2c commit eacf16f

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

compiler/src/iree/compiler/Dialect/Flow/Transforms/RegionOpUtils.cpp

+14-13
Original file line numberDiff line numberDiff line change
@@ -809,20 +809,21 @@ static bool isAttentionMaskGenerator(Operation *op) {
809809
return false;
810810
}
811811

812-
static bool hasFusableOrLowMemoryUsers(Operation *op) {
813-
bool hasMemoryHungryNonFusableConsumer = false;
812+
static bool hasExplicitNonFusableUsers(Operation *op) {
813+
bool hasNonFusableUse = false;
814814
for (Operation *user : op->getUsers()) {
815815
if (isa<IREE::LinalgExt::LinalgFusionOpInterface>(user))
816816
continue;
817-
// TODO: Calling iree_linalg_ext.scan ops "memory-hungry" is a bit of a
818-
// stretch - the actual issue comes down to poor support in tiling configs,
819-
// leading to overly large stack-bound allocations. Backend compilers should
820-
// often cope with fusing the resulting loops.
821-
// So improve the tiling logic for ScanOp's, while also considering ways to
822-
// express simple fusions within this cumulative reduction intrinsic.
823-
hasMemoryHungryNonFusableConsumer |= isa<IREE::LinalgExt::ScanOp>(user);
824-
}
825-
return !hasMemoryHungryNonFusableConsumer;
817+
// TODO: The issue with iree_linalg_ext.scan compared to other non-fusable
818+
// ops comes down to poor support in tiling configs, leading to overly large
819+
// stack-bound allocations. In practice, backend compilers should often cope
820+
// with fusing the resulting loops even without Linalg-level fusion.
821+
// So long-term, we improve the tiling logic for ScanOp's, while also
822+
// considering ways to express simple fusions within this cumulative
823+
// reduction intrinsic.
824+
hasNonFusableUse |= isa<IREE::LinalgExt::ScanOp>(user);
825+
}
826+
return hasNonFusableUse;
826827
}
827828

828829
/// Operations that are cloned into dispatch regions formed with other
@@ -842,8 +843,8 @@ bool isClonableIntoDispatchOp(Operation *op,
842843
return true;
843844
}
844845
// TODO: Tune the cases excluded through hasFusableOrLowMemoryUsers
845-
// condition in a more targetted manner, then remove the condition.
846-
if (isa<linalg::LinalgOp>(op) && !hasFusableOrLowMemoryUsers(op)) {
846+
// condition in a more targeted manner, then remove the condition.
847+
if (isa<linalg::LinalgOp>(op) && hasExplicitNonFusableUsers(op)) {
847848
return false;
848849
}
849850
if (LinalgExt::isBitExtendOp(op)) {

0 commit comments

Comments
 (0)