MLIR  21.0.0git
LinalgToStandard.h
Go to the documentation of this file.
1 //===- LinalgToStandard.h - Utils to convert from the linalg dialect ------===//
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 
9 #ifndef MLIR_CONVERSION_LINALGTOSTANDARD_LINALGTOSTANDARD_H_
10 #define MLIR_CONVERSION_LINALGTOSTANDARD_LINALGTOSTANDARD_H_
11 
13 #include "mlir/Pass/Pass.h"
15 
16 namespace mlir {
17 class ModuleOp;
18 template <typename T>
19 class OperationPass;
20 
21 #define GEN_PASS_DECL_CONVERTLINALGTOSTANDARDPASS
22 #include "mlir/Conversion/Passes.h.inc"
23 
24 namespace linalg {
25 
26 //===----------------------------------------------------------------------===//
27 // Patterns to convert a LinalgOp to func.call @external library implementation.
28 //===----------------------------------------------------------------------===//
29 // These patterns are exposed individually because they are expected to be
30 // typically used individually.
31 
32 // Create a new call to the type-canonicalized `LinalgOp::getLibraryCallName()`
33 // function. The implementation of the function can be either in the same module
34 // or in an externally linked library.
35 // This is a generic entry point for all LinalgOp, except for CopyOp, for which
36 // more specialized patterns are provided.
38  : public OpInterfaceRewritePattern<LinalgOp> {
39 public:
41 
42  LogicalResult matchAndRewrite(LinalgOp op,
43  PatternRewriter &rewriter) const override;
44 };
45 
46 /// Populate the given list with patterns that convert from Linalg to Standard.
48 
49 } // namespace linalg
50 } // namespace mlir
51 
52 #endif // MLIR_CONVERSION_LINALGTOSTANDARD_LINALGTOSTANDARD_H_
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
Definition: PatternMatch.h:803
LogicalResult matchAndRewrite(LinalgOp op, PatternRewriter &rewriter) const override
void populateLinalgToStandardConversionPatterns(RewritePatternSet &patterns)
Populate the given list with patterns that convert from Linalg to Standard.
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns
OpInterfaceRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting a...
Definition: PatternMatch.h:379