MLIR 22.0.0git
TosaOptionalDecompositions.cpp
Go to the documentation of this file.
1//===- TosaOptionalDecompositions.cpp -------------------------------------===//
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// Pass to apply the Tosa operations decompositions
10// exposed as populate functions in
11// include/mlir/Dialect/Tosa/Transforms/Passes.h
12//
13//===----------------------------------------------------------------------===//
14
16
19
20namespace mlir {
21namespace tosa {
22#define GEN_PASS_DEF_TOSAOPTIONALDECOMPOSITIONSPASS
23#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
24} // namespace tosa
25} // namespace mlir
26
27using namespace mlir;
28
29namespace {
30
31struct TosaOptionalDecompositions
33 TosaOptionalDecompositions> {
34 void runOnOperation() override {
35 auto *ctx = &getContext();
36 RewritePatternSet patterns(ctx);
37 auto func = getOperation();
38
41
42 if (applyPatternsGreedily(func, std::move(patterns)).failed())
43 signalPassFailure();
44 }
45};
46
47} // namespace
b getContext())
detail::InFlightRemark failed(Location loc, RemarkOpts opts)
Report an optimization remark that failed.
Definition Remarks.h:561
void populateTosaDecomposeDepthwise(MLIRContext *ctx, RewritePatternSet &patterns)
void populateTosaDecomposeTransposeConv(MLIRContext *ctx, RewritePatternSet &patterns)
Include the generated interface declarations.
LogicalResult applyPatternsGreedily(Region &region, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config=GreedyRewriteConfig(), bool *changed=nullptr)
Rewrite ops in the given region, which must be isolated from above, by repeatedly applying the highes...
const FrozenRewritePatternSet & patterns