1 | //===-- TosaToLinalg.h - TOSA optimization pass declarations ----------*- C++ |
2 | //-*-===// |
3 | // |
4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
5 | // See https://llvm.org/LICENSE.txt for license information. |
6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
7 | // |
8 | //===----------------------------------------------------------------------===// |
9 | // |
10 | // This file declares the passes for the TOSA Linalg Dialect in MLIR. |
11 | // |
12 | //===----------------------------------------------------------------------===// |
13 | |
14 | #ifndef MLIR_CONVERSION_TOSATOLINALG_TOSATOLINALG_H |
15 | #define MLIR_CONVERSION_TOSATOLINALG_TOSATOLINALG_H |
16 | |
17 | #include "mlir/Dialect/Tosa/Transforms/Passes.h" |
18 | #include "mlir/Pass/Pass.h" |
19 | |
20 | namespace mlir { |
21 | |
22 | #define GEN_PASS_DECL_TOSATOLINALG |
23 | #define GEN_PASS_DECL_TOSATOLINALGNAMED |
24 | #include "mlir/Conversion/Passes.h.inc" |
25 | |
26 | namespace tosa { |
27 | |
28 | std::unique_ptr<Pass> createTosaToLinalg(); |
29 | std::unique_ptr<Pass> createTosaToLinalgNamed( |
30 | const TosaToLinalgNamedOptions &options = TosaToLinalgNamedOptions()); |
31 | |
32 | /// Populates passes to convert from TOSA to Linalg on buffers. At the end of |
33 | /// the pass, the function will only contain linalg ops or standard ops if the |
34 | /// pipeline succeeds. The option to disable decompositions is available for |
35 | /// benchmarking performance improvements from the canonicalizations. |
36 | void addTosaToLinalgPasses( |
37 | OpPassManager &pm, const TosaToLinalgOptions &options, |
38 | const TosaToLinalgNamedOptions &tosaToLinalgNamedOptions = |
39 | TosaToLinalgNamedOptions(), |
40 | // Note: Default to 'none' level unless otherwise specified. |
41 | tosa::TosaValidationOptions const &validationOptions = { |
42 | tosa::TosaProfileEnum::Undefined, false, tosa::TosaLevelEnum::None}); |
43 | |
44 | /// Populates TOSA to linalg pipelines |
45 | /// Currently, this includes only the "tosa-to-linalg-pipeline". |
46 | void registerTosaToLinalgPipelines(); |
47 | |
48 | /// Populates conversion passes from TOSA dialect to Linalg dialect. |
49 | void populateTosaToLinalgConversionPatterns(RewritePatternSet *patterns); |
50 | |
51 | /// Populates conversion passes from TOSA dialect to Linalg named operations. |
52 | void populateTosaToLinalgNamedConversionPatterns( |
53 | RewritePatternSet *patterns, const TosaToLinalgNamedOptions &options); |
54 | |
55 | } // namespace tosa |
56 | } // namespace mlir |
57 | |
58 | #endif // MLIR_CONVERSION_TOSATOLINALG_TOSATOLINALG_H |
59 | |