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/Pass/Pass.h" 18 19 namespace mlir { 20 namespace tosa { 21 22 // Expose Rewrite Functions that decompose TOSA Ops into further TOSA Ops. 23 // The rewrites can be selectively added to a conversion pass. 24 void populateTosaDecomposeConv2D(MLIRContext *ctx, RewritePatternSet &patterns); 25 void populateTosaDecomposeTransposeConv(MLIRContext *ctx, 26 RewritePatternSet &patterns); 27 void populateTosaDecomposeDepthwise(MLIRContext *ctx, 28 RewritePatternSet &patterns); 29 void populateTosaFoldConstantTransposePatterns(MLIRContext *ctx, 30 RewritePatternSet &patterns); 31 32 std::unique_ptr<Pass> createTosaLayerwiseConstantFoldPass(); 33 std::unique_ptr<Pass> createTosaInferShapesPass(); 34 std::unique_ptr<Pass> createTosaMakeBroadcastablePass(); 35 std::unique_ptr<Pass> createTosaTestQuantUtilAPIPass(); 36 std::unique_ptr<Pass> createTosaOptionalDecompositions(); 37 38 #define GEN_PASS_REGISTRATION 39 #include "mlir/Dialect/Tosa/Transforms/Passes.h.inc" 40 41 } // namespace tosa 42 } // namespace mlir 43 44 #endif // MLIR_DIALECT_TOSA_TRANSFORMS_PASSES_H 45