[Mlir-commits] [mlir] 939c5cf - [MLIR] Migrate MemRef -> LLVM conversion pass to the auto-generated constructor
Michele Scuttari
llvmlistbot at llvm.org
Mon Sep 26 00:55:57 PDT 2022
Author: Michele Scuttari
Date: 2022-09-26T09:54:53+02:00
New Revision: 939c5cf6a7d9e86745db47f3edcb160224afda89
URL: https://github.com/llvm/llvm-project/commit/939c5cf6a7d9e86745db47f3edcb160224afda89
DIFF: https://github.com/llvm/llvm-project/commit/939c5cf6a7d9e86745db47f3edcb160224afda89.diff
LOG: [MLIR] Migrate MemRef -> LLVM conversion pass to the auto-generated constructor
See #57475
Differential Revision: https://reviews.llvm.org/D134607
Added:
Modified:
mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h
mlir/include/mlir/Conversion/Passes.td
mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
mlir/unittests/ExecutionEngine/Invoke.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h b/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h
index 906c1152bd2d0..34d01392e2606 100644
--- a/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h
+++ b/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h
@@ -16,15 +16,13 @@ class Pass;
class LLVMTypeConverter;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTMEMREFTOLLVM
+#define GEN_PASS_DECL_MEMREFTOLLVMCONVERSIONPASS
#include "mlir/Conversion/Passes.h.inc"
/// Collect a set of patterns to convert memory-related operations from the
/// MemRef dialect to the LLVM dialect.
void populateMemRefToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);
-
-std::unique_ptr<Pass> createMemRefToLLVMPass();
} // namespace mlir
#endif // MLIR_CONVERSION_MEMREFTOLLVM_MEMREFTOLLVM_H
diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
index 6163c6ae5d0cb..5f48481647935 100644
--- a/mlir/include/mlir/Conversion/Passes.td
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -541,10 +541,9 @@ def ConvertMathToFuncs : Pass<"convert-math-to-funcs", "ModuleOp"> {
// MemRefToLLVM
//===----------------------------------------------------------------------===//
-def ConvertMemRefToLLVM : Pass<"convert-memref-to-llvm", "ModuleOp"> {
+def MemRefToLLVMConversionPass : Pass<"convert-memref-to-llvm", "ModuleOp"> {
let summary = "Convert operations from the MemRef dialect to the LLVM "
"dialect";
- let constructor = "mlir::createMemRefToLLVMPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
let options = [
Option<"useAlignedAlloc", "use-aligned-alloc", "bool", /*default=*/"false",
diff --git a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
index 8fe631b25bad4..c691c07f9bc4d 100644
--- a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
+++ b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
@@ -24,7 +24,7 @@
#include "llvm/ADT/SmallBitVector.h"
namespace mlir {
-#define GEN_PASS_DEF_CONVERTMEMREFTOLLVM
+#define GEN_PASS_DEF_MEMREFTOLLVMCONVERSIONPASS
#include "mlir/Conversion/Passes.h.inc"
} // namespace mlir
@@ -2108,9 +2108,9 @@ void mlir::populateMemRefToLLVMConversionPatterns(LLVMTypeConverter &converter,
}
namespace {
-struct MemRefToLLVMPass
- : public impl::ConvertMemRefToLLVMBase<MemRefToLLVMPass> {
- MemRefToLLVMPass() = default;
+struct MemRefToLLVMConversionPass
+ : public impl::MemRefToLLVMConversionPassBase<MemRefToLLVMConversionPass> {
+ using MemRefToLLVMConversionPassBase::MemRefToLLVMConversionPassBase;
void runOnOperation() override {
Operation *op = getOperation();
@@ -2137,7 +2137,3 @@ struct MemRefToLLVMPass
}
};
} // namespace
-
-std::unique_ptr<Pass> mlir::createMemRefToLLVMPass() {
- return std::make_unique<MemRefToLLVMPass>();
-}
diff --git a/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp b/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
index fa8209ee94f7e..4b961a76bf496 100644
--- a/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
@@ -76,7 +76,7 @@ void mlir::sparse_tensor::buildSparseCompiler(
pm.addNestedPass<func::FuncOp>(createConvertSCFToCFPass());
pm.addPass(createLowerAffinePass());
pm.addPass(createConvertVectorToLLVMPass(options.lowerVectorToLLVMOptions()));
- pm.addPass(createMemRefToLLVMPass());
+ pm.addPass(createMemRefToLLVMConversionPass());
pm.addNestedPass<func::FuncOp>(createConvertComplexToStandardPass());
pm.addNestedPass<mlir::func::FuncOp>(
mlir::arith::createArithmeticExpandOpsPass());
diff --git a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
index 8dbbd17ba0a08..69d77fc7336b7 100644
--- a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
+++ b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
@@ -55,7 +55,7 @@ static LogicalResult runMLIRPasses(ModuleOp module) {
passManager.addPass(createConvertGpuLaunchFuncToVulkanLaunchFuncPass());
LowerToLLVMOptions llvmOptions(module.getContext(), DataLayout(module));
- passManager.addPass(createMemRefToLLVMPass());
+ passManager.addPass(createMemRefToLLVMConversionPass());
passManager.nest<func::FuncOp>().addPass(LLVM::createRequestCWrappersPass());
passManager.addPass(createConvertFuncToLLVMPass(llvmOptions));
passManager.addPass(createReconcileUnrealizedCastsPass());
diff --git a/mlir/unittests/ExecutionEngine/Invoke.cpp b/mlir/unittests/ExecutionEngine/Invoke.cpp
index 60b5be6198ee6..676293a002eea 100644
--- a/mlir/unittests/ExecutionEngine/Invoke.cpp
+++ b/mlir/unittests/ExecutionEngine/Invoke.cpp
@@ -53,7 +53,7 @@ static struct LLVMInitializer {
/// dialects lowering to LLVM Dialect.
static LogicalResult lowerToLLVMDialect(ModuleOp module) {
PassManager pm(module.getContext());
- pm.addPass(mlir::createMemRefToLLVMPass());
+ pm.addPass(mlir::createMemRefToLLVMConversionPass());
pm.addNestedPass<func::FuncOp>(
mlir::arith::createConvertArithmeticToLLVMPass());
pm.addPass(mlir::createConvertFuncToLLVMPass());
More information about the Mlir-commits
mailing list