1//===-- Passes.h - TOSA optimization pass declarations ----------*- C++ -*-===//
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// This file declares the optimization passes for the TOSA Dialect in MLIR.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef MLIR_DIALECT_TOSA_TRANSFORMS_PASSES_H
14#define MLIR_DIALECT_TOSA_TRANSFORMS_PASSES_H
15
16#include "mlir/Dialect/Tensor/IR/Tensor.h"
17#include "mlir/Dialect/Tosa/IR/TosaOps.h"
18#include "mlir/Dialect/Tosa/Transforms/PassesEnums.h.inc"
19#include "mlir/Pass/Pass.h"
20
21namespace mlir {
22class TypeConverter;
23namespace tosa {
24
25#define GEN_PASS_DECL
26#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
27
28// Expose Rewrite Functions that decompose TOSA Ops into further TOSA Ops.
29// The rewrites can be selectively added to a conversion pass.
30void populateTosaDecomposeTransposeConv(MLIRContext *ctx,
31 RewritePatternSet &patterns);
32void populateTosaDecomposeDepthwise(MLIRContext *ctx,
33 RewritePatternSet &patterns);
34void populateTosaFoldConstantReciprocalPatterns(MLIRContext *ctx,
35 RewritePatternSet &patterns);
36void populateTosaFoldConstantTransposePatterns(MLIRContext *ctx,
37 RewritePatternSet &patterns);
38void populateTosaConstantReduction(MLIRContext *ctx,
39 RewritePatternSet &patterns,
40 bool aggressiveReduceConstant);
41
42void populateTosaTypeConversion(TypeConverter &converter);
43
44std::unique_ptr<Pass> createTosaTestQuantUtilAPIPass();
45
46#define GEN_PASS_REGISTRATION
47#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
48
49} // namespace tosa
50} // namespace mlir
51
52#endif // MLIR_DIALECT_TOSA_TRANSFORMS_PASSES_H
53

source code of mlir/include/mlir/Dialect/Tosa/Transforms/Passes.h