MLIR 24.0.0git
MathTransformOps.cpp
Go to the documentation of this file.
1//===- MathTransformOps.cpp - Implementation of Math transform ops --------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
16
17using namespace mlir;
18
19//===----------------------------------------------------------------------===//
20// Apply...PatternsOp
21//===----------------------------------------------------------------------===//
22
23void transform::ApplyF32ExpansionPatternsOp::populatePatterns(
24 RewritePatternSet &patterns) {
25 populateMathF32ExpansionPatterns(patterns, [](StringRef) { return true; });
26}
27
28void transform::ApplyPolynomialApproximationPatternsOp::populatePatterns(
29 RewritePatternSet &patterns) {
31 [](StringRef) { return true; });
32}
33
34//===----------------------------------------------------------------------===//
35// Transform op registration
36//===----------------------------------------------------------------------===//
37
38namespace {
39class MathTransformDialectExtension
41 MathTransformDialectExtension> {
42public:
43 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MathTransformDialectExtension)
44
45 MathTransformDialectExtension() {
46 declareGeneratedDialect<arith::ArithDialect>();
47 declareGeneratedDialect<math::MathDialect>();
48 declareGeneratedDialect<vector::VectorDialect>();
49 registerTransformOps<
50#define GET_OP_LIST
51#include "mlir/Dialect/Math/TransformOps/MathTransformOps.cpp.inc"
52 >();
53 }
54};
55} // namespace
56
57#define GET_OP_CLASSES
58#include "mlir/Dialect/Math/TransformOps/MathTransformOps.cpp.inc"
59
61 registry.addExtensions<MathTransformDialectExtension>();
62}
#define MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CLASS_NAME)
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
void addExtensions()
Add the given extensions to the registry.
Base class for extensions of the Transform dialect that supports injecting operations into the Transf...
void registerTransformDialectExtension(DialectRegistry &registry)
Include the generated interface declarations.
void populateMathF32ExpansionPatterns(RewritePatternSet &patterns, llvm::function_ref< bool(StringRef)> predicate, PatternBenefit=1)
void populateMathPolynomialApproximationPatterns(RewritePatternSet &patterns, llvm::function_ref< bool(StringRef)> predicate, PatternBenefit=1)