MLIR 22.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
16namespace mlir {
17class ModuleOp;
18template <typename T>
19class OperationPass;
20
21#define GEN_PASS_DECL_CONVERTLINALGTOSTANDARDPASS
22#include "mlir/Conversion/Passes.h.inc"
23
24namespace 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> {
39public:
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_
Pass to transform an operation of a specific type.
Definition Pass.h:356
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
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(MLIRContext *context, PatternBenefit benefit=1)