MLIR  21.0.0git
Passes.h
Go to the documentation of this file.
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 
18 #include "mlir/Dialect/Tosa/Transforms/PassesEnums.h.inc"
19 #include "mlir/Pass/Pass.h"
20 
21 namespace mlir {
22 class TypeConverter;
23 namespace 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.
30 void populateTosaDecomposeTransposeConv(MLIRContext *ctx,
31  RewritePatternSet &patterns);
32 void populateTosaDecomposeDepthwise(MLIRContext *ctx,
33  RewritePatternSet &patterns);
34 void populateTosaFoldConstantReciprocalPatterns(MLIRContext *ctx,
35  RewritePatternSet &patterns);
36 void populateTosaFoldConstantTransposePatterns(MLIRContext *ctx,
37  RewritePatternSet &patterns);
38 void populateTosaConstantReduction(MLIRContext *ctx,
39  RewritePatternSet &patterns,
40  bool aggressiveReduceConstant);
41 
42 void populateTosaTypeConversion(TypeConverter &converter);
43 
44 std::unique_ptr<Pass> createTosaLayerwiseConstantFoldPass();
45 std::unique_ptr<Pass> createTosaLayerwiseConstantFoldPass(
46  const TosaLayerwiseConstantFoldPassOptions &options);
47 std::unique_ptr<Pass> createTosaInferShapesPass();
48 std::unique_ptr<Pass> createTosaMakeBroadcastablePass();
49 std::unique_ptr<Pass> createTosaTestQuantUtilAPIPass();
50 std::unique_ptr<Pass> createTosaOptionalDecompositions();
51 
52 #define GEN_PASS_REGISTRATION
53 #include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
54 
55 } // namespace tosa
56 } // namespace mlir
57 
58 #endif // MLIR_DIALECT_TOSA_TRANSFORMS_PASSES_H
static llvm::ManagedStatic< PassManagerOptions > options
std::unique_ptr< Pass > createTosaMakeBroadcastablePass()
void populateTosaDecomposeDepthwise(MLIRContext *ctx, RewritePatternSet &patterns)
std::unique_ptr< Pass > createTosaTestQuantUtilAPIPass()
void populateTosaConstantReduction(MLIRContext *ctx, RewritePatternSet &patterns, bool aggressiveReduceConstant)
std::unique_ptr< Pass > createTosaOptionalDecompositions()
void populateTosaFoldConstantReciprocalPatterns(MLIRContext *ctx, RewritePatternSet &patterns)
void populateTosaTypeConversion(TypeConverter &converter)
void populateTosaDecomposeTransposeConv(MLIRContext *ctx, RewritePatternSet &patterns)
std::unique_ptr< Pass > createTosaLayerwiseConstantFoldPass()
std::unique_ptr< Pass > createTosaInferShapesPass()
void populateTosaFoldConstantTransposePatterns(MLIRContext *ctx, RewritePatternSet &patterns)
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns