summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
diff options
context:
space:
mode:
authorNicolas Vasilache <ntv@google.com>2019-11-01 08:29:42 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-11-01 08:30:38 -0700
commitbd94a10c02a641e59c5ccfec143f728e13b516c2 (patch)
treed32e22e8224f1fd5a90d804f7ec845917dcb68e8 /mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
parent96531e2f871d74f6bc224446c40b37425d58a5b4 (diff)
downloadbcm5719-llvm-bd94a10c02a641e59c5ccfec143f728e13b516c2.tar.gz
bcm5719-llvm-bd94a10c02a641e59c5ccfec143f728e13b516c2.zip
Add Linalg pattern for producer-consumer fusion
This CL adds a simple pattern for specifying producer-consumer fusion on Linalg operations. Implementing such an extension reveals some interesting properties. Since Linalg operates on a buffer abstraction, the output buffers are specified as in/out parameters to the ops. As a consequence, there are no SSA use-def chains and one cannot specify complex dag input patterns with the current infrastructure. Instead this CL uses constraints based on the existing linalg dependence analysis to focus the pattern and refine patterns based on the type of op that last wrote in a buffer. This is a very local property and is less powerful than the generic dag specification based on SSA use-def chains. This will be generalized in the future. PiperOrigin-RevId: 277931503
Diffstat (limited to 'mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp')
-rw-r--r--mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp b/mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
index 3a90e61ed10..9e57b7bb9de 100644
--- a/mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
+++ b/mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
@@ -86,6 +86,13 @@ Value *Aliases::find(Value *v) {
}
}
+LinalgDependenceGraph
+LinalgDependenceGraph::buildDependenceGraph(Aliases &aliases, FuncOp f) {
+ SmallVector<Operation *, 8> linalgOps;
+ f.walk([&](LinalgOp op) { linalgOps.push_back(op); });
+ return LinalgDependenceGraph(aliases, linalgOps);
+}
+
LinalgDependenceGraph::LinalgDependenceGraph(Aliases &aliases,
ArrayRef<Operation *> ops)
: aliases(aliases), linalgOps(ops.begin(), ops.end()) {
OpenPOWER on IntegriCloud