aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Transforms/LoopFusion.cpp
diff options
context:
space:
mode:
authorVinayaka Bandishti <vinayaka@polymagelabs.com>2021-02-22 21:31:48 +0530
committerUday Bondhugula <uday@polymagelabs.com>2021-02-22 23:21:02 +0530
commit15332982c3d8d1c9e8bd7ae9f76f22f77adb51ee (patch)
tree1b7e7a2f4e3000d9c6141d2d4197225cdb6e7b0a /mlir/lib/Transforms/LoopFusion.cpp
parented4230732adeb04a23fc25b7a5924e423ba5ac91 (diff)
downloadllvm-15332982c3d8d1c9e8bd7ae9f76f22f77adb51ee.zip
llvm-15332982c3d8d1c9e8bd7ae9f76f22f77adb51ee.tar.gz
llvm-15332982c3d8d1c9e8bd7ae9f76f22f77adb51ee.tar.bz2
[MLIR][affine] Prevent fusion when ops with memory effect free are present between producer and consumer
This commit fixes a bug in affine fusion pipeline where an incorrect fusion is performed despite a dealloc op is present between a producer and a consumer. This is done by creating a node for dealloc op in the MDG. Reviewed By: bondhugula, dcaballe Differential Revision: https://reviews.llvm.org/D97032
Diffstat (limited to 'mlir/lib/Transforms/LoopFusion.cpp')
-rw-r--r--mlir/lib/Transforms/LoopFusion.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/mlir/lib/Transforms/LoopFusion.cpp b/mlir/lib/Transforms/LoopFusion.cpp
index e13616e..d6d26a8 100644
--- a/mlir/lib/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Transforms/LoopFusion.cpp
@@ -768,7 +768,8 @@ bool MemRefDependenceGraph::init(FuncOp f) {
SmallVector<MemoryEffects::EffectInstance, 1> effects;
effectInterface.getEffects(effects);
if (llvm::any_of(effects, [](const MemoryEffects::EffectInstance &it) {
- return isa<MemoryEffects::Write>(it.getEffect());
+ return isa<MemoryEffects::Write, MemoryEffects::Free>(
+ it.getEffect());
})) {
Node node(nextNodeId++, &op);
nodes.insert({node.id, node});