MLIR  16.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 namespace linalg {
21 
22 //===----------------------------------------------------------------------===//
23 // Patterns to convert a LinalgOp to func.call @external library implementation.
24 //===----------------------------------------------------------------------===//
25 // These patterns are exposed individually because they are expected to be
26 // typically used individually.
27 
28 // Create a new call to the type-canonicalized `LinalgOp::getLibraryCallName()`
29 // function. The implementation of the function can be either in the same module
30 // or in an externally linked library.
31 // This is a generic entry point for all LinalgOp, except for CopyOp, for which
32 // more specialized patterns are provided.
34  : public OpInterfaceRewritePattern<LinalgOp> {
35 public:
37 
38  LogicalResult matchAndRewrite(LinalgOp op,
39  PatternRewriter &rewriter) const override;
40 };
41 
42 /// Populate the given list with patterns that convert from Linalg to Standard.
44 
45 } // namespace linalg
46 
47 /// Create a pass to convert Linalg operations to the Standard dialect.
48 std::unique_ptr<OperationPass<ModuleOp>> createConvertLinalgToStandardPass();
49 
50 } // namespace mlir
51 
52 #endif // MLIR_CONVERSION_LINALGTOSTANDARD_LINALGTOSTANDARD_H_
Include the generated interface declarations.
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
Definition: PatternMatch.h:600
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26
std::unique_ptr< OperationPass< ModuleOp > > createConvertLinalgToStandardPass()
Create a pass to convert Linalg operations to the Standard dialect.
LogicalResult matchAndRewrite(LinalgOp op, PatternRewriter &rewriter) const override
void populateLinalgToStandardConversionPatterns(RewritePatternSet &patterns)
Populate the given list with patterns that convert from Linalg to Standard.
OpInterfaceRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting a...
Definition: PatternMatch.h:370