MLIR  17.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 
14 
15 namespace mlir {
16 class ModuleOp;
17 template <typename T>
18 class OperationPass;
19 
20 #define GEN_PASS_DECL_CONVERTLINALGTOSTANDARD
21 #include "mlir/Conversion/Passes.h.inc"
22 
23 namespace linalg {
24 
25 //===----------------------------------------------------------------------===//
26 // Patterns to convert a LinalgOp to func.call @external library implementation.
27 //===----------------------------------------------------------------------===//
28 // These patterns are exposed individually because they are expected to be
29 // typically used individually.
30 
31 // Create a new call to the type-canonicalized `LinalgOp::getLibraryCallName()`
32 // function. The implementation of the function can be either in the same module
33 // or in an externally linked library.
34 // This is a generic entry point for all LinalgOp, except for CopyOp, for which
35 // more specialized patterns are provided.
37  : public OpInterfaceRewritePattern<LinalgOp> {
38 public:
40 
41  LogicalResult matchAndRewrite(LinalgOp op,
42  PatternRewriter &rewriter) const override;
43 };
44 
45 /// Populate the given list with patterns that convert from Linalg to Standard.
47 
48 } // namespace linalg
49 
50 /// Create a pass to convert Linalg operations to the Standard dialect.
51 std::unique_ptr<OperationPass<ModuleOp>> createConvertLinalgToStandardPass();
52 
53 } // namespace mlir
54 
55 #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:621
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.
std::unique_ptr< OperationPass< ModuleOp > > createConvertLinalgToStandardPass()
Create a pass to convert Linalg operations to the Standard dialect.
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26
OpInterfaceRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting a...
Definition: PatternMatch.h:372