[Mlir-commits] [mlir] e3d834a - [mlir][Pass] Move the registration of dialect passes to tablegen

River Riddle llvmlistbot at llvm.org
Wed Apr 1 02:12:13 PDT 2020


Author: River Riddle
Date: 2020-04-01T02:10:46-07:00
New Revision: e3d834a54afa65c615b8eb839f4fe5dbaf53e3e8

URL: https://github.com/llvm/llvm-project/commit/e3d834a54afa65c615b8eb839f4fe5dbaf53e3e8
DIFF: https://github.com/llvm/llvm-project/commit/e3d834a54afa65c615b8eb839f4fe5dbaf53e3e8.diff

LOG: [mlir][Pass] Move the registration of dialect passes to tablegen

This generates a Passes.td for all of the dialects that have transformation passes. This removes the need for global registration for all of the dialect passes.

Differential Revision: https://reviews.llvm.org/D76657

Added: 
    mlir/include/mlir/Dialect/Affine/Passes.td
    mlir/include/mlir/Dialect/FxpMathOps/Passes.td
    mlir/include/mlir/Dialect/GPU/Passes.td
    mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
    mlir/include/mlir/Dialect/Linalg/Passes.td
    mlir/include/mlir/Dialect/LoopOps/Passes.td
    mlir/include/mlir/Dialect/Quant/Passes.td
    mlir/include/mlir/Dialect/SPIRV/Passes.td
    mlir/include/mlir/Quantizer/CMakeLists.txt
    mlir/include/mlir/Quantizer/Transforms/CMakeLists.txt
    mlir/include/mlir/Quantizer/Transforms/Passes.td

Modified: 
    mlir/include/mlir/CMakeLists.txt
    mlir/include/mlir/Dialect/Affine/CMakeLists.txt
    mlir/include/mlir/Dialect/Affine/Passes.h
    mlir/include/mlir/Dialect/FxpMathOps/CMakeLists.txt
    mlir/include/mlir/Dialect/FxpMathOps/Passes.h
    mlir/include/mlir/Dialect/GPU/CMakeLists.txt
    mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt
    mlir/include/mlir/Dialect/Linalg/CMakeLists.txt
    mlir/include/mlir/Dialect/Linalg/Passes.h
    mlir/include/mlir/Dialect/LoopOps/CMakeLists.txt
    mlir/include/mlir/Dialect/Quant/CMakeLists.txt
    mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt
    mlir/include/mlir/InitAllPasses.h
    mlir/include/mlir/Quantizer/Transforms/Passes.h
    mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
    mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
    mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
    mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
    mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
    mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
    mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
    mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
    mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
    mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp
    mlir/lib/Dialect/GPU/CMakeLists.txt
    mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
    mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt
    mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp
    mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
    mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
    mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
    mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
    mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
    mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
    mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopFusion.cpp
    mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopSpecialization.cpp
    mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopTiling.cpp
    mlir/lib/Dialect/Quant/CMakeLists.txt
    mlir/lib/Dialect/Quant/Transforms/ConvertConst.cpp
    mlir/lib/Dialect/Quant/Transforms/ConvertSimQuant.cpp
    mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
    mlir/lib/Dialect/SPIRV/Transforms/DecorateSPIRVCompositeTypeLayoutPass.cpp
    mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
    mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
    mlir/lib/Quantizer/CMakeLists.txt
    mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp
    mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp
    mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/CMakeLists.txt b/mlir/include/mlir/CMakeLists.txt
index 367207157415..0c5bd587b8ca 100644
--- a/mlir/include/mlir/CMakeLists.txt
+++ b/mlir/include/mlir/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_subdirectory(Dialect)
 add_subdirectory(IR)
 add_subdirectory(Interfaces)
+add_subdirectory(Quantizer)
 add_subdirectory(Transforms)

diff  --git a/mlir/include/mlir/Dialect/Affine/CMakeLists.txt b/mlir/include/mlir/Dialect/Affine/CMakeLists.txt
index f33061b2d87c..b1abb17f31c6 100644
--- a/mlir/include/mlir/Dialect/Affine/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/Affine/CMakeLists.txt
@@ -1 +1,5 @@
 add_subdirectory(IR)
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRAffinePassIncGen)

diff  --git a/mlir/include/mlir/Dialect/Affine/Passes.h b/mlir/include/mlir/Dialect/Affine/Passes.h
index 735c6c0360f5..75ff4a33649d 100644
--- a/mlir/include/mlir/Dialect/Affine/Passes.h
+++ b/mlir/include/mlir/Dialect/Affine/Passes.h
@@ -42,10 +42,14 @@ std::unique_ptr<OpPassBase<FuncOp>> createAffineDataCopyGenerationPass(
     unsigned slowMemorySpace, unsigned fastMemorySpace,
     unsigned tagMemorySpace = 0, int minDmaTransferSize = 1024,
     uint64_t fastMemCapacityBytes = std::numeric_limits<uint64_t>::max());
+/// Overload relying on pass options for initialization.
+std::unique_ptr<OpPassBase<FuncOp>> createAffineDataCopyGenerationPass();
 
 /// Creates a pass to perform tiling on loop nests.
 std::unique_ptr<OpPassBase<FuncOp>>
 createLoopTilingPass(uint64_t cacheSizeBytes);
+/// Overload relying on pass options for initialization.
+std::unique_ptr<OpPassBase<FuncOp>> createLoopTilingPass();
 
 /// Creates a loop unrolling pass with the provided parameters.
 /// 'getUnrollFactor' is a function callback for clients to supply a function
@@ -67,6 +71,8 @@ createLoopUnrollAndJamPass(int unrollJamFactor = -1);
 /// target-independent, n-D super-vector abstraction.
 std::unique_ptr<OpPassBase<FuncOp>>
 createSuperVectorizePass(ArrayRef<int64_t> virtualVectorSize);
+/// Overload relying on pass options for initialization.
+std::unique_ptr<OpPassBase<FuncOp>> createSuperVectorizePass();
 
 } // end namespace mlir
 

diff  --git a/mlir/include/mlir/Dialect/Affine/Passes.td b/mlir/include/mlir/Dialect/Affine/Passes.td
new file mode 100644
index 000000000000..5832e4200a44
--- /dev/null
+++ b/mlir/include/mlir/Dialect/Affine/Passes.td
@@ -0,0 +1,54 @@
+//===-- Passes.td - Affine 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains definitions for passes within the Affine/ directory.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DIALECT_AFFINE_PASSES
+#define MLIR_DIALECT_AFFINE_PASSES
+
+include "mlir/Pass/PassBase.td"
+
+def AffineDataCopyGeneration : Pass<"affine-data-copy-generate"> {
+  let summary = "Generate explicit copying for affine memory operations";
+  let constructor = "mlir::createAffineDataCopyGenerationPass()";
+}
+
+def AffineLoopInvariantCodeMotion : Pass<"affine-loop-invariant-code-motion"> {
+  let summary = "Hoist loop invariant instructions outside of affine loops";
+  let constructor = "mlir::createAffineLoopInvariantCodeMotionPass()";
+}
+
+def AffineLoopTiling : Pass<"affine-loop-tile"> {
+  let summary = "Tile affine loop nests";
+  let constructor = "mlir::createLoopTilingPass()";
+}
+
+def AffineLoopUnroll : Pass<"affine-loop-unroll"> {
+  let summary = "Unroll affine loops";
+  let constructor = "mlir::createLoopUnrollPass()";
+}
+
+def AffineLoopUnrollAndJam : Pass<"affine-loop-unroll-jam"> {
+  let summary = "Unroll and jam affine loops";
+  let constructor = "mlir::createLoopUnrollAndJamPass()";
+}
+
+def AffineVectorize : Pass<"affine-super-vectorize"> {
+  let summary = "Vectorize to a target independent n-D vector abstraction";
+  let constructor = "mlir::createSuperVectorizePass()";
+}
+
+def SimplifyAffineStructures : Pass<"simplify-affine-structures"> {
+  let summary = "Simplify affine expressions in maps/sets and normalize "
+                "memrefs";
+  let constructor = "mlir::createSimplifyAffineStructuresPass()";
+}
+
+#endif // MLIR_DIALECT_AFFINE_PASSES

diff  --git a/mlir/include/mlir/Dialect/FxpMathOps/CMakeLists.txt b/mlir/include/mlir/Dialect/FxpMathOps/CMakeLists.txt
index 2a493d6c1b20..7b9e54644c32 100644
--- a/mlir/include/mlir/Dialect/FxpMathOps/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/FxpMathOps/CMakeLists.txt
@@ -1,2 +1,6 @@
 add_mlir_dialect(FxpMathOps fxpmath)
 add_mlir_doc(FxpMathOps -gen-dialect-doc FxpMathDialect Dialects/)
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRFxpMathPassIncGen)

diff  --git a/mlir/include/mlir/Dialect/FxpMathOps/Passes.h b/mlir/include/mlir/Dialect/FxpMathOps/Passes.h
index 1039bcc9cb34..bec2e74f095f 100644
--- a/mlir/include/mlir/Dialect/FxpMathOps/Passes.h
+++ b/mlir/include/mlir/Dialect/FxpMathOps/Passes.h
@@ -13,6 +13,8 @@
 #ifndef MLIR_DIALECT_FXPMATHOPS_PASSES_H
 #define MLIR_DIALECT_FXPMATHOPS_PASSES_H
 
+#include <memory>
+
 namespace mlir {
 class FuncOp;
 template <typename T> class OpPassBase;
@@ -23,11 +25,11 @@ namespace fxpmath {
 /// arithmetic. This will leave unrecognized real math ops as-is and is
 /// typically followed by a pass that lowers any unrecognized ops to a pure
 /// floating point form.
-OpPassBase<FuncOp> *createLowerUniformRealMathPass();
+std::unique_ptr<OpPassBase<FuncOp>> createLowerUniformRealMathPass();
 
 /// Creates a pass that lowers uniform-quantized qcast/dcast ops to equivalent
 /// operations that perform quantize/dequantize.
-OpPassBase<FuncOp> *createLowerUniformCastsPass();
+std::unique_ptr<OpPassBase<FuncOp>> createLowerUniformCastsPass();
 
 } // namespace fxpmath
 } // namespace mlir

diff  --git a/mlir/include/mlir/Dialect/FxpMathOps/Passes.td b/mlir/include/mlir/Dialect/FxpMathOps/Passes.td
new file mode 100644
index 000000000000..254d200029f5
--- /dev/null
+++ b/mlir/include/mlir/Dialect/FxpMathOps/Passes.td
@@ -0,0 +1,24 @@
+//===-- Passes.td - FxpMath 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_DIALECT_FXPMATH_PASSES
+#define MLIR_DIALECT_FXPMATH_PASSES
+
+include "mlir/Pass/PassBase.td"
+
+def FxpMathLowerUniformCasts : Pass<"fxpmath-lower-uniform-casts"> {
+  let summary = "Lowers uniform-quantized casts";
+  let constructor = "mlir::fxpmath::createLowerUniformCastsPass()";
+}
+
+def FxpMathLowerUniformRealMath : Pass<"fxpmath-lower-uniform-real-math"> {
+  let summary = "Lowers uniform-quantized real math ops to integer arithmetic";
+  let constructor = "mlir::fxpmath::createLowerUniformRealMathPass()";
+}
+
+#endif // MLIR_DIALECT_FXPMATH_PASSES

diff  --git a/mlir/include/mlir/Dialect/GPU/CMakeLists.txt b/mlir/include/mlir/Dialect/GPU/CMakeLists.txt
index 8151c82f43d1..7ddb64bc48e2 100644
--- a/mlir/include/mlir/Dialect/GPU/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/GPU/CMakeLists.txt
@@ -10,3 +10,7 @@ set(LLVM_TARGET_DEFINITIONS ParallelLoopMapperAttr.td)
 mlir_tablegen(ParallelLoopMapperEnums.h.inc -gen-enum-decls)
 mlir_tablegen(ParallelLoopMapperEnums.cpp.inc -gen-enum-defs)
 add_public_tablegen_target(MLIRParallelLoopMapperEnumsGen)
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRGPUPassIncGen)

diff  --git a/mlir/include/mlir/Dialect/GPU/Passes.td b/mlir/include/mlir/Dialect/GPU/Passes.td
new file mode 100644
index 000000000000..563624308297
--- /dev/null
+++ b/mlir/include/mlir/Dialect/GPU/Passes.td
@@ -0,0 +1,19 @@
+//===-- Passes.td - GPU 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_DIALECT_GPU_PASSES
+#define MLIR_DIALECT_GPU_PASSES
+
+include "mlir/Pass/PassBase.td"
+
+def GpuKernelOutlining : Pass<"gpu-kernel-outlining"> {
+  let summary = "Outline gpu.launch bodies to kernel functions";
+  let constructor = "mlir::createGpuKernelOutliningPass()";
+}
+
+#endif // MLIR_DIALECT_GPU_PASSES

diff  --git a/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt b/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt
index d7e581b1b949..b81015f7cbf3 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt
@@ -28,3 +28,7 @@ add_mlir_dialect(LLVMAVX512 llvm_avx512 LLVMAVX512)
 set(LLVM_TARGET_DEFINITIONS LLVMAVX512.td)
 mlir_tablegen(LLVMAVX512Conversions.inc -gen-llvmir-conversions)
 add_public_tablegen_target(MLIRLLVMAVX512ConversionsIncGen)
+
+set(LLVM_TARGET_DEFINITIONS Transforms/Passes.td)
+mlir_tablegen(Transforms/Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRLLVMPassIncGen)

diff  --git a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
new file mode 100644
index 000000000000..0dc193e794f5
--- /dev/null
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
@@ -0,0 +1,19 @@
+//===-- Passes.td - LLVM 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_DIALECT_LLVMIR_TRANSFORMS_PASSES
+#define MLIR_DIALECT_LLVMIR_TRANSFORMS_PASSES
+
+include "mlir/Pass/PassBase.td"
+
+def LLVMLegalizeForExport : Pass<"llvm-legalize-for-export"> {
+  let summary = "Legalize LLVM dialect to be convertible to LLVM IR";
+  let constructor = "mlir::LLVM::createLegalizeForExportPass()";
+}
+
+#endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_PASSES

diff  --git a/mlir/include/mlir/Dialect/Linalg/CMakeLists.txt b/mlir/include/mlir/Dialect/Linalg/CMakeLists.txt
index 9f57627c321f..175f1a195bd5 100644
--- a/mlir/include/mlir/Dialect/Linalg/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/Linalg/CMakeLists.txt
@@ -1,2 +1,6 @@
 add_subdirectory(IR)
 add_subdirectory(Transforms)
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRLinalgPassIncGen)

diff  --git a/mlir/include/mlir/Dialect/Linalg/Passes.h b/mlir/include/mlir/Dialect/Linalg/Passes.h
index 61f88c10470a..9f52e360c7fb 100644
--- a/mlir/include/mlir/Dialect/Linalg/Passes.h
+++ b/mlir/include/mlir/Dialect/Linalg/Passes.h
@@ -20,8 +20,10 @@ namespace mlir {
 class FuncOp;
 class ModuleOp;
 template <typename T> class OpPassBase;
+class Pass;
 
 std::unique_ptr<OpPassBase<FuncOp>> createLinalgFusionPass();
+std::unique_ptr<Pass> createLinalgFusionOfTensorOpsPass();
 
 std::unique_ptr<OpPassBase<FuncOp>>
 createLinalgTilingPass(ArrayRef<int64_t> tileSizes = {});
@@ -31,6 +33,7 @@ createLinalgTilingToParallelLoopsPass(ArrayRef<int64_t> tileSizes = {});
 
 std::unique_ptr<OpPassBase<FuncOp>>
 createLinalgPromotionPass(bool dynamicBuffers);
+std::unique_ptr<OpPassBase<FuncOp>> createLinalgPromotionPass();
 
 /// Create a pass to convert Linalg operations to loop.for loops and
 /// std.load/std.store accesses.

diff  --git a/mlir/include/mlir/Dialect/Linalg/Passes.td b/mlir/include/mlir/Dialect/Linalg/Passes.td
new file mode 100644
index 000000000000..8e7ebbe385d3
--- /dev/null
+++ b/mlir/include/mlir/Dialect/Linalg/Passes.td
@@ -0,0 +1,56 @@
+//===-- Passes.td - Linalg 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_DIALECT_LINALG_PASSES
+#define MLIR_DIALECT_LINALG_PASSES
+
+include "mlir/Pass/PassBase.td"
+
+def LinalgFusion : Pass<"linalg-fusion"> {
+  let summary = "Fuse operations in the linalg dialect";
+  let constructor = "mlir::createLinalgFusionPass()";
+}
+
+def LinalgFusionOfTensorOps : Pass<"linalg-fusion-for-tensor-ops"> {
+  let summary = "Fuse operations on RankedTensorType in linalg dialect";
+  let constructor = "mlir::createLinalgFusionOfTensorOpsPass()";
+}
+
+def LinalgLowerToAffineLoops : Pass<"convert-linalg-to-affine-loops"> {
+  let summary = "Lower the operations from the linalg dialect into affine "
+                "loops";
+  let constructor = "mlir::createConvertLinalgToAffineLoopsPass()";
+}
+
+def LinalgLowerToLoops : Pass<"convert-linalg-to-loops"> {
+  let summary = "Lower the operations from the linalg dialect into loops";
+  let constructor = "mlir::createConvertLinalgToLoopsPass()";
+}
+
+def LinalgLowerToParallelLoops : Pass<"convert-linalg-to-parallel-loops"> {
+  let summary = "Lower the operations from the linalg dialect into parallel "
+                "loops";
+  let constructor = "mlir::createConvertLinalgToParallelLoopsPass()";
+}
+
+def LinalgPromotion : Pass<"linalg-promote-subviews"> {
+  let summary = "Promote subview ops to local buffers";
+  let constructor = "mlir::createLinalgPromotionPass()";
+}
+
+def LinalgTiling : Pass<"linalg-tile"> {
+  let summary = "Tile operations in the linalg dialect";
+  let constructor = "mlir::createLinalgTilingPass()";
+}
+
+def LinalgTilingToParallelLoops : Pass<"linalg-tile-to-parallel-loops"> {
+  let summary = "Tile operations in the linalg dialect to parallel loops";
+  let constructor = "mlir::createLinalgTilingToParallelLoopsPass()";
+}
+
+#endif // MLIR_DIALECT_LINALG_PASSES

diff  --git a/mlir/include/mlir/Dialect/LoopOps/CMakeLists.txt b/mlir/include/mlir/Dialect/LoopOps/CMakeLists.txt
index 4a838cc1d52d..f1a967508ba2 100644
--- a/mlir/include/mlir/Dialect/LoopOps/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/LoopOps/CMakeLists.txt
@@ -1,2 +1,6 @@
 add_mlir_dialect(LoopOps loop)
 add_mlir_doc(LoopOps -gen-dialect-doc LoopDialect Dialects/)
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRLoopPassIncGen)

diff  --git a/mlir/include/mlir/Dialect/LoopOps/Passes.td b/mlir/include/mlir/Dialect/LoopOps/Passes.td
new file mode 100644
index 000000000000..7d984afd8ea8
--- /dev/null
+++ b/mlir/include/mlir/Dialect/LoopOps/Passes.td
@@ -0,0 +1,29 @@
+//===-- Passes.td - Loop 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_DIALECT_LOOP_PASSES
+#define MLIR_DIALECT_LOOP_PASSES
+
+include "mlir/Pass/PassBase.td"
+
+def LoopParallelLoopFusion : Pass<"parallel-loop-fusion"> {
+  let summary = "Fuse adjacent parallel loops";
+  let constructor = "mlir::createParallelLoopFusionPass()";
+}
+
+def LoopParallelLoopSpecialization : Pass<"parallel-loop-specialization"> {
+  let summary = "Specialize parallel loops for vectorization";
+  let constructor = "mlir::createParallelLoopSpecializationPass()";
+}
+
+def LoopParallelLoopTiling : Pass<"parallel-loop-tiling"> {
+  let summary = "Tile parallel loops";
+  let constructor = "mlir::createParallelLoopTilingPass()";
+}
+
+#endif // MLIR_DIALECT_LOOP_PASSES

diff  --git a/mlir/include/mlir/Dialect/Quant/CMakeLists.txt b/mlir/include/mlir/Dialect/Quant/CMakeLists.txt
index b18726736e94..b524d822a0d5 100644
--- a/mlir/include/mlir/Dialect/Quant/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/Quant/CMakeLists.txt
@@ -1,2 +1,6 @@
 add_mlir_dialect(QuantOps quant)
 add_mlir_doc(QuantOps -gen-dialect-doc QuantDialect Dialects/)
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRQuantPassIncGen)

diff  --git a/mlir/include/mlir/Dialect/Quant/Passes.td b/mlir/include/mlir/Dialect/Quant/Passes.td
new file mode 100644
index 000000000000..f55a43006977
--- /dev/null
+++ b/mlir/include/mlir/Dialect/Quant/Passes.td
@@ -0,0 +1,26 @@
+//===-- Passes.td - Quant 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_DIALECT_QUANT_PASSES
+#define MLIR_DIALECT_QUANT_PASSES
+
+include "mlir/Pass/PassBase.td"
+
+def QuantConvertConst : Pass<"quant-convert-const"> {
+  let summary = "Converts constants followed by qbarrier to actual quantized "
+                "values";
+  let constructor = "mlir::quant::createConvertConstPass()";
+}
+
+def QuantConvertSimulatedQuant : Pass<"quant-convert-simulated-quantization"> {
+  let summary = "Converts training-time simulated quantization ops to "
+                "corresponding quantize/dequantize casts";
+  let constructor = "mlir::quant::createConvertSimulatedQuantPass()";
+}
+
+#endif // MLIR_DIALECT_QUANT_PASSES

diff  --git a/mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt b/mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt
index 2ffddf829854..713af9ea1f16 100644
--- a/mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt
@@ -30,3 +30,7 @@ set(LLVM_TARGET_DEFINITIONS TargetAndABI.td)
 mlir_tablegen(TargetAndABI.h.inc -gen-struct-attr-decls)
 mlir_tablegen(TargetAndABI.cpp.inc -gen-struct-attr-defs)
 add_public_tablegen_target(MLIRSPIRVTargetAndABIIncGen)
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRSPIRVPassIncGen)

diff  --git a/mlir/include/mlir/Dialect/SPIRV/Passes.td b/mlir/include/mlir/Dialect/SPIRV/Passes.td
new file mode 100644
index 000000000000..a03849955797
--- /dev/null
+++ b/mlir/include/mlir/Dialect/SPIRV/Passes.td
@@ -0,0 +1,30 @@
+//===-- Passes.td - SPIRV 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_DIALECT_SPIRV_PASSES
+#define MLIR_DIALECT_SPIRV_PASSES
+
+include "mlir/Pass/PassBase.td"
+
+def SPIRVCompositeTypeLayout : Pass<"decorate-spirv-composite-type-layout"> {
+  let summary = "Decorate SPIR-V composite type with layout info";
+  let constructor = "mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass()";
+}
+
+def SPIRVLowerABIAttributes : Pass<"spirv-lower-abi-attrs"> {
+  let summary = "Decorate SPIR-V composite type with layout info";
+  let constructor = "mlir::spirv::createLowerABIAttributesPass()";
+}
+
+def SPIRVUpdateVCE : Pass<"spirv-update-vce"> {
+  let summary = "Deduce and attach minimal (version, capabilities, extensions) "
+                "requirements to spv.module ops";
+  let constructor = "mlir::spirv::createUpdateVersionCapabilityExtensionPass()";
+}
+
+#endif // MLIR_DIALECT_SPIRV_PASSES

diff  --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h
index 3d2a9e8f3cdc..4e5173b43b8c 100644
--- a/mlir/include/mlir/InitAllPasses.h
+++ b/mlir/include/mlir/InitAllPasses.h
@@ -54,6 +54,40 @@ inline void registerAllPasses() {
 #define GEN_PASS_REGISTRATION
 #include "mlir/Transforms/Passes.h.inc"
 
+  // Affine
+#define GEN_PASS_REGISTRATION
+#include "mlir/Dialect/Affine/Passes.h.inc"
+
+  // FxpMath
+#define GEN_PASS_REGISTRATION
+#include "mlir/Dialect/FxpMathOps/Passes.h.inc"
+
+  // GPU
+#define GEN_PASS_REGISTRATION
+#include "mlir/Dialect/GPU/Passes.h.inc"
+
+  // Linalg
+#define GEN_PASS_REGISTRATION
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+
+  // LLVM
+#define GEN_PASS_REGISTRATION
+#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
+
+  // Loop
+#define GEN_PASS_REGISTRATION
+#include "mlir/Dialect/LoopOps/Passes.h.inc"
+
+  // Quant
+#define GEN_PASS_REGISTRATION
+#include "mlir/Dialect/Quant/Passes.h.inc"
+#define GEN_PASS_REGISTRATION
+#include "mlir/Quantizer/Transforms/Passes.h.inc"
+
+  // 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
@@ -64,16 +98,7 @@ inline void registerAllPasses() {
     return;
 
   // Affine
-  createSuperVectorizePass({});
-  createLoopUnrollPass();
-  createLoopUnrollAndJamPass();
-  createSimplifyAffineStructuresPass();
-  createLoopInvariantCodeMotionPass();
-  createAffineLoopInvariantCodeMotionPass();
   createLowerAffinePass();
-  createLoopTilingPass(0);
-  createAffineDataCopyGenerationPass(0, 0);
-  createMemRefDataFlowOptPass();
 
   // AVX512
   createConvertAVX512ToLLVMPass();
@@ -81,12 +106,7 @@ inline void registerAllPasses() {
   // GPUtoRODCLPass
   createLowerGpuOpsToROCDLOpsPass();
 
-  // FxpOpsDialect passes
-  fxpmath::createLowerUniformRealMathPass();
-  fxpmath::createLowerUniformCastsPass();
-
   // GPU
-  createGpuKernelOutliningPass();
   createSimpleLoopsToGPUPass(0, 0);
   createLoopToGPUPass({}, {});
 
@@ -95,35 +115,9 @@ inline void registerAllPasses() {
   createLowerGpuOpsToNVVMOpsPass();
 
   // Linalg
-  createLinalgFusionPass();
-  createLinalgTilingPass();
-  createLinalgTilingToParallelLoopsPass();
-  createLinalgPromotionPass(0);
-  createConvertLinalgToLoopsPass();
-  createConvertLinalgToParallelLoopsPass();
-  createConvertLinalgToAffineLoopsPass();
   createConvertLinalgToLLVMPass();
 
-  // LLVM
-  LLVM::createLegalizeForExportPass();
-
-  // LoopOps
-  createParallelLoopCollapsingPass();
-  createParallelLoopFusionPass();
-  createParallelLoopSpecializationPass();
-  createParallelLoopTilingPass();
-
-  // QuantOps
-  quant::createConvertSimulatedQuantPass();
-  quant::createConvertConstPass();
-  quantizer::createAddDefaultStatsPass();
-  quantizer::createRemoveInstrumentationPass();
-  quantizer::registerInferQuantizedTypesPass();
-
   // SPIR-V
-  spirv::createDecorateSPIRVCompositeTypeLayoutPass();
-  spirv::createLowerABIAttributesPass();
-  spirv::createUpdateVersionCapabilityExtensionPass();
   createConvertGPUToSPIRVPass();
   createConvertStandardToSPIRVPass();
   createLegalizeStdOpsForSPIRVLoweringPass();

diff  --git a/mlir/include/mlir/Quantizer/CMakeLists.txt b/mlir/include/mlir/Quantizer/CMakeLists.txt
new file mode 100644
index 000000000000..e31af3266116
--- /dev/null
+++ b/mlir/include/mlir/Quantizer/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(Transforms)

diff  --git a/mlir/include/mlir/Quantizer/Transforms/CMakeLists.txt b/mlir/include/mlir/Quantizer/Transforms/CMakeLists.txt
new file mode 100644
index 000000000000..893263e13e95
--- /dev/null
+++ b/mlir/include/mlir/Quantizer/Transforms/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRQuantizerPassIncGen)

diff  --git a/mlir/include/mlir/Quantizer/Transforms/Passes.h b/mlir/include/mlir/Quantizer/Transforms/Passes.h
index 3cd0475d2f8e..5877dc525a94 100644
--- a/mlir/include/mlir/Quantizer/Transforms/Passes.h
+++ b/mlir/include/mlir/Quantizer/Transforms/Passes.h
@@ -27,9 +27,7 @@ class TargetConfiguration;
 std::unique_ptr<OpPassBase<ModuleOp>>
 createInferQuantizedTypesPass(SolverContext &solverContext,
                               const TargetConfiguration &config);
-
-/// Registers the InferQuantizedTypes pass with the global registry.
-void registerInferQuantizedTypesPass();
+std::unique_ptr<OpPassBase<ModuleOp>> createInferQuantizedTypesPass();
 
 /// Creates a pass which removes any instrumentation and hint ops which have
 /// no effect on final runtime.

diff  --git a/mlir/include/mlir/Quantizer/Transforms/Passes.td b/mlir/include/mlir/Quantizer/Transforms/Passes.td
new file mode 100644
index 000000000000..e89674478b17
--- /dev/null
+++ b/mlir/include/mlir/Quantizer/Transforms/Passes.td
@@ -0,0 +1,31 @@
+//===-- Passes.td - Quantizer 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_QUANTIZER_TRANSFORMS_PASSES
+#define MLIR_QUANTIZER_TRANSFORMS_PASSES
+
+include "mlir/Pass/PassBase.td"
+
+def QuantizerAddDefaultStats : Pass<"quantizer-add-default-stats-test"> {
+  let summary = "Add default (dummy) statistics to all ops that can benefit "
+                "from runtime statistics";
+  let constructor = "mlir::quantizer::createAddDefaultStatsPass()";
+}
+
+def QuantizerInferQuantizedTypes : Pass<"quantizer-infer-quantized-types"> {
+  let summary = "Infer quantized types for a module";
+  let constructor = "mlir::quantizer::createInferQuantizedTypesPass()";
+}
+
+def QuantizerRemoveInstrumentation : Pass<"quantizer-remove-instrumentation"> {
+  let summary = "Remove instrumentation and hints which have no effect on "
+                "final execution";
+  let constructor = "mlir::quantizer::createRemoveInstrumentationPass()";
+}
+
+#endif // MLIR_QUANTIZER_TRANSFORMS_PASSES

diff  --git a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
index 8fc421dada8e..551a3339fc46 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
@@ -136,6 +136,9 @@ std::unique_ptr<OpPassBase<FuncOp>> mlir::createAffineDataCopyGenerationPass(
       slowMemorySpace, fastMemorySpace, tagMemorySpace, minDmaTransferSize,
       fastMemCapacityBytes);
 }
+std::unique_ptr<OpPassBase<FuncOp>> mlir::createAffineDataCopyGenerationPass() {
+  return std::make_unique<AffineDataCopyGeneration>();
+}
 
 /// Generate copies for this block. The block is partitioned into separate
 /// ranges: each range is either a sequence of one or more operations starting
@@ -261,7 +264,3 @@ void AffineDataCopyGeneration::runOnFunction() {
     nest->walk([](AffineForOp forOp) { promoteIfSingleIteration(forOp); });
   }
 }
-
-static PassRegistration<AffineDataCopyGeneration>
-    pass("affine-data-copy-generate",
-         "Generate explicit copying for memory operations");

diff  --git a/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
index 746aceb8090a..e12dfe7fc6de 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
@@ -232,7 +232,3 @@ std::unique_ptr<OpPassBase<FuncOp>>
 mlir::createAffineLoopInvariantCodeMotionPass() {
   return std::make_unique<LoopInvariantCodeMotion>();
 }
-
-static PassRegistration<LoopInvariantCodeMotion>
-    pass("affine-loop-invariant-code-motion",
-         "Hoist loop invariant instructions outside of the loop");

diff  --git a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
index 89abbd521dec..833736965776 100644
--- a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
@@ -12,6 +12,7 @@ add_mlir_dialect_library(MLIRAffineTransforms
 
   DEPENDS
   MLIRAffineOpsIncGen
+  MLIRAffinePassIncGen
   MLIRLoopLikeInterfaceIncGen
   )
 target_link_libraries(MLIRAffineTransforms

diff  --git a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
index 7568098530f7..2666947a8f86 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
@@ -85,6 +85,9 @@ std::unique_ptr<OpPassBase<FuncOp>>
 mlir::createLoopTilingPass(uint64_t cacheSizeBytes) {
   return std::make_unique<LoopTiling>(cacheSizeBytes);
 }
+std::unique_ptr<OpPassBase<FuncOp>> mlir::createLoopTilingPass() {
+  return std::make_unique<LoopTiling>();
+}
 
 // Move the loop body of AffineForOp 'src' from 'src' into the specified
 // location in destination's body, ignoring the terminator.
@@ -420,5 +423,3 @@ void LoopTiling::runOnFunction() {
 
 constexpr unsigned LoopTiling::kDefaultTileSize;
 constexpr uint64_t LoopTiling::kDefaultCacheMemCapacity;
-
-static PassRegistration<LoopTiling> pass("affine-loop-tile", "Tile loop nests");

diff  --git a/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
index 584ec29c792d..b675f567d4ac 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
@@ -169,5 +169,3 @@ std::unique_ptr<OpPassBase<FuncOp>> mlir::createLoopUnrollPass(
       unrollFactor == -1 ? None : Optional<unsigned>(unrollFactor),
       unrollFull == -1 ? None : Optional<bool>(unrollFull), getUnrollFactor);
 }
-
-static PassRegistration<LoopUnroll> pass("affine-loop-unroll", "Unroll loops");

diff  --git a/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
index 218a6a2ce23d..5206ef8e1e48 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
@@ -100,6 +100,3 @@ LogicalResult LoopUnrollAndJam::runOnAffineForOp(AffineForOp forOp) {
   // Unroll and jam by four otherwise.
   return loopUnrollJamByFactor(forOp, kDefaultUnrollJamFactor);
 }
-
-static PassRegistration<LoopUnrollAndJam> pass("affine-loop-unroll-jam",
-                                               "Unroll and jam loops");

diff  --git a/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp b/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
index 34de759a7290..0e657fde4994 100644
--- a/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
@@ -94,7 +94,3 @@ void SimplifyAffineStructures::runOnFunction() {
     normalizeMemRef(allocOp);
   }
 }
-
-static PassRegistration<SimplifyAffineStructures>
-    pass("simplify-affine-structures",
-         "Simplify affine expressions in maps/sets and normalize memrefs");

diff  --git a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
index d9a9ad969e51..e7fc36c13608 100644
--- a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
@@ -1271,7 +1271,6 @@ std::unique_ptr<OpPassBase<FuncOp>>
 mlir::createSuperVectorizePass(ArrayRef<int64_t> virtualVectorSize) {
   return std::make_unique<Vectorize>(virtualVectorSize);
 }
-
-static PassRegistration<Vectorize>
-    pass("affine-super-vectorize",
-         "Vectorize to a target independent n-D vector abstraction");
+std::unique_ptr<OpPassBase<FuncOp>> mlir::createSuperVectorizePass() {
+  return std::make_unique<Vectorize>();
+}

diff  --git a/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt b/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
index e18ce1a4cfde..751db7af86f7 100644
--- a/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
@@ -7,6 +7,7 @@ add_mlir_dialect_library(MLIRFxpMathOps
 
   DEPENDS
   MLIRFxpMathOpsIncGen
+  MLIRFxpMathPassIncGen
   )
 
 target_link_libraries(MLIRFxpMathOps

diff  --git a/mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp b/mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp
index 2a876a332ea6..111009bea859 100644
--- a/mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp
+++ b/mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp
@@ -364,14 +364,11 @@ void LowerUniformRealMathPass::runOnFunction() {
   applyPatternsGreedily(fn, patterns);
 }
 
-OpPassBase<FuncOp> *mlir::fxpmath::createLowerUniformRealMathPass() {
-  return new LowerUniformRealMathPass();
+std::unique_ptr<OpPassBase<FuncOp>>
+mlir::fxpmath::createLowerUniformRealMathPass() {
+  return std::make_unique<LowerUniformRealMathPass>();
 }
 
-static PassRegistration<LowerUniformRealMathPass> lowerUniformRealMathPass(
-    "fxpmath-lower-uniform-real-math",
-    "Lowers uniform-quantized real math ops to integer arithmetic.");
-
 //===----------------------------------------------------------------------===//
 // LowerUniformCasts pass
 //===----------------------------------------------------------------------===//
@@ -384,10 +381,7 @@ void LowerUniformCastsPass::runOnFunction() {
   applyPatternsGreedily(fn, patterns);
 }
 
-OpPassBase<FuncOp> *mlir::fxpmath::createLowerUniformCastsPass() {
-  return new LowerUniformCastsPass();
+std::unique_ptr<OpPassBase<FuncOp>>
+mlir::fxpmath::createLowerUniformCastsPass() {
+  return std::make_unique<LowerUniformCastsPass>();
 }
-
-static PassRegistration<LowerUniformCastsPass>
-    lowerUniformCastsPass("fxpmath-lower-uniform-casts",
-                          "Lowers uniform-quantized casts.");

diff  --git a/mlir/lib/Dialect/GPU/CMakeLists.txt b/mlir/lib/Dialect/GPU/CMakeLists.txt
index e71a018a451c..ad63b3669409 100644
--- a/mlir/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/CMakeLists.txt
@@ -10,6 +10,7 @@ add_mlir_dialect_library(MLIRGPU
 
   DEPENDS
   MLIRGPUOpsIncGen
+  MLIRGPUPassIncGen
   MLIRParallelLoopMapperAttrGen
   MLIRParallelLoopMapperEnumsGen
   )

diff  --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
index 99029b010ba3..950eda91d92f 100644
--- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
@@ -300,7 +300,3 @@ class GpuKernelOutliningPass : public ModulePass<GpuKernelOutliningPass> {
 std::unique_ptr<OpPassBase<ModuleOp>> mlir::createGpuKernelOutliningPass() {
   return std::make_unique<GpuKernelOutliningPass>();
 }
-
-static PassRegistration<GpuKernelOutliningPass>
-    pass("gpu-kernel-outlining",
-         "Outline gpu.launch bodies to kernel functions.");

diff  --git a/mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt b/mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt
index 6b37b060de6c..216586e6242d 100644
--- a/mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt
@@ -1,5 +1,8 @@
 add_mlir_dialect_library(MLIRLLVMIRTransforms
   LegalizeForExport.cpp
+
+  DEPENDS
+  MLIRLLVMPassIncGen
   )
 
 target_link_libraries(MLIRLLVMIRTransforms

diff  --git a/mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp b/mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp
index fce4045f1aa3..b8a75d571099 100644
--- a/mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp
+++ b/mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp
@@ -67,7 +67,3 @@ struct LegalizeForExportPass : public OperationPass<LegalizeForExportPass> {
 std::unique_ptr<Pass> LLVM::createLegalizeForExportPass() {
   return std::make_unique<LegalizeForExportPass>();
 }
-
-static PassRegistration<LegalizeForExportPass>
-    pass("llvm-legalize-for-export",
-         "Legalize LLVM dialect to be convertible to LLVM IR");

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
index 349c2d6980ac..93f7142ce2df 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
@@ -10,6 +10,7 @@ add_mlir_dialect_library(MLIRLinalgTransforms
 
   DEPENDS
   intrinsics_gen
+  MLIRLinalgPassIncGen
   MLIRLinalgTransformPatternsIncGen
   )
 target_link_libraries(MLIRLinalgTransforms

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
index 4d20bb541e28..81f940c01e28 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
@@ -585,9 +585,6 @@ std::unique_ptr<OpPassBase<FuncOp>> mlir::createLinalgFusionPass() {
   return std::make_unique<LinalgFusionPass>();
 }
 
-static PassRegistration<LinalgFusionPass>
-    pass("linalg-fusion", "Fuse operations in the linalg dialect");
-
-static PassRegistration<FusionOfTensorOpsPass>
-    tensorOpsPass("linalg-fusion-for-tensor-ops",
-                  "Fuse operations on RankedTensorType in linalg dialect");
+std::unique_ptr<Pass> mlir::createLinalgFusionOfTensorOpsPass() {
+  return std::make_unique<FusionOfTensorOpsPass>();
+}

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp b/mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
index ae589e7a6b63..e4fe212e742e 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
@@ -767,19 +767,3 @@ INSTANTIATE_LINALG_OP_TO_LOOPS(IndexedGenericOp)
 template LogicalResult
 mlir::linalg::linalgOpToParallelLoops<GenericOp>(PatternRewriter &rewriter,
                                                  Operation *op);
-
-static PassRegistration<LowerLinalgToLoopsPass<loop::ForOp, StdIndexedValue>>
-    structuredLoopsPass(
-        "convert-linalg-to-loops",
-        "Lower the operations from the linalg dialect into loops");
-
-static PassRegistration<
-    LowerLinalgToLoopsPass<loop::ParallelOp, StdIndexedValue>>
-    parallelLoopsPass(
-        "convert-linalg-to-parallel-loops",
-        "Lower the operations from the linalg dialect into parallel loops");
-
-static PassRegistration<LowerLinalgToLoopsPass<AffineForOp, AffineIndexedValue>>
-    affineLoopsPass(
-        "convert-linalg-to-affine-loops",
-        "Lower the operations from the linalg dialect into affine loops");

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp b/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
index 8a6b5cf8b5da..c009dfeea425 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
@@ -252,6 +252,6 @@ std::unique_ptr<OpPassBase<FuncOp>>
 mlir::createLinalgPromotionPass(bool dynamicBuffers) {
   return std::make_unique<LinalgPromotionPass>(dynamicBuffers);
 }
-
-static PassRegistration<LinalgPromotionPass>
-    pass("linalg-promote-subviews", "promote subview ops to local buffers");
+std::unique_ptr<OpPassBase<FuncOp>> mlir::createLinalgPromotionPass() {
+  return std::make_unique<LinalgPromotionPass>();
+}

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
index 14253e3ebd5d..a1c00dc1e13f 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
@@ -537,11 +537,3 @@ std::unique_ptr<OpPassBase<FuncOp>>
 mlir::createLinalgTilingToParallelLoopsPass(ArrayRef<int64_t> tileSizes) {
   return std::make_unique<LinalgTilingPass<loop::ParallelOp>>(tileSizes);
 }
-
-static PassRegistration<LinalgTilingPass<loop::ForOp>>
-    tiling_pass("linalg-tile", "Tile operations in the linalg dialect");
-
-static PassRegistration<LinalgTilingPass<loop::ParallelOp>>
-    tiling_to_parallel_loops(
-        "linalg-tile-to-parallel-loops",
-        "Tile operations in the linalg dialect to parallel loops");

diff  --git a/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt b/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
index 2ec44b472298..e3ec12b4b21d 100644
--- a/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
@@ -5,6 +5,9 @@ add_mlir_dialect_library(MLIRLoopOpsTransforms
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LoopOps
+
+  DEPENDS
+  MLIRLoopPassIncGen
   )
 target_link_libraries(MLIRLoopOpsTransforms
   PUBLIC

diff  --git a/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopFusion.cpp b/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopFusion.cpp
index b84cfa5aa78c..db10939c509e 100644
--- a/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopFusion.cpp
+++ b/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopFusion.cpp
@@ -173,6 +173,3 @@ struct ParallelLoopFusion : public OperationPass<ParallelLoopFusion> {
 std::unique_ptr<Pass> mlir::createParallelLoopFusionPass() {
   return std::make_unique<ParallelLoopFusion>();
 }
-
-static PassRegistration<ParallelLoopFusion>
-    pass("parallel-loop-fusion", "Fuse adjacent parallel loops.");

diff  --git a/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopSpecialization.cpp b/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopSpecialization.cpp
index c692c0174f0c..28b8d0186bd3 100644
--- a/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopSpecialization.cpp
+++ b/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopSpecialization.cpp
@@ -70,7 +70,3 @@ struct ParallelLoopSpecialization
 std::unique_ptr<Pass> mlir::createParallelLoopSpecializationPass() {
   return std::make_unique<ParallelLoopSpecialization>();
 }
-
-static PassRegistration<ParallelLoopSpecialization>
-    pass("parallel-loop-specialization",
-         "Specialize parallel loops for vectorization.");

diff  --git a/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopTiling.cpp b/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopTiling.cpp
index 85fd241cee7e..e5a9c32ec2ad 100644
--- a/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopTiling.cpp
+++ b/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopTiling.cpp
@@ -129,6 +129,3 @@ std::unique_ptr<Pass>
 mlir::createParallelLoopTilingPass(ArrayRef<int64_t> tileSizes) {
   return std::make_unique<ParallelLoopTiling>(tileSizes);
 }
-
-static PassRegistration<ParallelLoopTiling> pass("parallel-loop-tiling",
-                                                 "Tile parallel loops.");

diff  --git a/mlir/lib/Dialect/Quant/CMakeLists.txt b/mlir/lib/Dialect/Quant/CMakeLists.txt
index 4796889f8cd8..4f8382962206 100644
--- a/mlir/lib/Dialect/Quant/CMakeLists.txt
+++ b/mlir/lib/Dialect/Quant/CMakeLists.txt
@@ -14,6 +14,7 @@ add_mlir_dialect_library(MLIRQuant
 
   DEPENDS
   MLIRQuantOpsIncGen
+  MLIRQuantPassIncGen
   )
 target_link_libraries(MLIRQuant
   PUBLIC

diff  --git a/mlir/lib/Dialect/Quant/Transforms/ConvertConst.cpp b/mlir/lib/Dialect/Quant/Transforms/ConvertConst.cpp
index 2598e8cf5013..ccc9d5c5256e 100644
--- a/mlir/lib/Dialect/Quant/Transforms/ConvertConst.cpp
+++ b/mlir/lib/Dialect/Quant/Transforms/ConvertConst.cpp
@@ -106,7 +106,3 @@ void ConvertConstPass::runOnFunction() {
 std::unique_ptr<OpPassBase<FuncOp>> mlir::quant::createConvertConstPass() {
   return std::make_unique<ConvertConstPass>();
 }
-
-static PassRegistration<ConvertConstPass>
-    pass("quant-convert-const",
-         "Converts constants followed by qbarrier to actual quantized values");

diff  --git a/mlir/lib/Dialect/Quant/Transforms/ConvertSimQuant.cpp b/mlir/lib/Dialect/Quant/Transforms/ConvertSimQuant.cpp
index c921aeafda90..3553b236d318 100644
--- a/mlir/lib/Dialect/Quant/Transforms/ConvertSimQuant.cpp
+++ b/mlir/lib/Dialect/Quant/Transforms/ConvertSimQuant.cpp
@@ -142,8 +142,3 @@ std::unique_ptr<OpPassBase<FuncOp>>
 mlir::quant::createConvertSimulatedQuantPass() {
   return std::make_unique<ConvertSimulatedQuantPass>();
 }
-
-static PassRegistration<ConvertSimulatedQuantPass>
-    pass("quant-convert-simulated-quantization",
-         "Converts training-time simulated quantization ops to corresponding "
-         "quantize/dequantize casts.");

diff  --git a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
index f31c4836e7f7..e388069d52ee 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
@@ -5,6 +5,9 @@ add_mlir_dialect_library(MLIRSPIRVTransforms
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
+
+  DEPENDS
+  MLIRSPIRVPassIncGen
   )
 
 target_link_libraries(MLIRSPIRVTransforms

diff  --git a/mlir/lib/Dialect/SPIRV/Transforms/DecorateSPIRVCompositeTypeLayoutPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/DecorateSPIRVCompositeTypeLayoutPass.cpp
index 0645408398b6..79ed81956f08 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/DecorateSPIRVCompositeTypeLayoutPass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/DecorateSPIRVCompositeTypeLayoutPass.cpp
@@ -117,7 +117,3 @@ std::unique_ptr<OpPassBase<ModuleOp>>
 mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass() {
   return std::make_unique<DecorateSPIRVCompositeTypeLayoutPass>();
 }
-
-static PassRegistration<DecorateSPIRVCompositeTypeLayoutPass>
-    pass("decorate-spirv-composite-type-layout",
-         "Decorate SPIR-V composite type with layout info");

diff  --git a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
index 1ca9cad977af..9cb2bfe1e1fc 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
@@ -264,6 +264,3 @@ std::unique_ptr<OpPassBase<spirv::ModuleOp>>
 mlir::spirv::createLowerABIAttributesPass() {
   return std::make_unique<LowerABIAttributesPass>();
 }
-
-static PassRegistration<LowerABIAttributesPass>
-    pass("spirv-lower-abi-attrs", "Lower SPIR-V ABI Attributes");

diff  --git a/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
index 201adbbd3837..ebb5b6eda83a 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
@@ -177,8 +177,3 @@ std::unique_ptr<OpPassBase<spirv::ModuleOp>>
 mlir::spirv::createUpdateVersionCapabilityExtensionPass() {
   return std::make_unique<UpdateVCEPass>();
 }
-
-static PassRegistration<UpdateVCEPass>
-    pass("spirv-update-vce",
-         "Deduce and attach minimal (version, capabilities, extensions) "
-         "requirements to spv.module ops");

diff  --git a/mlir/lib/Quantizer/CMakeLists.txt b/mlir/lib/Quantizer/CMakeLists.txt
index 27950c232ec1..15459304d535 100644
--- a/mlir/lib/Quantizer/CMakeLists.txt
+++ b/mlir/lib/Quantizer/CMakeLists.txt
@@ -48,6 +48,9 @@ add_mlir_library(MLIRQuantizerTransforms
   Transforms/RemoveInstrumentationPass.cpp
 
   ADDITIONAL_HEADER_DIRS
+
+  DEPENDS
+  MLIRQuantizerPassIncGen
   )
 target_link_libraries(MLIRQuantizerTransforms
   PUBLIC

diff  --git a/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp b/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp
index 7a9627dd144e..13a09b39a499 100644
--- a/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp
+++ b/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp
@@ -113,8 +113,3 @@ std::unique_ptr<OpPassBase<FuncOp>>
 mlir::quantizer::createAddDefaultStatsPass() {
   return std::make_unique<AddDefaultStatsPass>();
 }
-
-static PassRegistration<AddDefaultStatsPass> pass(
-    "quantizer-add-default-stats-test",
-    "Adds default (dummy) statistics to all ops that can benefit from "
-    "runtime statistics. This is meant to help in early stage bootstrapping.");

diff  --git a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp
index 1876b33b8421..1066c15b6333 100644
--- a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp
+++ b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp
@@ -282,12 +282,7 @@ mlir::quantizer::createInferQuantizedTypesPass(
     SolverContext &solverContext, const TargetConfiguration &config) {
   return std::make_unique<InferQuantizedTypesPass>(solverContext, config);
 }
-void mlir::quantizer::registerInferQuantizedTypesPass() {
-  // Do nothing, this will be enough to force link this file and the static
-  // registration will kick-in. This is temporary while we're refactoring pass
-  // registration to move away from static constructors.
+std::unique_ptr<OpPassBase<ModuleOp>>
+mlir::quantizer::createInferQuantizedTypesPass() {
+  return std::make_unique<InferQuantizedTypesPass>();
 }
-
-static PassRegistration<InferQuantizedTypesPass>
-    pass("quantizer-infer-quantized-types",
-         "Infers quantized types for a module");

diff  --git a/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp b/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp
index 0112753c49fc..d05810733f1b 100644
--- a/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp
+++ b/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp
@@ -61,8 +61,3 @@ std::unique_ptr<OpPassBase<FuncOp>>
 mlir::quantizer::createRemoveInstrumentationPass() {
   return std::make_unique<RemoveInstrumentationPass>();
 }
-
-static PassRegistration<RemoveInstrumentationPass>
-    pass("quantizer-remove-instrumentation",
-         "Removes instrumentation and hints which have no effect on final "
-         "execution");


        


More information about the Mlir-commits mailing list