MLIR  20.0.0git
TosaToLinalg.h
Go to the documentation of this file.
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 
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.
37  OpPassManager &pm, const TosaToLinalgOptions &options,
38  const TosaToLinalgNamedOptions &tosaToLinalgNamedOptions =
39  TosaToLinalgNamedOptions(),
40  // Note: Default to 'none' level unless otherwise specified.
41  std::optional<tosa::TosaValidationOptions> validationOptions =
42  tosa::TosaValidationOptions{
43  {"none"}, false, tosa::TosaLevelEnum::None});
44 
45 /// Populates TOSA to linalg pipelines
46 /// Currently, this includes only the "tosa-to-linalg-pipeline".
48 
49 /// Populates conversion passes from TOSA dialect to Linalg dialect.
50 void populateTosaToLinalgConversionPatterns(const TypeConverter &converter,
51  RewritePatternSet *patterns);
52 
53 /// Populates conversion passes from TOSA dialect to Linalg named operations.
55  RewritePatternSet *patterns, const TosaToLinalgNamedOptions &options);
56 
57 } // namespace tosa
58 } // namespace mlir
59 
60 #endif // MLIR_CONVERSION_TOSATOLINALG_TOSATOLINALG_H
@ None
static llvm::ManagedStatic< PassManagerOptions > options
void populateTosaToLinalgConversionPatterns(const TypeConverter &converter, RewritePatternSet *patterns)
Populates conversion passes from TOSA dialect to Linalg dialect.
std::unique_ptr< Pass > createTosaToLinalgNamed(const TosaToLinalgNamedOptions &options=TosaToLinalgNamedOptions())
std::unique_ptr< Pass > createTosaToLinalg()
void registerTosaToLinalgPipelines()
Populates TOSA to linalg pipelines Currently, this includes only the "tosa-to-linalg-pipeline".
void populateTosaToLinalgNamedConversionPatterns(RewritePatternSet *patterns, const TosaToLinalgNamedOptions &options)
Populates conversion passes from TOSA dialect to Linalg named operations.
void addTosaToLinalgPasses(OpPassManager &pm, const TosaToLinalgOptions &options, const TosaToLinalgNamedOptions &tosaToLinalgNamedOptions=TosaToLinalgNamedOptions(), std::optional< tosa::TosaValidationOptions > validationOptions=tosa::TosaValidationOptions{ {"none"}, false, tosa::TosaLevelEnum::None})
Populates passes to convert from TOSA to Linalg on buffers.
Include the generated interface declarations.