[Mlir-commits] [mlir] [mlir][linalg] NFC: Use tablegen macro for pass constructors (PR #82892)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Feb 24 10:15:36 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-linalg
Author: Quinn Dawkins (qedawkins)
<details>
<summary>Changes</summary>
This uses the tablegen macros for generating pass constructors, including exposing pass options for fold-unit-extent-dims and linalg-detensorize.
Additionally aligns some of the pass namings to their text counterpart. This includes an API change:
createLinalgGeneralizationPass -> createLinalgGeneralizeNamedOpsPass
---
Patch is 22.00 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/82892.diff
12 Files Affected:
- (modified) mlir/include/mlir/Dialect/Linalg/Passes.h (+1-37)
- (modified) mlir/include/mlir/Dialect/Linalg/Passes.td (+38-49)
- (modified) mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp (+4-6)
- (modified) mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp (+4-6)
- (modified) mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp (+5-6)
- (modified) mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp (+4-7)
- (modified) mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp (+4-6)
- (modified) mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp (+7-8)
- (modified) mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp (+4-6)
- (modified) mlir/lib/Dialect/Linalg/Transforms/Loops.cpp (+12-18)
- (modified) mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp (+5-8)
- (modified) mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp (+1-1)
``````````diff
diff --git a/mlir/include/mlir/Dialect/Linalg/Passes.h b/mlir/include/mlir/Dialect/Linalg/Passes.h
index 5f46affe592a2d..d36d1e70f0b14d 100644
--- a/mlir/include/mlir/Dialect/Linalg/Passes.h
+++ b/mlir/include/mlir/Dialect/Linalg/Passes.h
@@ -27,43 +27,7 @@ struct OneShotBufferizationOptions;
} // namespace bufferization
#define GEN_PASS_DECL
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
-std::unique_ptr<Pass> createConvertElementwiseToLinalgPass();
-
-std::unique_ptr<Pass> createLinalgFoldUnitExtentDimsPass();
-
-std::unique_ptr<Pass> createLinalgElementwiseOpFusionPass();
-std::unique_ptr<Pass> createFoldReshapeOpsByLinearizationPass();
-
-std::unique_ptr<Pass> createLinalgNamedOpConversionPass();
-
-std::unique_ptr<Pass> createLinalgInlineScalarOperandsPass();
-
-/// Create a pass to convert Linalg operations to scf.for loops and
-/// memref.load/memref.store accesses.
-std::unique_ptr<Pass> createConvertLinalgToLoopsPass();
-
-/// Create a pass to convert Linalg operations to scf.parallel loops and
-/// memref.load/memref.store accesses.
-std::unique_ptr<Pass> createConvertLinalgToParallelLoopsPass();
-
-/// Create a pass to convert Linalg operations to affine.for loops and
-/// affine_load/affine_store accesses.
-/// Placeholder for now, this is NYI.
-std::unique_ptr<Pass> createConvertLinalgToAffineLoopsPass();
-
-/// Create a pass to convert Linalg operations which work on tensors to use
-/// buffers instead.
-std::unique_ptr<Pass> createLinalgBufferizePass();
-
-/// Create a pass to convert named Linalg operations to Linalg generic
-/// operations.
-std::unique_ptr<Pass> createLinalgGeneralizationPass();
-
-/// Create a pass to convert Linalg operations to equivalent operations that
-/// work on primitive types, if possible.
-std::unique_ptr<Pass> createLinalgDetensorizePass();
+#include "mlir/Dialect/Linalg/Passes.h.inc" // IWYU pragma: keep
//===----------------------------------------------------------------------===//
// Registration
diff --git a/mlir/include/mlir/Dialect/Linalg/Passes.td b/mlir/include/mlir/Dialect/Linalg/Passes.td
index cca50e21d5ce0b..85f11c66d29a73 100644
--- a/mlir/include/mlir/Dialect/Linalg/Passes.td
+++ b/mlir/include/mlir/Dialect/Linalg/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def ConvertElementwiseToLinalg : Pass<"convert-elementwise-to-linalg", ""> {
+def ConvertElementwiseToLinalgPass : Pass<"convert-elementwise-to-linalg", ""> {
let summary = "Convert ElementwiseMappable ops to linalg";
let description = [{
Convert ops with the `ElementwiseMappable` trait to linalg parallel loops.
@@ -20,54 +20,17 @@ def ConvertElementwiseToLinalg : Pass<"convert-elementwise-to-linalg", ""> {
run on op which contains linalg ops (most commonly a
FunctionOpInterface op).
}];
- let constructor = "mlir::createConvertElementwiseToLinalgPass()";
let dependentDialects = ["linalg::LinalgDialect", "memref::MemRefDialect"];
}
-def LinalgFoldUnitExtentDims : Pass<"linalg-fold-unit-extent-dims", ""> {
- let summary = "Remove unit-extent dimension in Linalg ops on tensors";
- let constructor = "mlir::createLinalgFoldUnitExtentDimsPass()";
- let options = [
- Option<"useRankReducingSlices", "use-rank-reducing-slices", "bool",
- /*default=*/"false",
- "Generate rank-reducing slices instead of reassociative reshapes">
- ];
- let dependentDialects = [
- "linalg::LinalgDialect", "affine::AffineDialect", "memref::MemRefDialect"
- ];
-}
-
-def LinalgElementwiseOpFusion : Pass<"linalg-fuse-elementwise-ops"> {
- let summary = "Fuse elementwise operations on tensors";
- let constructor = "mlir::createLinalgElementwiseOpFusionPass()";
- let dependentDialects = [
- "affine::AffineDialect", "linalg::LinalgDialect", "memref::MemRefDialect"
- ];
-}
-
-def LinalgNamedOpConversion: Pass<"linalg-named-op-conversion"> {
- let summary = "Convert from one named linalg op to another.";
- let constructor = "mlir::createLinalgNamedOpConversionPass()";
- let dependentDialects = ["linalg::LinalgDialect", "tensor::TensorDialect"];
-}
-
-def LinalgInlineScalarOperands : Pass<"linalg-inline-scalar-operands"> {
- let summary = "Inline scalar operands into linalg generic ops";
- let constructor = "mlir::createLinalgInlineScalarOperandsPass()";
- let dependentDialects = [
- "linalg::LinalgDialect"
- ];
-}
-
-def LinalgLowerToAffineLoops : Pass<"convert-linalg-to-affine-loops"> {
+def ConvertLinalgToAffineLoopsPass : Pass<"convert-linalg-to-affine-loops"> {
let summary = "Lower the operations from the linalg dialect into affine "
"loops";
- let constructor = "mlir::createConvertLinalgToAffineLoopsPass()";
let dependentDialects = [
"affine::AffineDialect", "linalg::LinalgDialect", "memref::MemRefDialect"];
}
-def LinalgLowerToLoops : Pass<"convert-linalg-to-loops"> {
+def ConvertLinalgToLoopsPass : Pass<"convert-linalg-to-loops"> {
let summary = "Lower the operations from the linalg dialect into loops";
let description = [{
Lowers the `linalg` ops to loop nests using `scf.for`.
@@ -76,7 +39,6 @@ def LinalgLowerToLoops : Pass<"convert-linalg-to-loops"> {
i.e., tensor operands and results must be converted to memrefs via
bufferization.
}];
- let constructor = "mlir::createConvertLinalgToLoopsPass()";
let dependentDialects = [
"linalg::LinalgDialect",
"scf::SCFDialect",
@@ -84,11 +46,10 @@ def LinalgLowerToLoops : Pass<"convert-linalg-to-loops"> {
];
}
-def LinalgLowerToParallelLoops
+def ConvertLinalgToParallelLoopsPass
: Pass<"convert-linalg-to-parallel-loops"> {
let summary = "Lower the operations from the linalg dialect into parallel "
"loops";
- let constructor = "mlir::createConvertLinalgToParallelLoopsPass()";
let dependentDialects = [
"affine::AffineDialect",
"linalg::LinalgDialect",
@@ -97,9 +58,39 @@ def LinalgLowerToParallelLoops
];
}
-def LinalgBufferize : Pass<"linalg-bufferize"> {
+def LinalgFoldUnitExtentDimsPass : Pass<"linalg-fold-unit-extent-dims", ""> {
+ let summary = "Remove unit-extent dimension in Linalg ops on tensors";
+ let options = [
+ Option<"useRankReducingSlices", "use-rank-reducing-slices", "bool",
+ /*default=*/"false",
+ "Generate rank-reducing slices instead of reassociative reshapes">
+ ];
+ let dependentDialects = [
+ "linalg::LinalgDialect", "affine::AffineDialect", "memref::MemRefDialect"
+ ];
+}
+
+def LinalgElementwiseOpFusionPass : Pass<"linalg-fuse-elementwise-ops"> {
+ let summary = "Fuse elementwise operations on tensors";
+ let dependentDialects = [
+ "affine::AffineDialect", "linalg::LinalgDialect", "memref::MemRefDialect"
+ ];
+}
+
+def LinalgNamedOpConversionPass: Pass<"linalg-named-op-conversion"> {
+ let summary = "Convert from one named linalg op to another.";
+ let dependentDialects = ["linalg::LinalgDialect", "tensor::TensorDialect"];
+}
+
+def LinalgInlineScalarOperandsPass : Pass<"linalg-inline-scalar-operands"> {
+ let summary = "Inline scalar operands into linalg generic ops";
+ let dependentDialects = [
+ "linalg::LinalgDialect"
+ ];
+}
+
+def LinalgBufferizePass : Pass<"linalg-bufferize"> {
let summary = "Bufferize the linalg dialect";
- let constructor = "mlir::createLinalgBufferizePass()";
let dependentDialects = [
"affine::AffineDialect",
"bufferization::BufferizationDialect",
@@ -108,15 +99,13 @@ def LinalgBufferize : Pass<"linalg-bufferize"> {
];
}
-def LinalgGeneralization : Pass<"linalg-generalize-named-ops"> {
+def LinalgGeneralizeNamedOpsPass : Pass<"linalg-generalize-named-ops"> {
let summary = "Convert named ops into generic ops";
- let constructor = "mlir::createLinalgGeneralizationPass()";
let dependentDialects = ["linalg::LinalgDialect"];
}
-def LinalgDetensorize : InterfacePass<"linalg-detensorize", "FunctionOpInterface"> {
+def LinalgDetensorizePass : InterfacePass<"linalg-detensorize", "FunctionOpInterface"> {
let summary = "Detensorize linalg ops";
- let constructor = "mlir::createLinalgDetensorizePass()";
let dependentDialects = [];
let description = [{
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
index 73c4d4779750d9..8812ca14ba6109 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
@@ -21,7 +21,7 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
-#define GEN_PASS_DEF_LINALGBUFFERIZE
+#define GEN_PASS_DEF_LINALGBUFFERIZEPASS
#include "mlir/Dialect/Linalg/Passes.h.inc"
} // namespace mlir
@@ -32,7 +32,9 @@ namespace {
/// Converts Linalg operations that work on tensor-type operands or results to
/// work on buffers.
struct LinalgBufferizePass
- : public impl::LinalgBufferizeBase<LinalgBufferizePass> {
+ : public impl::LinalgBufferizePassBase<LinalgBufferizePass> {
+ using impl::LinalgBufferizePassBase<
+ LinalgBufferizePass>::LinalgBufferizePassBase;
void runOnOperation() override {
BufferizationOptions options = getPartialBufferizationOptions();
options.opFilter.allowDialect<linalg::LinalgDialect>();
@@ -48,7 +50,3 @@ struct LinalgBufferizePass
}
};
} // namespace
-
-std::unique_ptr<Pass> mlir::createLinalgBufferizePass() {
- return std::make_unique<LinalgBufferizePass>();
-}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
index 98cd0444760ece..22968096a68913 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
@@ -21,7 +21,7 @@
#include <utility>
namespace mlir {
-#define GEN_PASS_DEF_LINALGDETENSORIZE
+#define GEN_PASS_DEF_LINALGDETENSORIZEPASS
#include "mlir/Dialect/Linalg/Passes.h.inc"
} // namespace mlir
@@ -164,7 +164,9 @@ class DetensorizeTypeConverter : public TypeConverter {
/// @see LinalgDetensorize in Linalg/Passes.td for more details.
struct LinalgDetensorize
- : public impl::LinalgDetensorizeBase<LinalgDetensorize> {
+ : public impl::LinalgDetensorizePassBase<LinalgDetensorize> {
+ using impl::LinalgDetensorizePassBase<
+ LinalgDetensorize>::LinalgDetensorizePassBase;
LinalgDetensorize() = default;
class CostModel {
@@ -576,7 +578,3 @@ struct LinalgDetensorize
}
};
} // namespace
-
-std::unique_ptr<Pass> mlir::createLinalgDetensorizePass() {
- return std::make_unique<LinalgDetensorize>();
-}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
index c46e3694b70ecd..45cab81be4f5ff 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
@@ -33,7 +33,7 @@
#include "llvm/Support/Debug.h"
namespace mlir {
-#define GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMS
+#define GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMSPASS
#include "mlir/Dialect/Linalg/Passes.h.inc"
} // namespace mlir
@@ -689,7 +689,10 @@ void mlir::linalg::populateMoveInitOperandsToInputPattern(
namespace {
/// Pass that removes unit-extent dims within generic ops.
struct LinalgFoldUnitExtentDimsPass
- : public impl::LinalgFoldUnitExtentDimsBase<LinalgFoldUnitExtentDimsPass> {
+ : public impl::LinalgFoldUnitExtentDimsPassBase<
+ LinalgFoldUnitExtentDimsPass> {
+ using impl::LinalgFoldUnitExtentDimsPassBase<
+ LinalgFoldUnitExtentDimsPass>::LinalgFoldUnitExtentDimsPassBase;
void runOnOperation() override {
Operation *op = getOperation();
MLIRContext *context = op->getContext();
@@ -705,7 +708,3 @@ struct LinalgFoldUnitExtentDimsPass
}
};
} // namespace
-
-std::unique_ptr<Pass> mlir::createLinalgFoldUnitExtentDimsPass() {
- return std::make_unique<LinalgFoldUnitExtentDimsPass>();
-}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
index 0d8d670904f2a8..4977940cfbd797 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
@@ -27,8 +27,7 @@
#include <utility>
namespace mlir {
-#define GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMS
-#define GEN_PASS_DEF_LINALGELEMENTWISEOPFUSION
+#define GEN_PASS_DEF_LINALGELEMENTWISEOPFUSIONPASS
#include "mlir/Dialect/Linalg/Passes.h.inc"
} // namespace mlir
@@ -1927,8 +1926,10 @@ namespace {
// favor of test passes that check the functionality of each of the patterns
// added here individually.
struct LinalgElementwiseOpFusionPass
- : public impl::LinalgElementwiseOpFusionBase<
+ : public impl::LinalgElementwiseOpFusionPassBase<
LinalgElementwiseOpFusionPass> {
+ using impl::LinalgElementwiseOpFusionPassBase<
+ LinalgElementwiseOpFusionPass>::LinalgElementwiseOpFusionPassBase;
void runOnOperation() override {
Operation *op = getOperation();
MLIRContext *context = op->getContext();
@@ -1963,7 +1964,3 @@ struct LinalgElementwiseOpFusionPass
};
} // namespace
-
-std::unique_ptr<Pass> mlir::createLinalgElementwiseOpFusionPass() {
- return std::make_unique<LinalgElementwiseOpFusionPass>();
-}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
index 9088a1de837a79..5508aaf9d87537 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
@@ -15,7 +15,7 @@
#include "mlir/Transforms/DialectConversion.h"
namespace mlir {
-#define GEN_PASS_DEF_CONVERTELEMENTWISETOLINALG
+#define GEN_PASS_DEF_CONVERTELEMENTWISETOLINALGPASS
#include "mlir/Dialect/Linalg/Passes.h.inc"
} // namespace mlir
@@ -121,8 +121,10 @@ void mlir::linalg::populateElementwiseToLinalgConversionPatterns(
namespace {
class ConvertElementwiseToLinalgPass
- : public impl::ConvertElementwiseToLinalgBase<
+ : public impl::ConvertElementwiseToLinalgPassBase<
ConvertElementwiseToLinalgPass> {
+ using impl::ConvertElementwiseToLinalgPassBase<
+ ConvertElementwiseToLinalgPass>::ConvertElementwiseToLinalgPassBase;
void runOnOperation() final {
auto *func = getOperation();
@@ -140,7 +142,3 @@ class ConvertElementwiseToLinalgPass
}
};
} // namespace
-
-std::unique_ptr<Pass> mlir::createConvertElementwiseToLinalgPass() {
- return std::make_unique<ConvertElementwiseToLinalgPass>();
-}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp
index d03d1f3a163c32..7ab3fef5dd039d 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp
@@ -26,7 +26,7 @@
#include "llvm/Support/Debug.h"
namespace mlir {
-#define GEN_PASS_DEF_LINALGGENERALIZATION
+#define GEN_PASS_DEF_LINALGGENERALIZENAMEDOPSPASS
#include "mlir/Dialect/Linalg/Passes.h.inc"
} // namespace mlir
@@ -76,14 +76,17 @@ FailureOr<GenericOp> mlir::linalg::generalizeNamedOp(RewriterBase &rewriter,
namespace {
-struct LinalgGeneralizationPass
- : public impl::LinalgGeneralizationBase<LinalgGeneralizationPass> {
+struct LinalgGeneralizeNamedOpsPass
+ : public impl::LinalgGeneralizeNamedOpsPassBase<
+ LinalgGeneralizeNamedOpsPass> {
+ using impl::LinalgGeneralizeNamedOpsPassBase<
+ LinalgGeneralizeNamedOpsPass>::LinalgGeneralizeNamedOpsPassBase;
void runOnOperation() override;
};
} // namespace
-void LinalgGeneralizationPass::runOnOperation() {
+void LinalgGeneralizeNamedOpsPass::runOnOperation() {
RewritePatternSet patterns(&getContext());
populateLinalgNamedOpsGeneralizationPatterns(patterns);
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
@@ -93,7 +96,3 @@ void mlir::linalg::populateLinalgNamedOpsGeneralizationPatterns(
RewritePatternSet &patterns) {
patterns.add<LinalgGeneralizationPattern>(patterns.getContext());
}
-
-std::unique_ptr<Pass> mlir::createLinalgGeneralizationPass() {
- return std::make_unique<LinalgGeneralizationPass>();
-}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp b/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp
index 34db710b1721d6..6db51f4b84d112 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp
@@ -23,7 +23,7 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace mlir {
-#define GEN_PASS_DEF_LINALGINLINESCALAROPERANDS
+#define GEN_PASS_DEF_LINALGINLINESCALAROPERANDSPASS
#include "mlir/Dialect/Linalg/Passes.h.inc"
} // namespace mlir
@@ -101,8 +101,10 @@ void mlir::linalg::populateInlineConstantOperandsPatterns(
namespace {
/// Pass that removes unit-extent dims within generic ops.
struct LinalgInlineScalarOperandsPass
- : public impl::LinalgInlineScalarOperandsBase<
+ : public impl::LinalgInlineScalarOperandsPassBase<
LinalgInlineScalarOperandsPass> {
+ using impl::LinalgInlineScalarOperandsPassBase<
+ LinalgInlineScalarOperandsPass>::LinalgInlineScalarOperandsPassBase;
void runOnOperation() override {
Operation *op = getOperation();
MLIRContext &ctx = getContext();
@@ -112,7 +114,3 @@ struct LinalgInlineScalarOperandsPass
}
};
} // namespace
-
-std::unique_ptr<Pass> mlir::createLinalgInlineScalarOperandsPass() {
- return std::make_unique<LinalgInlineScalarOperandsPass>();
-}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
index 4c93da6fe9253f..b0a4de2da1e869 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
@@ -27,9 +27,9 @@
#include "llvm/ADT/TypeSwitch.h"
namespace mlir {
-#define GEN_PASS_DEF_LINALGLOWERTOAFFINELOOPS
-#define GEN_PASS_DEF_LINALGLOWERTOLOOPS
-#define GEN_PASS_DEF_LINALGLOWERTOPARALLELLOOPS
+#define GEN_PASS_DEF_CONVERTLINALGTOAFFINELOOPSPASS
+#define GEN_PASS_DEF_CONVERTLINALGTOLOOPSPASS
+#define GEN_PASS_DEF_CONVERTLINALGTOPARALLELLOOPSPASS
#include "mlir/Dialect/Linalg/Passes.h.inc"
} // namespace mlir
@@ -326,7 +326,9 @@ static void lowerLinalgToLoopsImpl(Operation *enclosingOp) {
}
struct LowerToAffineLoops
- : public impl::LinalgLowerToAffineLoopsBase<LowerToAffineLoops> {
+ : public impl::ConvertLinalgToAffineLoopsPassBase<LowerToAffineLoops> {
+ using impl::ConvertLinalgToAffineLoopsPassBase<
+ LowerToAffineLoops>::ConvertLinalgToAffineLoopsPassBase;
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect>();
}
@@ -335,7 +337,9 @@ struct LowerToAffineLoops
}
};
-struct LowerToLoops : public impl::LinalgLowerToLoopsBase<LowerToLoops> {
+struct LowerToLoops : public impl::ConvertLinalgToLoopsPassBase<LowerToLoops> {
+ using impl::ConvertLinalgToLoopsPassBase<
+ LowerToLoops>::ConvertLinalgToLoopsPassBase;
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect, scf::SCFDialect>();
}
@@ -345,7 +349,9 @@ struct LowerToLoops : public impl::LinalgLowerToLoopsBase<LowerToLoops> {
};
struct LowerToParallelLoops
- : public impl::LinalgLowerToParallelLoopsBase<LowerToParallelLoops> {
+ : public impl::ConvertLinalgToParallelLoopsPassBase<LowerToParallelLoops> {
+ using impl::ConvertLinalgToParallelLoopsPassBase<
+ LowerToParallelLoops>::ConvertLinalgToParallelLoopsPassBase;
void runOnOperation() override {
lowerLinalgToLoopsImpl<scf::ParallelOp>(getOperation());
}
@@ -353,18 +359,6 @@ struct LowerToParallelLoops
} // namespace
-std::unique_ptr<Pass> mlir::createConvertLinalgToLoopsPass() {
- return std::make_unique<LowerToLoops>();
-}
-
-std::unique_ptr<Pass> mlir::createConvertLinalgToParallelLoopsPass() {
- return std::make_unique<LowerToParallelLoops>();
-}
-
-std::unique_ptr<Pass> mlir::createConvertLinalgToAffineLoopsPass() {
- return std::make_unique<LowerToAffineLoops>();
-}
-
/// Emits a loop nest of `affine.for` with the proper body for `linalgOp`.
FailureOr<LinalgLoops>
mlir::linalg::linalgOpToAffineLoops(RewriterBase &rewriter, LinalgOp linalgOp) {
diff --git a/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp b/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp
index 250360603fa5dd..84bde1bc0b8464 100644
--- a/...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/82892
More information about the Mlir-commits
mailing list