32 #define GEN_PASS_DEF_TOSATOLINALG
33 #include "mlir/Conversion/Passes.h.inc"
39 struct TosaToLinalg :
public impl::TosaToLinalgBase<TosaToLinalg> {
43 .
insert<arith::ArithDialect, linalg::LinalgDialect, math::MathDialect,
44 index::IndexDialect, tensor::TensorDialect, scf::SCFDialect>();
47 void runOnOperation()
override {
69 FunctionOpInterface func = getOperation();
78 return std::make_unique<TosaToLinalg>();
83 const TosaToLinalgNamedOptions &tosaToLinalgNamedOptions,
84 std::optional<tosa::TosaValidationOptions> validationOptions) {
86 if (!
options.disableTosaDecompositions)
97 {
options.aggressiveReduceConstant}));
99 if (validationOptions)
100 pm.
addPass(tosa::createTosaValidation(*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 "
115 TosaToLinalgOptions tosaToLinalgOptions;
116 TosaToLinalgNamedOptions tosaToLinalgNamedOptions;
117 TosaValidationOptions validationOptions;
118 validationOptions.profile = {
"none"};
119 validationOptions.StrictOperationSpecAlignment =
true;
120 validationOptions.level = tosa::TosaLevelEnum::EightK;
122 tosaToLinalgNamedOptions,
static MLIRContext * getContext(OpFoldResult val)
static llvm::ManagedStatic< PassManagerOptions > options
This class describes a specific conversion target.
void addLegalOp(OperationName op)
Register the given operations as legal.
void addLegalDialect(StringRef name, Names... names)
Register the operations of the given dialects as legal.
void markUnknownOpDynamicallyLegal(const DynamicLegalityCallbackFn &fn)
Register unknown operations as dynamically legal.
void addIllegalDialect(StringRef name, Names... names)
Register the operations of the given dialects as illegal, i.e.
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
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.
Operation is the basic unit of execution within MLIR.
std::unique_ptr< Pass > createTosaMakeBroadcastablePass()
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()
std::unique_ptr< Pass > createTosaOptionalDecompositions()
void populateTosaTypeConversion(TypeConverter &converter)
void registerTosaToLinalgPipelines()
Populates TOSA to linalg pipelines Currently, this includes only the "tosa-to-linalg-pipeline".
std::unique_ptr< Pass > createTosaLayerwiseConstantFoldPass()
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.
std::unique_ptr< Pass > createTosaInferShapesPass()
Include the generated interface declarations.
LogicalResult applyFullConversion(ArrayRef< Operation * > ops, const ConversionTarget &target, const FrozenRewritePatternSet &patterns, ConversionConfig config=ConversionConfig())
Apply a complete conversion on the given operations, and all nested operations.
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...