[Mlir-commits] [mlir] b6d9e30 - [mlir] [Linalg] Limit Detensorize pass to FunctionOpInterface
Mehdi Amini
llvmlistbot at llvm.org
Sun Apr 2 13:30:21 PDT 2023
Author: Felix Schneider
Date: 2023-04-02T13:24:36-07:00
New Revision: b6d9e30b265834c51274f41718009d953e0d8eb0
URL: https://github.com/llvm/llvm-project/commit/b6d9e30b265834c51274f41718009d953e0d8eb0
DIFF: https://github.com/llvm/llvm-project/commit/b6d9e30b265834c51274f41718009d953e0d8eb0.diff
LOG: [mlir] [Linalg] Limit Detensorize pass to FunctionOpInterface
The linalg-detensorize Pass can only be run on FunctionOpInterface Ops and will crash when run on other ops. The TableGen definition of the pass did not enforce that.
Github issue here: https://github.com/llvm/llvm-project/issues/61845
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D147384
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/Passes.td
mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/Passes.td b/mlir/include/mlir/Dialect/Linalg/Passes.td
index 05397c6775d35..efef04f6d44f2 100644
--- a/mlir/include/mlir/Dialect/Linalg/Passes.td
+++ b/mlir/include/mlir/Dialect/Linalg/Passes.td
@@ -111,7 +111,7 @@ def LinalgGeneralization : Pass<"linalg-generalize-named-ops", "func::FuncOp"> {
let dependentDialects = ["linalg::LinalgDialect"];
}
-def LinalgDetensorize : Pass<"linalg-detensorize", ""> {
+def LinalgDetensorize : InterfacePass<"linalg-detensorize", "FunctionOpInterface"> {
let summary = "Detensorize linalg ops";
let constructor = "mlir::createLinalgDetensorizePass()";
let dependentDialects = [];
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
index acc0126f198ea..5289ed6c7f519 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
@@ -474,7 +474,7 @@ struct LinalgDetensorize
DenseSet<Operation *> opsToDetensor;
DenseMap<Operation *, DenseSet<int>> detensorableBranchOps;
DenseSet<BlockArgument> blockArgsToDetensor;
- FunctionOpInterface funcOp = cast<FunctionOpInterface>(getOperation());
+ FunctionOpInterface funcOp = getOperation();
if (aggressiveMode.getValue()) {
AggressiveDetensoringModel costModel;
More information about the Mlir-commits
mailing list