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
add_subdirectory(Dialect)
add_subdirectory(IR)
add_subdirectory(Interfaces)
+add_subdirectory(Quantizer)
add_subdirectory(Transforms)
add_subdirectory(IR)
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRAffinePassIncGen)
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
/// 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
--- /dev/null
+//===-- 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
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)
#ifndef MLIR_DIALECT_FXPMATHOPS_PASSES_H
#define MLIR_DIALECT_FXPMATHOPS_PASSES_H
+#include <memory>
+
namespace mlir {
class FuncOp;
template <typename T> class OpPassBase;
/// 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
--- /dev/null
+//===-- 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
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)
--- /dev/null
+//===-- 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
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)
--- /dev/null
+//===-- 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
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)
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 = {});
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.
--- /dev/null
+//===-- 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
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)
--- /dev/null
+//===-- 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
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)
--- /dev/null
+//===-- 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
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)
--- /dev/null
+//===-- 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
#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
return;
// Affine
- createSuperVectorizePass({});
- createLoopUnrollPass();
- createLoopUnrollAndJamPass();
- createSimplifyAffineStructuresPass();
- createLoopInvariantCodeMotionPass();
- createAffineLoopInvariantCodeMotionPass();
createLowerAffinePass();
- createLoopTilingPass(0);
- createAffineDataCopyGenerationPass(0, 0);
- createMemRefDataFlowOptPass();
// AVX512
createConvertAVX512ToLLVMPass();
// GPUtoRODCLPass
createLowerGpuOpsToROCDLOpsPass();
- // FxpOpsDialect passes
- fxpmath::createLowerUniformRealMathPass();
- fxpmath::createLowerUniformCastsPass();
-
// GPU
- createGpuKernelOutliningPass();
createSimpleLoopsToGPUPass(0, 0);
createLoopToGPUPass({}, {});
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();
--- /dev/null
+add_subdirectory(Transforms)
--- /dev/null
+
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls)
+add_public_tablegen_target(MLIRQuantizerPassIncGen)
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.
--- /dev/null
+//===-- 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
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
nest->walk([](AffineForOp forOp) { promoteIfSingleIteration(forOp); });
}
}
-
-static PassRegistration<AffineDataCopyGeneration>
- pass("affine-data-copy-generate",
- "Generate explicit copying for memory operations");
mlir::createAffineLoopInvariantCodeMotionPass() {
return std::make_unique<LoopInvariantCodeMotion>();
}
-
-static PassRegistration<LoopInvariantCodeMotion>
- pass("affine-loop-invariant-code-motion",
- "Hoist loop invariant instructions outside of the loop");
DEPENDS
MLIRAffineOpsIncGen
+ MLIRAffinePassIncGen
MLIRLoopLikeInterfaceIncGen
)
target_link_libraries(MLIRAffineTransforms
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.
constexpr unsigned LoopTiling::kDefaultTileSize;
constexpr uint64_t LoopTiling::kDefaultCacheMemCapacity;
-
-static PassRegistration<LoopTiling> pass("affine-loop-tile", "Tile loop nests");
unrollFactor == -1 ? None : Optional<unsigned>(unrollFactor),
unrollFull == -1 ? None : Optional<bool>(unrollFull), getUnrollFactor);
}
-
-static PassRegistration<LoopUnroll> pass("affine-loop-unroll", "Unroll loops");
// Unroll and jam by four otherwise.
return loopUnrollJamByFactor(forOp, kDefaultUnrollJamFactor);
}
-
-static PassRegistration<LoopUnrollAndJam> pass("affine-loop-unroll-jam",
- "Unroll and jam loops");
normalizeMemRef(allocOp);
}
}
-
-static PassRegistration<SimplifyAffineStructures>
- pass("simplify-affine-structures",
- "Simplify affine expressions in maps/sets and normalize memrefs");
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>();
+}
DEPENDS
MLIRFxpMathOpsIncGen
+ MLIRFxpMathPassIncGen
)
target_link_libraries(MLIRFxpMathOps
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
//===----------------------------------------------------------------------===//
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.");
DEPENDS
MLIRGPUOpsIncGen
+ MLIRGPUPassIncGen
MLIRParallelLoopMapperAttrGen
MLIRParallelLoopMapperEnumsGen
)
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.");
add_mlir_dialect_library(MLIRLLVMIRTransforms
LegalizeForExport.cpp
+
+ DEPENDS
+ MLIRLLVMPassIncGen
)
target_link_libraries(MLIRLLVMIRTransforms
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");
DEPENDS
intrinsics_gen
+ MLIRLinalgPassIncGen
MLIRLinalgTransformPatternsIncGen
)
target_link_libraries(MLIRLinalgTransforms
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>();
+}
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");
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>();
+}
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");
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LoopOps
+
+ DEPENDS
+ MLIRLoopPassIncGen
)
target_link_libraries(MLIRLoopOpsTransforms
PUBLIC
std::unique_ptr<Pass> mlir::createParallelLoopFusionPass() {
return std::make_unique<ParallelLoopFusion>();
}
-
-static PassRegistration<ParallelLoopFusion>
- pass("parallel-loop-fusion", "Fuse adjacent parallel loops.");
std::unique_ptr<Pass> mlir::createParallelLoopSpecializationPass() {
return std::make_unique<ParallelLoopSpecialization>();
}
-
-static PassRegistration<ParallelLoopSpecialization>
- pass("parallel-loop-specialization",
- "Specialize parallel loops for vectorization.");
mlir::createParallelLoopTilingPass(ArrayRef<int64_t> tileSizes) {
return std::make_unique<ParallelLoopTiling>(tileSizes);
}
-
-static PassRegistration<ParallelLoopTiling> pass("parallel-loop-tiling",
- "Tile parallel loops.");
DEPENDS
MLIRQuantOpsIncGen
+ MLIRQuantPassIncGen
)
target_link_libraries(MLIRQuant
PUBLIC
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");
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.");
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
+
+ DEPENDS
+ MLIRSPIRVPassIncGen
)
target_link_libraries(MLIRSPIRVTransforms
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");
mlir::spirv::createLowerABIAttributesPass() {
return std::make_unique<LowerABIAttributesPass>();
}
-
-static PassRegistration<LowerABIAttributesPass>
- pass("spirv-lower-abi-attrs", "Lower SPIR-V ABI Attributes");
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");
Transforms/RemoveInstrumentationPass.cpp
ADDITIONAL_HEADER_DIRS
+
+ DEPENDS
+ MLIRQuantizerPassIncGen
)
target_link_libraries(MLIRQuantizerTransforms
PUBLIC
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.");
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");
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");