Implement functions to register Flow Analysis/Test passes
* Adds createDispatchabilityAnalysisPass()
* Adds registerFlowTestPasses()
* Necessary to drop alwayslink from Flow Analysis
Closes https://github.com/google/iree/pull/1537
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/iree/pull/1537 from iml130:init_passes_flow c312f5d1e040f5fa6a0db6aa774d896a46ad9280
PiperOrigin-RevId: 306943584
diff --git a/iree/compiler/Dialect/Flow/Analysis/BUILD b/iree/compiler/Dialect/Flow/Analysis/BUILD
index e923b19..da2e60e 100644
--- a/iree/compiler/Dialect/Flow/Analysis/BUILD
+++ b/iree/compiler/Dialect/Flow/Analysis/BUILD
@@ -25,6 +25,7 @@
],
hdrs = [
"Dispatchability.h",
+ "TestPasses.h",
],
deps = [
"//iree/compiler/Dialect/Flow/IR",
diff --git a/iree/compiler/Dialect/Flow/Analysis/CMakeLists.txt b/iree/compiler/Dialect/Flow/Analysis/CMakeLists.txt
index 8c0fc53..8a6d11b 100644
--- a/iree/compiler/Dialect/Flow/Analysis/CMakeLists.txt
+++ b/iree/compiler/Dialect/Flow/Analysis/CMakeLists.txt
@@ -19,6 +19,7 @@
Analysis
HDRS
"Dispatchability.h"
+ "TestPasses.h"
SRCS
"Dispatchability.cpp"
"DispatchabilityTest.cpp"
diff --git a/iree/compiler/Dialect/Flow/Analysis/DispatchabilityTest.cpp b/iree/compiler/Dialect/Flow/Analysis/DispatchabilityTest.cpp
index 99f0837..a25b9b1 100644
--- a/iree/compiler/Dialect/Flow/Analysis/DispatchabilityTest.cpp
+++ b/iree/compiler/Dialect/Flow/Analysis/DispatchabilityTest.cpp
@@ -29,6 +29,14 @@
}
};
+namespace IREE {
+namespace Flow {
+std::unique_ptr<OperationPass<ModuleOp>> createDispatchabilityTestPass() {
+ return std::make_unique<DispatchabilityTestPass>();
+}
+} // namespace Flow
+} // namespace IREE
+
static PassRegistration<DispatchabilityTestPass> pass(
"test-iree-flow-dispatchability",
"Test pass used for dispatchability analysis");
diff --git a/iree/compiler/Dialect/Flow/Analysis/TestPasses.h b/iree/compiler/Dialect/Flow/Analysis/TestPasses.h
new file mode 100644
index 0000000..1f1fbed
--- /dev/null
+++ b/iree/compiler/Dialect/Flow/Analysis/TestPasses.h
@@ -0,0 +1,49 @@
+// Copyright 2020 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef IREE_COMPILER_DIALECT_FLOW_ANALYSIS_TESTPASSES_H_
+#define IREE_COMPILER_DIALECT_FLOW_ANALYSIS_TESTPASSES_H_
+
+#include "iree/compiler/Dialect/Flow/IR/FlowOps.h"
+#include "mlir/IR/Function.h"
+#include "mlir/IR/Module.h"
+#include "mlir/Pass/Pass.h"
+#include "mlir/Pass/PassManager.h"
+#include "mlir/Support/LLVM.h"
+
+namespace mlir {
+namespace iree_compiler {
+namespace IREE {
+namespace Flow {
+
+//===----------------------------------------------------------------------===//
+// Test passes
+//===----------------------------------------------------------------------===//
+
+std::unique_ptr<OperationPass<ModuleOp>> createDispatchabilityTestPass();
+
+//===----------------------------------------------------------------------===//
+// Register all analysis passes
+//===----------------------------------------------------------------------===//
+
+inline void registerFlowAnalysisTestPasses() {
+ createDispatchabilityTestPass();
+}
+
+} // namespace Flow
+} // namespace IREE
+} // namespace iree_compiler
+} // namespace mlir
+
+#endif // IREE_COMPILER_DIALECT_FLOW_ANALYSIS_TESTPASSES_H_
\ No newline at end of file
diff --git a/iree/tools/BUILD b/iree/tools/BUILD
index 9f0ca21..8da3b45 100644
--- a/iree/tools/BUILD
+++ b/iree/tools/BUILD
@@ -67,6 +67,7 @@
"init_passes.h",
],
deps = [
+ "//iree/compiler/Dialect/Flow/Analysis",
"//iree/compiler/Dialect/Flow/IR",
"//iree/compiler/Dialect/Flow/Transforms",
"//iree/compiler/Dialect/HAL/IR:HALDialect",
diff --git a/iree/tools/CMakeLists.txt b/iree/tools/CMakeLists.txt
index 14bd918..5c1c16f 100644
--- a/iree/tools/CMakeLists.txt
+++ b/iree/tools/CMakeLists.txt
@@ -131,6 +131,7 @@
MLIRStandardToSPIRVTransforms
MLIRTransforms
MLIRVector
+ iree::compiler::Dialect::Flow::Analysis
iree::compiler::Dialect::Flow::IR
iree::compiler::Dialect::Flow::Transforms
iree::compiler::Dialect::HAL::IR::HALDialect
diff --git a/iree/tools/init_passes.h b/iree/tools/init_passes.h
index 4880173..3ec7885 100644
--- a/iree/tools/init_passes.h
+++ b/iree/tools/init_passes.h
@@ -22,6 +22,7 @@
#include <cstdlib>
+#include "iree/compiler/Dialect/Flow/Analysis/TestPasses.h"
#include "iree/compiler/Dialect/Flow/Transforms/Passes.h"
#include "iree/compiler/Dialect/HAL/Transforms/Passes.h"
#include "iree/compiler/Dialect/IREE/Transforms/Passes.h"
@@ -170,6 +171,7 @@
// global registry.
inline void registerAllIreePasses() {
IREE::Flow::registerFlowPasses();
+ IREE::Flow::registerFlowAnalysisTestPasses();
IREE::HAL::registerHALPasses();
IREE::registerIreePasses();
Shape::registerShapePasses();