[Mlir-commits] [mlir] 3dddd89 - [mlir][Pass] Move the registration of conversion passes to tablegen
River Riddle
llvmlistbot at llvm.org
Wed Apr 1 02:12:15 PDT 2020
Author: River Riddle
Date: 2020-04-01T02:10:46-07:00
New Revision: 3dddd8969f4d5bb05d65c6014934e24795843182
URL: https://github.com/llvm/llvm-project/commit/3dddd8969f4d5bb05d65c6014934e24795843182
DIFF: https://github.com/llvm/llvm-project/commit/3dddd8969f4d5bb05d65c6014934e24795843182.diff
LOG: [mlir][Pass] Move the registration of conversion passes to tablegen
This removes the need to statically register conversion passes, and also puts all of the conversions within one centralized file.
Differential Revision: https://reviews.llvm.org/D76658
Added:
mlir/include/mlir/Conversion/CMakeLists.txt
mlir/include/mlir/Conversion/Passes.td
Modified:
mlir/include/mlir/CMakeLists.txt
mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h
mlir/include/mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h
mlir/include/mlir/InitAllPasses.h
mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt
mlir/lib/Conversion/AVX512ToLLVM/ConvertAVX512ToLLVM.cpp
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp
mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp
mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
mlir/lib/Conversion/LoopToStandard/LoopToStandard.cpp
mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp
mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp
mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp
mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/CMakeLists.txt b/mlir/include/mlir/CMakeLists.txt
index 0c5bd587b8ca..594dc6180f50 100644
--- a/mlir/include/mlir/CMakeLists.txt
+++ b/mlir/include/mlir/CMakeLists.txt
@@ -1,3 +1,4 @@
+add_subdirectory(Conversion)
add_subdirectory(Dialect)
add_subdirectory(IR)
add_subdirectory(Interfaces)
diff --git a/mlir/include/mlir/Conversion/CMakeLists.txt b/mlir/include/mlir/Conversion/CMakeLists.txt
new file mode 100644
index 000000000000..406227a04f76
--- /dev/null
+++ b/mlir/include/mlir/Conversion/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRConversionPassIncGen)
diff --git a/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h b/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h
index d5f48d29ea6c..049e8538d746 100644
--- a/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h
+++ b/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h
@@ -27,6 +27,7 @@ class Pass;
/// calling the conversion.
std::unique_ptr<OpPassBase<FuncOp>>
createSimpleLoopsToGPUPass(unsigned numBlockDims, unsigned numThreadDims);
+std::unique_ptr<OpPassBase<FuncOp>> createSimpleLoopsToGPUPass();
/// Create a pass that converts every loop operation within the body of the
/// FuncOp into a GPU launch. The number of workgroups and workgroup size for
@@ -37,6 +38,7 @@ createSimpleLoopsToGPUPass(unsigned numBlockDims, unsigned numThreadDims);
std::unique_ptr<OpPassBase<FuncOp>>
createLoopToGPUPass(ArrayRef<int64_t> numWorkGroups,
ArrayRef<int64_t> workGroupSize);
+std::unique_ptr<OpPassBase<FuncOp>> createLoopToGPUPass();
/// Creates a pass that converts loop.parallel operations into a gpu.launch
/// operation. The mapping of loop dimensions to launch dimensions is derived
diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
new file mode 100644
index 000000000000..30e1a836f4eb
--- /dev/null
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -0,0 +1,168 @@
+//===-- Passes.td - Conversion pass definition file --------*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_CONVERSION_PASSES
+#define MLIR_CONVERSION_PASSES
+
+include "mlir/Pass/PassBase.td"
+
+//===----------------------------------------------------------------------===//
+// AffineToStandard
+//===----------------------------------------------------------------------===//
+
+def ConvertAffineToStandard : Pass<"lower-affine"> {
+ let summary = "Lower Affine operations to a combination of Standard and Loop "
+ "operations";
+ let constructor = "mlir::createLowerAffinePass()";
+}
+
+//===----------------------------------------------------------------------===//
+// AVX512ToLLVM
+//===----------------------------------------------------------------------===//
+
+def ConvertAVX512ToLLVM : Pass<"convert-avx512-to-llvm"> {
+ let summary = "Convert the operations from the avx512 dialect into the LLVM "
+ "dialect";
+ let constructor = "mlir::createConvertAVX512ToLLVMPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// GPUToCUDA
+//===----------------------------------------------------------------------===//
+
+def ConvertGpuLaunchFuncToCudaCalls : Pass<"launch-func-to-cuda"> {
+ let summary = "Convert all launch_func ops to CUDA runtime calls";
+ let constructor = "mlir::createConvertGpuLaunchFuncToCudaCallsPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// GPUToNVVM
+//===----------------------------------------------------------------------===//
+
+def ConvertGpuOpsToNVVMOps : Pass<"convert-gpu-to-nvvm"> {
+ let summary = "Generate NVVM operations for gpu operations";
+ let constructor = "mlir::createLowerGpuOpsToNVVMOpsPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// GPUToROCDL
+//===----------------------------------------------------------------------===//
+
+def ConvertGpuOpsToROCDLOps : Pass<"convert-gpu-to-rocdl"> {
+ let summary = "Generate ROCDL operations for gpu operations";
+ let constructor = "mlir::createLowerGpuOpsToROCDLOpsPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// GPUToSPIRV
+//===----------------------------------------------------------------------===//
+
+def ConvertGPUToSPIRV : Pass<"convert-gpu-to-spirv"> {
+ let summary = "Convert GPU dialect to SPIR-V dialect";
+ let constructor = "mlir::createConvertGPUToSPIRVPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// GPUToVulkan
+//===----------------------------------------------------------------------===//
+
+def ConvertGpuLaunchFuncToVulkanLaunchFunc
+ : Pass<"convert-gpu-launch-to-vulkan-launch"> {
+ let summary = "Convert gpu.launch_func to vulkanLaunch external call";
+ let constructor = "mlir::createConvertGpuLaunchFuncToVulkanLaunchFuncPass()";
+}
+
+def ConvertVulkanLaunchFuncToVulkanCalls : Pass<"launch-func-to-vulkan"> {
+ let summary = "Convert vulkanLaunch external call to Vulkan runtime external "
+ "calls";
+ let constructor = "mlir::createConvertVulkanLaunchFuncToVulkanCallsPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// LinalgToLLVM
+//===----------------------------------------------------------------------===//
+
+def ConvertLinalgToLLVM : Pass<"convert-linalg-to-llvm"> {
+ let summary = "Convert the operations from the linalg dialect into the LLVM "
+ "dialect";
+ let constructor = "mlir::createConvertLinalgToLLVMPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// LinalgToSPIRV
+//===----------------------------------------------------------------------===//
+
+def ConvertLinalgToSPIRV : Pass<"convert-linalg-to-spirv"> {
+ let summary = "Convert Linalg ops to SPIR-V ops";
+ let constructor = "mlir::createLinalgToSPIRVPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// LoopToStandard
+//===----------------------------------------------------------------------===//
+
+def ConvertLoopToStandard : Pass<"convert-loop-to-std"> {
+ let summary = "Convert Loop dialect to Standard dialect, replacing structured"
+ " control flow with a CFG";
+ let constructor = "mlir::createLowerToCFGPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// LoopsToGPU
+//===----------------------------------------------------------------------===//
+
+def ConvertSimpleLoopsToGPU : Pass<"convert-loops-to-gpu"> {
+ let summary = "Convert top-level loops to GPU kernels";
+ let constructor = "mlir::createSimpleLoopsToGPUPass()";
+}
+
+def ConvertLoopsToGPU : Pass<"convert-loop-op-to-gpu"> {
+ let summary = "Convert top-level loop::ForOp to GPU kernels";
+ let constructor = "mlir::createLoopToGPUPass()";
+}
+
+def ConvertParallelLoopToGpu : Pass<"convert-parallel-loops-to-gpu"> {
+ let summary = "Convert mapped loop.parallel ops to gpu launch operations";
+ let constructor = "mlir::createParallelLoopToGpuPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// StandardToLLVM
+//===----------------------------------------------------------------------===//
+
+def ConvertStandardToLLVM : Pass<"convert-std-to-llvm"> {
+ let summary = "Convert scalar and vector operations from the Standard to the "
+ "LLVM dialect";
+ let constructor = "mlir::createLowerToLLVMPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// StandardToSPIRV
+//===----------------------------------------------------------------------===//
+
+def LegalizeStandardForSPIRV : Pass<"legalize-std-for-spirv"> {
+ let summary = "Legalize standard ops for SPIR-V lowering";
+ let constructor = "mlir::createLegalizeStdOpsForSPIRVLoweringPass()";
+}
+
+def ConvertStandardToSPIRV : Pass<"convert-std-to-spirv"> {
+ let summary = "Convert Standard Ops to SPIR-V dialect";
+ let constructor = "mlir::createConvertStandardToSPIRVPass()";
+}
+
+//===----------------------------------------------------------------------===//
+// VectorToLLVM
+//===----------------------------------------------------------------------===//
+
+def ConvertVectorToLLVM : Pass<"convert-vector-to-llvm"> {
+ let summary = "Lower the operations from the vector dialect into the LLVM "
+ "dialect";
+ let constructor = "mlir::createConvertVectorToLLVMPass()";
+}
+
+#endif // MLIR_CONVERSION_PASSES
diff --git a/mlir/include/mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h b/mlir/include/mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h
index 5c45a3c32ca0..e96b7cfe76e5 100644
--- a/mlir/include/mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h
+++ b/mlir/include/mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h
@@ -5,23 +5,18 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
+
#ifndef MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLOOPS_H_
#define MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLOOPS_H_
-#include "mlir/Transforms/DialectConversion.h"
-
namespace mlir {
class MLIRContext;
-class ModuleOp;
-template <typename T> class OpPassBase;
+class OwningRewritePatternList;
/// Collect a set of patterns to convert from the Vector dialect to loops + std.
void populateVectorToAffineLoopsConversionPatterns(
MLIRContext *context, OwningRewritePatternList &patterns);
-/// Create a pass to convert vector operations to affine loops + std dialect.
-OpPassBase<ModuleOp> *createLowerVectorToLoopsPass();
-
} // namespace mlir
#endif // MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLOOPS_H_
diff --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h
index 4e5173b43b8c..08d267a9cf18 100644
--- a/mlir/include/mlir/InitAllPasses.h
+++ b/mlir/include/mlir/InitAllPasses.h
@@ -22,8 +22,11 @@
#include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
#include "mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h"
#include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h"
+#include "mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h"
#include "mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h"
+#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h"
+#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/FxpMathOps/Passes.h"
#include "mlir/Dialect/GPU/Passes.h"
@@ -54,6 +57,10 @@ inline void registerAllPasses() {
#define GEN_PASS_REGISTRATION
#include "mlir/Transforms/Passes.h.inc"
+ // Conversion passes
+#define GEN_PASS_REGISTRATION
+#include "mlir/Conversion/Passes.h.inc"
+
// Affine
#define GEN_PASS_REGISTRATION
#include "mlir/Dialect/Affine/Passes.h.inc"
@@ -87,45 +94,6 @@ inline void registerAllPasses() {
// SPIR-V
#define GEN_PASS_REGISTRATION
#include "mlir/Dialect/SPIRV/Passes.h.inc"
-
- // At the moment we still rely on global initializers for registering passes,
- // but we may not do it in the future.
- // We must reference the passes in such a way that compilers will not
- // delete it all as dead code, even with whole program optimization,
- // yet is effectively a NO-OP. As the compiler isn't smart enough
- // to know that getenv() never returns -1, this will do the job.
- if (std::getenv("bar") != (char *)-1)
- return;
-
- // Affine
- createLowerAffinePass();
-
- // AVX512
- createConvertAVX512ToLLVMPass();
-
- // GPUtoRODCLPass
- createLowerGpuOpsToROCDLOpsPass();
-
- // GPU
- createSimpleLoopsToGPUPass(0, 0);
- createLoopToGPUPass({}, {});
-
- // CUDA
- createConvertGpuLaunchFuncToCudaCallsPass();
- createLowerGpuOpsToNVVMOpsPass();
-
- // Linalg
- createConvertLinalgToLLVMPass();
-
- // SPIR-V
- createConvertGPUToSPIRVPass();
- createConvertStandardToSPIRVPass();
- createLegalizeStdOpsForSPIRVLoweringPass();
- createLinalgToSPIRVPass();
-
- // Vulkan
- createConvertGpuLaunchFuncToVulkanLaunchFuncPass();
- createConvertVulkanLaunchFuncToVulkanCallsPass();
}
} // namespace mlir
diff --git a/mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt b/mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt
index 5573f6ca1618..9df0d4fde7f1 100644
--- a/mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt
@@ -3,6 +3,9 @@ add_mlir_conversion_library(MLIRAVX512ToLLVM
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/AVX512ToLLVM
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
set(LIBS
diff --git a/mlir/lib/Conversion/AVX512ToLLVM/ConvertAVX512ToLLVM.cpp b/mlir/lib/Conversion/AVX512ToLLVM/ConvertAVX512ToLLVM.cpp
index af29714eb69a..59e2b21d76fc 100644
--- a/mlir/lib/Conversion/AVX512ToLLVM/ConvertAVX512ToLLVM.cpp
+++ b/mlir/lib/Conversion/AVX512ToLLVM/ConvertAVX512ToLLVM.cpp
@@ -191,7 +191,3 @@ void ConvertAVX512ToLLVMPass::runOnModule() {
std::unique_ptr<OpPassBase<ModuleOp>> mlir::createConvertAVX512ToLLVMPass() {
return std::make_unique<ConvertAVX512ToLLVMPass>();
}
-
-static PassRegistration<ConvertAVX512ToLLVMPass> pass(
- "convert-avx512-to-llvm",
- "Convert the operations from the avx512 dialect into the LLVM dialect");
diff --git a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
index ba9c02b452c8..d7685c87934c 100644
--- a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
+++ b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
@@ -594,7 +594,3 @@ class LowerAffinePass : public FunctionPass<LowerAffinePass> {
std::unique_ptr<OpPassBase<FuncOp>> mlir::createLowerAffinePass() {
return std::make_unique<LowerAffinePass>();
}
-
-static PassRegistration<LowerAffinePass>
- pass("lower-affine",
- "Lower affine dialect operations to loop/standard dialect ones");
diff --git a/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt b/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
index 5613b28e3418..821a1deb0a15 100644
--- a/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
+++ b/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
@@ -3,6 +3,9 @@ add_mlir_conversion_library(MLIRAffineToStandard
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/AffineToStandard
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
target_link_libraries(
MLIRAffineToStandard
diff --git a/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt b/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
index c8f0ded6bc19..a4c98e555322 100644
--- a/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
@@ -15,7 +15,12 @@ if (MLIR_CUDA_CONVERSIONS_ENABLED)
)
endif()
-add_mlir_conversion_library(MLIRGPUtoCUDATransforms ${SOURCES})
+add_mlir_conversion_library(MLIRGPUtoCUDATransforms
+ ${SOURCES}
+
+ DEPENDS
+ MLIRConversionPassIncGen
+)
target_link_libraries(MLIRGPUtoCUDATransforms
PUBLIC
${NVPTX_LIBS}
diff --git a/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp b/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp
index 7a275b42df60..0677ed65d059 100644
--- a/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp
+++ b/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp
@@ -465,7 +465,3 @@ std::unique_ptr<mlir::OpPassBase<mlir::ModuleOp>>
mlir::createConvertGpuLaunchFuncToCudaCallsPass() {
return std::make_unique<GpuLaunchFuncToCudaCallsPass>();
}
-
-static PassRegistration<GpuLaunchFuncToCudaCallsPass>
- pass("launch-func-to-cuda",
- "Convert all launch_func ops to CUDA runtime calls");
diff --git a/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt b/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
index 75d82e80260b..b7c583d57169 100644
--- a/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
@@ -6,6 +6,7 @@ add_mlir_conversion_library(MLIRGPUtoNVVMTransforms
LowerGpuOpsToNVVMOps.cpp
DEPENDS
+ MLIRConversionPassIncGen
MLIRGPUToNVVMIncGen
)
diff --git a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
index 18aeeb845b30..12903f57ef27 100644
--- a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
+++ b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
@@ -324,6 +324,3 @@ std::unique_ptr<OpPassBase<gpu::GPUModuleOp>>
mlir::createLowerGpuOpsToNVVMOpsPass() {
return std::make_unique<LowerGpuOpsToNVVMOpsPass>();
}
-
-static PassRegistration<LowerGpuOpsToNVVMOpsPass>
- pass("convert-gpu-to-nvvm", "Generate NVVM operations for gpu operations");
diff --git a/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt b/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
index 9acc53a4e788..142734c3ef89 100644
--- a/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
@@ -1,5 +1,8 @@
add_mlir_conversion_library(MLIRGPUtoROCDLTransforms
LowerGpuOpsToROCDLOps.cpp
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
target_link_libraries(MLIRGPUtoROCDLTransforms
PUBLIC
diff --git a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
index 79fb3771aff6..0be69cca41ed 100644
--- a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
+++ b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
@@ -84,6 +84,3 @@ mlir::createLowerGpuOpsToROCDLOpsPass() {
return std::make_unique<LowerGpuOpsToROCDLOpsPass>();
}
-static PassRegistration<LowerGpuOpsToROCDLOpsPass>
- pass("convert-gpu-to-rocdl",
- "Generate ROCDL operations for gpu operations");
diff --git a/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
index a0c5b6a1c32c..f473a3e04e51 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
@@ -7,6 +7,7 @@ add_mlir_conversion_library(MLIRGPUtoSPIRVTransforms
ConvertGPUToSPIRVPass.cpp
DEPENDS
+ MLIRConversionPassIncGen
MLIRGPUToSPIRVIncGen
)
diff --git a/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp b/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp
index 272eb163ab69..d8262249c32f 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp
@@ -10,6 +10,7 @@
// into a spv.module operation
//
//===----------------------------------------------------------------------===//
+
#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h"
#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h"
#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h"
@@ -19,7 +20,6 @@
#include "mlir/Dialect/SPIRV/SPIRVLowering.h"
#include "mlir/Dialect/SPIRV/SPIRVOps.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Pass/PassRegistry.h"
using namespace mlir;
@@ -70,6 +70,3 @@ void GPUToSPIRVPass::runOnModule() {
std::unique_ptr<OpPassBase<ModuleOp>> mlir::createConvertGPUToSPIRVPass() {
return std::make_unique<GPUToSPIRVPass>();
}
-
-static PassRegistration<GPUToSPIRVPass>
- pass("convert-gpu-to-spirv", "Convert GPU dialect to SPIR-V dialect");
diff --git a/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt b/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
index 847c9c5031e9..ecfc2d75d5f3 100644
--- a/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
@@ -1,6 +1,9 @@
add_mlir_conversion_library(MLIRGPUtoVulkanTransforms
ConvertLaunchFuncToVulkanCalls.cpp
ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
target_link_libraries(MLIRGPUtoVulkanTransforms
diff --git a/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp b/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
index ad74ad417e52..b025da9ff133 100644
--- a/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
+++ b/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
@@ -169,7 +169,3 @@ std::unique_ptr<mlir::OpPassBase<mlir::ModuleOp>>
mlir::createConvertGpuLaunchFuncToVulkanLaunchFuncPass() {
return std::make_unique<ConvertGpuLaunchFuncToVulkanLaunchFunc>();
}
-
-static PassRegistration<ConvertGpuLaunchFuncToVulkanLaunchFunc>
- pass("convert-gpu-launch-to-vulkan-launch",
- "Convert gpu.launch_func to vulkanLaunch external call");
diff --git a/mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp b/mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
index d03adc2c64ac..76ad84d440b8 100644
--- a/mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
+++ b/mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
@@ -428,7 +428,3 @@ std::unique_ptr<mlir::OpPassBase<mlir::ModuleOp>>
mlir::createConvertVulkanLaunchFuncToVulkanCallsPass() {
return std::make_unique<VulkanLaunchFuncToVulkanCallsPass>();
}
-
-static PassRegistration<VulkanLaunchFuncToVulkanCallsPass>
- pass("launch-func-to-vulkan",
- "Convert vulkanLaunch external call to Vulkan runtime external calls");
diff --git a/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt b/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
index 4f21ca208bfd..72e0966f447b 100644
--- a/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
@@ -3,6 +3,9 @@ add_mlir_conversion_library(MLIRLinalgToLLVM
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LinalgToLLVM
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
set(LIBS
MLIRAffineToStandard
diff --git a/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp b/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
index b493aa662db0..8baf278c8e55 100644
--- a/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
+++ b/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
@@ -587,7 +587,3 @@ void ConvertLinalgToLLVMPass::runOnModule() {
std::unique_ptr<OpPassBase<ModuleOp>> mlir::createConvertLinalgToLLVMPass() {
return std::make_unique<ConvertLinalgToLLVMPass>();
}
-
-static PassRegistration<ConvertLinalgToLLVMPass> pass(
- "convert-linalg-to-llvm",
- "Convert the operations from the linalg dialect into the LLVM dialect");
diff --git a/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
index 52a813470f02..f0cc53223366 100644
--- a/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
+++ b/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
@@ -5,6 +5,9 @@ add_mlir_conversion_library(MLIRLinalgToSPIRVTransforms
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
target_link_libraries(MLIRLinalgToSPIRVTransforms
diff --git a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
index 4477c070796e..ebac1f9418c6 100644
--- a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
@@ -46,6 +46,3 @@ void LinalgToSPIRVPass::runOnModule() {
std::unique_ptr<OpPassBase<ModuleOp>> mlir::createLinalgToSPIRVPass() {
return std::make_unique<LinalgToSPIRVPass>();
}
-
-static PassRegistration<LinalgToSPIRVPass>
- pass("convert-linalg-to-spirv", "Convert Linalg ops to SPIR-V ops");
diff --git a/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt b/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
index d0401d80fe93..d4c752847583 100644
--- a/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
+++ b/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
@@ -3,6 +3,9 @@ add_mlir_conversion_library(MLIRLoopToStandard
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopToStandard
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
target_link_libraries(
MLIRLoopToStandard
diff --git a/mlir/lib/Conversion/LoopToStandard/LoopToStandard.cpp b/mlir/lib/Conversion/LoopToStandard/LoopToStandard.cpp
index 2bcf32523196..bf81a2317b07 100644
--- a/mlir/lib/Conversion/LoopToStandard/LoopToStandard.cpp
+++ b/mlir/lib/Conversion/LoopToStandard/LoopToStandard.cpp
@@ -364,7 +364,3 @@ void LoopToStandardPass::runOnOperation() {
std::unique_ptr<Pass> mlir::createLowerToCFGPass() {
return std::make_unique<LoopToStandardPass>();
}
-
-static PassRegistration<LoopToStandardPass>
- pass("convert-loop-to-std", "Convert Loop dialect to Standard dialect, "
- "replacing structured control flow with a CFG");
diff --git a/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt b/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
index 9a460bcf7165..2c62755eebc8 100644
--- a/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
+++ b/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
@@ -4,6 +4,9 @@ add_mlir_conversion_library(MLIRLoopsToGPU
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopsToGPU
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
target_link_libraries(MLIRLoopsToGPU
PUBLIC
diff --git a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp b/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp
index 9a5e2a608df9..69ea260610ec 100644
--- a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp
+++ b/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp
@@ -135,6 +135,9 @@ mlir::createSimpleLoopsToGPUPass(unsigned numBlockDims,
unsigned numThreadDims) {
return std::make_unique<ForLoopMapper>(numBlockDims, numThreadDims);
}
+std::unique_ptr<OpPassBase<FuncOp>> mlir::createSimpleLoopsToGPUPass() {
+ return std::make_unique<ForLoopMapper>();
+}
std::unique_ptr<OpPassBase<FuncOp>>
mlir::createLoopToGPUPass(ArrayRef<int64_t> numWorkGroups,
@@ -142,18 +145,10 @@ mlir::createLoopToGPUPass(ArrayRef<int64_t> numWorkGroups,
return std::make_unique<ImperfectlyNestedForLoopMapper>(numWorkGroups,
workGroupSize);
}
+std::unique_ptr<OpPassBase<FuncOp>> mlir::createLoopToGPUPass() {
+ return std::make_unique<ImperfectlyNestedForLoopMapper>();
+}
std::unique_ptr<Pass> mlir::createParallelLoopToGpuPass() {
return std::make_unique<ParallelLoopToGpuPass>();
}
-
-static PassRegistration<ForLoopMapper>
- registration(PASS_NAME, "Convert top-level loops to GPU kernels");
-
-static PassRegistration<ImperfectlyNestedForLoopMapper>
- loopOpToGPU(LOOPOP_TO_GPU_PASS_NAME,
- "Convert top-level loop::ForOp to GPU kernels");
-
-static PassRegistration<ParallelLoopToGpuPass>
- pass("convert-parallel-loops-to-gpu", "Convert mapped loop.parallel ops"
- " to gpu launch operations.");
diff --git a/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt b/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
index 3a5b2f6ba06c..ef7ad11d93ef 100644
--- a/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
@@ -3,6 +3,9 @@ add_mlir_conversion_library(MLIRStandardToLLVM
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/StandardToLLVM
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
target_link_libraries(
MLIRStandardToLLVM
diff --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
index 38e4854f9f2f..fdef9a98d650 100644
--- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
+++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
@@ -2881,7 +2881,3 @@ mlir::createLowerToLLVMPass(bool useAlloca, bool useBarePtrCallConv,
return std::make_unique<LLVMLoweringPass>(useAlloca, useBarePtrCallConv,
emitCWrappers, indexBitwidth);
}
-
-static PassRegistration<LLVMLoweringPass>
- pass(PASS_NAME, "Convert scalar and vector operations from the "
- "Standard to the LLVM dialect");
diff --git a/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
index 6d940eaf024e..bb249078d62c 100644
--- a/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
+++ b/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
@@ -6,6 +6,9 @@ add_mlir_conversion_library(MLIRStandardToSPIRVTransforms
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
target_link_libraries(MLIRStandardToSPIRVTransforms
diff --git a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp
index efccd168d6ea..569adb6f0593 100644
--- a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp
@@ -48,6 +48,3 @@ void ConvertStandardToSPIRVPass::runOnModule() {
std::unique_ptr<OpPassBase<ModuleOp>> mlir::createConvertStandardToSPIRVPass() {
return std::make_unique<ConvertStandardToSPIRVPass>();
}
-
-static PassRegistration<ConvertStandardToSPIRVPass>
- pass("convert-std-to-spirv", "Convert Standard Ops to SPIR-V dialect");
diff --git a/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp b/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp
index 3af01e025801..e7a98a8cc45b 100644
--- a/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp
+++ b/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp
@@ -175,6 +175,3 @@ void SPIRVLegalization::runOnOperation() {
std::unique_ptr<Pass> mlir::createLegalizeStdOpsForSPIRVLoweringPass() {
return std::make_unique<SPIRVLegalization>();
}
-
-static PassRegistration<SPIRVLegalization>
- pass("legalize-std-for-spirv", "Legalize standard ops for SPIR-V lowering");
diff --git a/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt b/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
index 734af0b96a39..ffc6da95da7e 100644
--- a/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
@@ -3,6 +3,9 @@ add_mlir_conversion_library(MLIRVectorToLLVM
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLLVM
+
+ DEPENDS
+ MLIRConversionPassIncGen
)
set(LIBS
MLIRLLVMIR
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index 2b3020d046a2..498b5a79cdd9 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -1153,7 +1153,3 @@ void LowerVectorToLLVMPass::runOnModule() {
std::unique_ptr<OpPassBase<ModuleOp>> mlir::createConvertVectorToLLVMPass() {
return std::make_unique<LowerVectorToLLVMPass>();
}
-
-static PassRegistration<LowerVectorToLLVMPass>
- pass("convert-vector-to-llvm",
- "Lower the operations from the vector dialect into the LLVM dialect");
More information about the Mlir-commits
mailing list