diff --git a/mlir/include/mlir/CMakeLists.txt b/mlir/include/mlir/CMakeLists.txt --- 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 --- 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 --- a/mlir/include/mlir/Dialect/Affine/Passes.h +++ b/mlir/include/mlir/Dialect/Affine/Passes.h @@ -42,10 +42,14 @@ unsigned slowMemorySpace, unsigned fastMemorySpace, unsigned tagMemorySpace = 0, int minDmaTransferSize = 1024, uint64_t fastMemCapacityBytes = std::numeric_limits::max()); +/// Overload relying on pass options for initialization. +std::unique_ptr> createAffineDataCopyGenerationPass(); /// Creates a pass to perform tiling on loop nests. std::unique_ptr> createLoopTilingPass(uint64_t cacheSizeBytes); +/// Overload relying on pass options for initialization. +std::unique_ptr> 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 @@ /// target-independent, n-D super-vector abstraction. std::unique_ptr> createSuperVectorizePass(ArrayRef virtualVectorSize); +/// Overload relying on pass options for initialization. +std::unique_ptr> 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 --- /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 --- 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 --- 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 + namespace mlir { class FuncOp; template class OpPassBase; @@ -23,11 +25,11 @@ /// 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 *createLowerUniformRealMathPass(); +std::unique_ptr> createLowerUniformRealMathPass(); /// Creates a pass that lowers uniform-quantized qcast/dcast ops to equivalent /// operations that perform quantize/dequantize. -OpPassBase *createLowerUniformCastsPass(); +std::unique_ptr> 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 --- /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 --- a/mlir/include/mlir/Dialect/GPU/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/GPU/CMakeLists.txt @@ -10,3 +10,7 @@ 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 --- /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 --- a/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt @@ -28,3 +28,7 @@ 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 --- /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 --- 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 --- a/mlir/include/mlir/Dialect/Linalg/Passes.h +++ b/mlir/include/mlir/Dialect/Linalg/Passes.h @@ -20,8 +20,10 @@ class FuncOp; class ModuleOp; template class OpPassBase; +class Pass; std::unique_ptr> createLinalgFusionPass(); +std::unique_ptr createLinalgFusionOfTensorOpsPass(); std::unique_ptr> createLinalgTilingPass(ArrayRef tileSizes = {}); @@ -31,6 +33,7 @@ std::unique_ptr> createLinalgPromotionPass(bool dynamicBuffers); +std::unique_ptr> 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 --- /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 --- 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 --- /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 --- 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 --- /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 --- a/mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt @@ -30,3 +30,7 @@ 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 --- /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 --- a/mlir/include/mlir/InitAllPasses.h +++ b/mlir/include/mlir/InitAllPasses.h @@ -54,6 +54,40 @@ #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 @@ return; // Affine - createSuperVectorizePass({}); - createLoopUnrollPass(); - createLoopUnrollAndJamPass(); - createSimplifyAffineStructuresPass(); - createLoopInvariantCodeMotionPass(); - createAffineLoopInvariantCodeMotionPass(); createLowerAffinePass(); - createLoopTilingPass(0); - createAffineDataCopyGenerationPass(0, 0); - createMemRefDataFlowOptPass(); // AVX512 createConvertAVX512ToLLVMPass(); @@ -81,12 +106,7 @@ // GPUtoRODCLPass createLowerGpuOpsToROCDLOpsPass(); - // FxpOpsDialect passes - fxpmath::createLowerUniformRealMathPass(); - fxpmath::createLowerUniformCastsPass(); - // GPU - createGpuKernelOutliningPass(); createSimpleLoopsToGPUPass(0, 0); createLoopToGPUPass({}, {}); @@ -95,35 +115,9 @@ 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/Dialect/Linalg/CMakeLists.txt b/mlir/include/mlir/Quantizer/CMakeLists.txt copy from mlir/include/mlir/Dialect/Linalg/CMakeLists.txt copy to mlir/include/mlir/Quantizer/CMakeLists.txt --- a/mlir/include/mlir/Dialect/Linalg/CMakeLists.txt +++ b/mlir/include/mlir/Quantizer/CMakeLists.txt @@ -1,2 +1 @@ -add_subdirectory(IR) 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 --- /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 --- a/mlir/include/mlir/Quantizer/Transforms/Passes.h +++ b/mlir/include/mlir/Quantizer/Transforms/Passes.h @@ -27,9 +27,7 @@ std::unique_ptr> createInferQuantizedTypesPass(SolverContext &solverContext, const TargetConfiguration &config); - -/// Registers the InferQuantizedTypes pass with the global registry. -void registerInferQuantizedTypesPass(); +std::unique_ptr> 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 --- /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 --- a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp @@ -136,6 +136,9 @@ slowMemorySpace, fastMemorySpace, tagMemorySpace, minDmaTransferSize, fastMemCapacityBytes); } +std::unique_ptr> mlir::createAffineDataCopyGenerationPass() { + return std::make_unique(); +} /// 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 @@ nest->walk([](AffineForOp forOp) { promoteIfSingleIteration(forOp); }); } } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp @@ -232,7 +232,3 @@ mlir::createAffineLoopInvariantCodeMotionPass() { return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt +++ b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt @@ -12,6 +12,7 @@ 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 --- a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp @@ -85,6 +85,9 @@ mlir::createLoopTilingPass(uint64_t cacheSizeBytes) { return std::make_unique(cacheSizeBytes); } +std::unique_ptr> mlir::createLoopTilingPass() { + return std::make_unique(); +} // Move the loop body of AffineForOp 'src' from 'src' into the specified // location in destination's body, ignoring the terminator. @@ -420,5 +423,3 @@ constexpr unsigned LoopTiling::kDefaultTileSize; constexpr uint64_t LoopTiling::kDefaultCacheMemCapacity; - -static PassRegistration 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 --- a/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp @@ -169,5 +169,3 @@ unrollFactor == -1 ? None : Optional(unrollFactor), unrollFull == -1 ? None : Optional(unrollFull), getUnrollFactor); } - -static PassRegistration pass("affine-loop-unroll", "Unroll loops"); diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp --- a/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp @@ -100,6 +100,3 @@ // Unroll and jam by four otherwise. return loopUnrollJamByFactor(forOp, kDefaultUnrollJamFactor); } - -static PassRegistration 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 --- a/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp @@ -94,7 +94,3 @@ normalizeMemRef(allocOp); } } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp @@ -1271,7 +1271,6 @@ mlir::createSuperVectorizePass(ArrayRef virtualVectorSize) { return std::make_unique(virtualVectorSize); } - -static PassRegistration - pass("affine-super-vectorize", - "Vectorize to a target independent n-D vector abstraction"); +std::unique_ptr> mlir::createSuperVectorizePass() { + return std::make_unique(); +} diff --git a/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt b/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt --- a/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt +++ b/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt @@ -7,6 +7,7 @@ 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 --- a/mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp +++ b/mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp @@ -364,14 +364,11 @@ applyPatternsGreedily(fn, patterns); } -OpPassBase *mlir::fxpmath::createLowerUniformRealMathPass() { - return new LowerUniformRealMathPass(); +std::unique_ptr> +mlir::fxpmath::createLowerUniformRealMathPass() { + return std::make_unique(); } -static PassRegistration lowerUniformRealMathPass( - "fxpmath-lower-uniform-real-math", - "Lowers uniform-quantized real math ops to integer arithmetic."); - //===----------------------------------------------------------------------===// // LowerUniformCasts pass //===----------------------------------------------------------------------===// @@ -384,10 +381,7 @@ applyPatternsGreedily(fn, patterns); } -OpPassBase *mlir::fxpmath::createLowerUniformCastsPass() { - return new LowerUniformCastsPass(); +std::unique_ptr> +mlir::fxpmath::createLowerUniformCastsPass() { + return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/GPU/CMakeLists.txt +++ b/mlir/lib/Dialect/GPU/CMakeLists.txt @@ -10,6 +10,7 @@ DEPENDS MLIRGPUOpsIncGen + MLIRGPUPassIncGen MLIRParallelLoopMapperAttrGen MLIRParallelLoopMapperEnumsGen ) diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp --- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp @@ -300,7 +300,3 @@ std::unique_ptr> mlir::createGpuKernelOutliningPass() { return std::make_unique(); } - -static PassRegistration - 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 --- 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 --- a/mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp +++ b/mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp @@ -67,7 +67,3 @@ std::unique_ptr LLVM::createLegalizeForExportPass() { return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt +++ b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt @@ -10,6 +10,7 @@ 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 --- a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp @@ -585,9 +585,6 @@ return std::make_unique(); } -static PassRegistration - pass("linalg-fusion", "Fuse operations in the linalg dialect"); - -static PassRegistration - tensorOpsPass("linalg-fusion-for-tensor-ops", - "Fuse operations on RankedTensorType in linalg dialect"); +std::unique_ptr mlir::createLinalgFusionOfTensorOpsPass() { + return std::make_unique(); +} diff --git a/mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp b/mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp @@ -767,19 +767,3 @@ template LogicalResult mlir::linalg::linalgOpToParallelLoops(PatternRewriter &rewriter, Operation *op); - -static PassRegistration> - structuredLoopsPass( - "convert-linalg-to-loops", - "Lower the operations from the linalg dialect into loops"); - -static PassRegistration< - LowerLinalgToLoopsPass> - parallelLoopsPass( - "convert-linalg-to-parallel-loops", - "Lower the operations from the linalg dialect into parallel loops"); - -static PassRegistration> - 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 --- a/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp @@ -252,6 +252,6 @@ mlir::createLinalgPromotionPass(bool dynamicBuffers) { return std::make_unique(dynamicBuffers); } - -static PassRegistration - pass("linalg-promote-subviews", "promote subview ops to local buffers"); +std::unique_ptr> mlir::createLinalgPromotionPass() { + return std::make_unique(); +} diff --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp @@ -537,11 +537,3 @@ mlir::createLinalgTilingToParallelLoopsPass(ArrayRef tileSizes) { return std::make_unique>(tileSizes); } - -static PassRegistration> - tiling_pass("linalg-tile", "Tile operations in the linalg dialect"); - -static PassRegistration> - 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 --- a/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt +++ b/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt @@ -5,6 +5,9 @@ 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 --- a/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopFusion.cpp +++ b/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopFusion.cpp @@ -173,6 +173,3 @@ std::unique_ptr mlir::createParallelLoopFusionPass() { return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopSpecialization.cpp +++ b/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopSpecialization.cpp @@ -70,7 +70,3 @@ std::unique_ptr mlir::createParallelLoopSpecializationPass() { return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopTiling.cpp +++ b/mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopTiling.cpp @@ -129,6 +129,3 @@ mlir::createParallelLoopTilingPass(ArrayRef tileSizes) { return std::make_unique(tileSizes); } - -static PassRegistration pass("parallel-loop-tiling", - "Tile parallel loops."); diff --git a/mlir/lib/Dialect/Quant/CMakeLists.txt b/mlir/lib/Dialect/Quant/CMakeLists.txt --- a/mlir/lib/Dialect/Quant/CMakeLists.txt +++ b/mlir/lib/Dialect/Quant/CMakeLists.txt @@ -14,6 +14,7 @@ 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 --- a/mlir/lib/Dialect/Quant/Transforms/ConvertConst.cpp +++ b/mlir/lib/Dialect/Quant/Transforms/ConvertConst.cpp @@ -106,7 +106,3 @@ std::unique_ptr> mlir::quant::createConvertConstPass() { return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/Quant/Transforms/ConvertSimQuant.cpp +++ b/mlir/lib/Dialect/Quant/Transforms/ConvertSimQuant.cpp @@ -142,8 +142,3 @@ mlir::quant::createConvertSimulatedQuantPass() { return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt +++ b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt @@ -5,6 +5,9 @@ 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 --- a/mlir/lib/Dialect/SPIRV/Transforms/DecorateSPIRVCompositeTypeLayoutPass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/DecorateSPIRVCompositeTypeLayoutPass.cpp @@ -117,7 +117,3 @@ mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass() { return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp @@ -264,6 +264,3 @@ mlir::spirv::createLowerABIAttributesPass() { return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp @@ -177,8 +177,3 @@ mlir::spirv::createUpdateVersionCapabilityExtensionPass() { return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Quantizer/CMakeLists.txt +++ b/mlir/lib/Quantizer/CMakeLists.txt @@ -48,6 +48,9 @@ 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 --- a/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp +++ b/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp @@ -113,8 +113,3 @@ mlir::quantizer::createAddDefaultStatsPass() { return std::make_unique(); } - -static PassRegistration 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 --- a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp +++ b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp @@ -282,12 +282,7 @@ SolverContext &solverContext, const TargetConfiguration &config) { return std::make_unique(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> +mlir::quantizer::createInferQuantizedTypesPass() { + return std::make_unique(); } - -static PassRegistration - 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 --- a/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp +++ b/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp @@ -61,8 +61,3 @@ mlir::quantizer::createRemoveInstrumentationPass() { return std::make_unique(); } - -static PassRegistration - pass("quantizer-remove-instrumentation", - "Removes instrumentation and hints which have no effect on final " - "execution");