30#define GEN_PASS_DEF_TOSATOLINALG
31#include "mlir/Conversion/Passes.h.inc"
39 void getDependentDialects(DialectRegistry ®istry)
const override {
41 .
insert<arith::ArithDialect, linalg::LinalgDialect, math::MathDialect,
42 index::IndexDialect, tensor::TensorDialect, scf::SCFDialect>();
45 void runOnOperation()
override {
48 target.addLegalDialect<linalg::LinalgDialect, tensor::TensorDialect,
50 target.addIllegalDialect<tosa::TosaDialect>();
53 target.addLegalOp<tosa::ApplyScaleOp>();
54 target.addLegalOp<tosa::IfOp>();
55 target.addLegalOp<tosa::ConstOp>();
56 target.addLegalOp<tosa::ConstShapeOp>();
57 target.addLegalOp<tosa::WhileOp>();
58 target.addLegalOp<tosa::ConcatOp>();
59 target.addLegalOp<tosa::SliceOp>();
60 target.addLegalOp<tosa::ReshapeOp>();
61 target.addLegalOp<tosa::PadOp>();
63 target.markUnknownOpDynamicallyLegal([](Operation *) {
return true; });
65 TypeConverter converter;
68 FunctionOpInterface func = getOperation();
77 return std::make_unique<TosaToLinalg>();
83 std::optional<tosa::TosaValidationOptions> validationOptions) {
85 if (!
options.disableTosaDecompositions)
97 {
options.aggressiveReduceConstant}));
99 if (validationOptions)
110 "tosa-to-linalg-pipeline",
111 "The default pipeline for converting TOSA operators to the equivalent "
112 "operations using the tensor operations in LinAlg as well as LinAlg "
121 tosaToLinalgNamedOptions,
static llvm::ManagedStatic< PassManagerOptions > options
This class represents a pass manager that runs passes on either a specific operation type,...
void addPass(std::unique_ptr< Pass > pass)
Add the given pass to this pass manager.
void addNestedPass(std::unique_ptr< Pass > pass)
Add the given pass to a nested pass manager for the given operation kind OpT.
std::unique_ptr<::mlir::Pass > createTosaLayerwiseConstantFoldPass()
std::unique_ptr<::mlir::Pass > createTosaMakeBroadcastablePass()
std::unique_ptr<::mlir::Pass > createTosaInferShapesPass()
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())
void addTosaToLinalgPasses(OpPassManager &pm, const TosaToLinalgOptions &options, const TosaToLinalgNamedOptions &tosaToLinalgNamedOptions=TosaToLinalgNamedOptions(), std::optional< tosa::TosaValidationOptions > validationOptions=tosa::TosaValidationOptions{false, false})
Populates passes to convert from TOSA to Linalg on buffers.
std::unique_ptr< Pass > createTosaToLinalg()
std::unique_ptr<::mlir::Pass > createTosaValidation()
void populateTosaTypeConversion(TypeConverter &converter)
void registerTosaToLinalgPipelines()
Populates TOSA to linalg pipelines Currently, this includes only the "tosa-to-linalg-pipeline".
std::unique_ptr<::mlir::Pass > createTosaOptionalDecompositionsPass()
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns
std::unique_ptr< Pass > createCanonicalizerPass()
Creates an instance of the Canonicalizer pass, configured with default settings (which can be overrid...
PassPipelineRegistration provides a global initializer that registers a Pass pipeline builder routine...
bool allowInvalidOpDatatypeCombinations
bool strictOpSpecAlignment