#ifdef GEN_PASS_DECL
#define GEN_PASS_DECL_TOSAINFERSHAPES
#define GEN_PASS_DECL_TOSALAYERWISECONSTANTFOLDPASS
#define GEN_PASS_DECL_TOSAMAKEBROADCASTABLE
#define GEN_PASS_DECL_TOSAOPTIONALDECOMPOSITIONS
#define GEN_PASS_DECL_TOSAREDUCETRANSPOSES
#define GEN_PASS_DECL_TOSAVALIDATION
#undef GEN_PASS_DECL
#endif
#ifdef GEN_PASS_DECL_TOSAINFERSHAPES
#undef GEN_PASS_DECL_TOSAINFERSHAPES
#endif
#ifdef GEN_PASS_DEF_TOSAINFERSHAPES
namespace impl {
template <typename DerivedT>
class TosaInferShapesBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = TosaInferShapesBase;
TosaInferShapesBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaInferShapesBase(const TosaInferShapesBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
TosaInferShapesBase& operator=(const TosaInferShapesBase &) = delete;
TosaInferShapesBase(TosaInferShapesBase &&) = delete;
TosaInferShapesBase& operator=(TosaInferShapesBase &&) = delete;
~TosaInferShapesBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-infer-shapes");
}
::llvm::StringRef getArgument() const override { return "tosa-infer-shapes"; }
::llvm::StringRef getDescription() const override { return "Propagate shapes across TOSA operations"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaInferShapes");
}
::llvm::StringRef getName() const override { return "TosaInferShapes"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<func::FuncDialect>();
registry.insert<tensor::TensorDialect>();
registry.insert<tosa::TosaDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaInferShapesBase<DerivedT>)
protected:
private:
};
}
#undef GEN_PASS_DEF_TOSAINFERSHAPES
#endif
#ifdef GEN_PASS_DECL_TOSALAYERWISECONSTANTFOLDPASS
struct TosaLayerwiseConstantFoldPassOptions { … };
#undef GEN_PASS_DECL_TOSALAYERWISECONSTANTFOLDPASS
#endif
#ifdef GEN_PASS_DEF_TOSALAYERWISECONSTANTFOLDPASS
namespace impl {
template <typename DerivedT>
class TosaLayerwiseConstantFoldPassBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = TosaLayerwiseConstantFoldPassBase;
TosaLayerwiseConstantFoldPassBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaLayerwiseConstantFoldPassBase(const TosaLayerwiseConstantFoldPassBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
TosaLayerwiseConstantFoldPassBase& operator=(const TosaLayerwiseConstantFoldPassBase &) = delete;
TosaLayerwiseConstantFoldPassBase(TosaLayerwiseConstantFoldPassBase &&) = delete;
TosaLayerwiseConstantFoldPassBase& operator=(TosaLayerwiseConstantFoldPassBase &&) = delete;
~TosaLayerwiseConstantFoldPassBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-layerwise-constant-fold");
}
::llvm::StringRef getArgument() const override { return "tosa-layerwise-constant-fold"; }
::llvm::StringRef getDescription() const override { return "Fold layerwise operations on constant tensors"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaLayerwiseConstantFoldPass");
}
::llvm::StringRef getName() const override { return "TosaLayerwiseConstantFoldPass"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaLayerwiseConstantFoldPassBase<DerivedT>)
TosaLayerwiseConstantFoldPassBase(TosaLayerwiseConstantFoldPassOptions options) : TosaLayerwiseConstantFoldPassBase() {
aggressiveReduceConstant = std::move(options.aggressiveReduceConstant);
}
protected:
::mlir::Pass::Option<bool> aggressiveReduceConstant{*this, "aggressive-reduce-constant", ::llvm::cl::desc("Always perform the reduce constant optimizationMay add more tosa.const but would reduce runtime calculations"), ::llvm::cl::init(false)};
private:
};
}
#undef GEN_PASS_DEF_TOSALAYERWISECONSTANTFOLDPASS
#endif
#ifdef GEN_PASS_DECL_TOSAMAKEBROADCASTABLE
#undef GEN_PASS_DECL_TOSAMAKEBROADCASTABLE
#endif
#ifdef GEN_PASS_DEF_TOSAMAKEBROADCASTABLE
namespace impl {
template <typename DerivedT>
class TosaMakeBroadcastableBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = TosaMakeBroadcastableBase;
TosaMakeBroadcastableBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaMakeBroadcastableBase(const TosaMakeBroadcastableBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
TosaMakeBroadcastableBase& operator=(const TosaMakeBroadcastableBase &) = delete;
TosaMakeBroadcastableBase(TosaMakeBroadcastableBase &&) = delete;
TosaMakeBroadcastableBase& operator=(TosaMakeBroadcastableBase &&) = delete;
~TosaMakeBroadcastableBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-make-broadcastable");
}
::llvm::StringRef getArgument() const override { return "tosa-make-broadcastable"; }
::llvm::StringRef getDescription() const override { return "TOSA rank Reshape to enable Broadcasting"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaMakeBroadcastable");
}
::llvm::StringRef getName() const override { return "TosaMakeBroadcastable"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaMakeBroadcastableBase<DerivedT>)
protected:
private:
};
}
#undef GEN_PASS_DEF_TOSAMAKEBROADCASTABLE
#endif
#ifdef GEN_PASS_DECL_TOSAOPTIONALDECOMPOSITIONS
#undef GEN_PASS_DECL_TOSAOPTIONALDECOMPOSITIONS
#endif
#ifdef GEN_PASS_DEF_TOSAOPTIONALDECOMPOSITIONS
namespace impl {
template <typename DerivedT>
class TosaOptionalDecompositionsBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = TosaOptionalDecompositionsBase;
TosaOptionalDecompositionsBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaOptionalDecompositionsBase(const TosaOptionalDecompositionsBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
TosaOptionalDecompositionsBase& operator=(const TosaOptionalDecompositionsBase &) = delete;
TosaOptionalDecompositionsBase(TosaOptionalDecompositionsBase &&) = delete;
TosaOptionalDecompositionsBase& operator=(TosaOptionalDecompositionsBase &&) = delete;
~TosaOptionalDecompositionsBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-optional-decompositions");
}
::llvm::StringRef getArgument() const override { return "tosa-optional-decompositions"; }
::llvm::StringRef getDescription() const override { return "Applies Tosa operations optional decompositions"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaOptionalDecompositions");
}
::llvm::StringRef getName() const override { return "TosaOptionalDecompositions"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaOptionalDecompositionsBase<DerivedT>)
protected:
private:
};
}
#undef GEN_PASS_DEF_TOSAOPTIONALDECOMPOSITIONS
#endif
#ifdef GEN_PASS_DECL_TOSAREDUCETRANSPOSES
std::unique_ptr<::mlir::Pass> createTosaReduceTransposes();
#undef GEN_PASS_DECL_TOSAREDUCETRANSPOSES
#endif
#ifdef GEN_PASS_DEF_TOSAREDUCETRANSPOSES
namespace impl {
std::unique_ptr<::mlir::Pass> createTosaReduceTransposes();
}
namespace impl {
template <typename DerivedT>
class TosaReduceTransposesBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = TosaReduceTransposesBase;
TosaReduceTransposesBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaReduceTransposesBase(const TosaReduceTransposesBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
TosaReduceTransposesBase& operator=(const TosaReduceTransposesBase &) = delete;
TosaReduceTransposesBase(TosaReduceTransposesBase &&) = delete;
TosaReduceTransposesBase& operator=(TosaReduceTransposesBase &&) = delete;
~TosaReduceTransposesBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-reduce-transposes");
}
::llvm::StringRef getArgument() const override { return "tosa-reduce-transposes"; }
::llvm::StringRef getDescription() const override { return "Reduce transposes through other operators"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaReduceTransposes");
}
::llvm::StringRef getName() const override { return "TosaReduceTransposes"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaReduceTransposesBase<DerivedT>)
protected:
private:
friend std::unique_ptr<::mlir::Pass> createTosaReduceTransposes() {
return std::make_unique<DerivedT>();
}
};
}
std::unique_ptr<::mlir::Pass> createTosaReduceTransposes() {
return impl::createTosaReduceTransposes();
}
#undef GEN_PASS_DEF_TOSAREDUCETRANSPOSES
#endif
#ifdef GEN_PASS_DECL_TOSAVALIDATION
struct TosaValidationOptions { … };
std::unique_ptr<::mlir::Pass> createTosaValidation();
std::unique_ptr<::mlir::Pass> createTosaValidation(TosaValidationOptions options);
#undef GEN_PASS_DECL_TOSAVALIDATION
#endif
#ifdef GEN_PASS_DEF_TOSAVALIDATION
namespace impl {
std::unique_ptr<::mlir::Pass> createTosaValidation();
}
namespace impl {
std::unique_ptr<::mlir::Pass> createTosaValidation(TosaValidationOptions options);
}
namespace impl {
template <typename DerivedT>
class TosaValidationBase : public ::mlir::OperationPass<mlir::ModuleOp> {
public:
using Base = TosaValidationBase;
TosaValidationBase() : ::mlir::OperationPass<mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaValidationBase(const TosaValidationBase &other) : ::mlir::OperationPass<mlir::ModuleOp>(other) {}
TosaValidationBase& operator=(const TosaValidationBase &) = delete;
TosaValidationBase(TosaValidationBase &&) = delete;
TosaValidationBase& operator=(TosaValidationBase &&) = delete;
~TosaValidationBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-validate");
}
::llvm::StringRef getArgument() const override { return "tosa-validate"; }
::llvm::StringRef getDescription() const override { return "Validates TOSA dialect"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaValidation");
}
::llvm::StringRef getName() const override { return "TosaValidation"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaValidationBase<DerivedT>)
TosaValidationBase(TosaValidationOptions options) : TosaValidationBase() {
profile = std::move(options.profile);
StrictOperationSpecAlignment = std::move(options.StrictOperationSpecAlignment);
level = std::move(options.level);
}
protected:
::mlir::Pass::Option<mlir::tosa::TosaProfileEnum> profile{*this, "profile", ::llvm::cl::desc("Validate if operations match for the given profile"), ::llvm::cl::init(mlir::tosa::TosaProfileEnum::Undefined), ::llvm::cl::values(
clEnumValN(mlir::tosa::TosaProfileEnum::BaseInference, "bi",
"Use Base Inference profile."),
clEnumValN(mlir::tosa::TosaProfileEnum::MainInference, "mi",
"Use Main Inference profile."),
clEnumValN(mlir::tosa::TosaProfileEnum::MainTraining, "mt",
"Use Main Training profile."),
clEnumValN(mlir::tosa::TosaProfileEnum::Undefined, "undefined",
"Do not define a profile.")
)};
::mlir::Pass::Option<bool> StrictOperationSpecAlignment{*this, "strict-op-spec-alignment", ::llvm::cl::desc("Verify if the properties of certain operations align the spec requirement"), ::llvm::cl::init(false)};
::mlir::Pass::Option<mlir::tosa::TosaLevelEnum> level{*this, "level", ::llvm::cl::desc("Validate if operator parameters are within specfication for the given level"), ::llvm::cl::init(mlir::tosa::TosaLevelEnum::EightK), ::llvm::cl::values(
clEnumValN(mlir::tosa::TosaLevelEnum::EightK, "8k",
"Ranges are expected to be sufficient for applications with frame sizes up to 8K."),
clEnumValN(mlir::tosa::TosaLevelEnum::None, "none",
"Allows the full range of arguments specified by the operations according "
"to the operation data types.")
)};
private:
friend std::unique_ptr<::mlir::Pass> createTosaValidation() {
return std::make_unique<DerivedT>();
}
friend std::unique_ptr<::mlir::Pass> createTosaValidation(TosaValidationOptions options) {
return std::make_unique<DerivedT>(std::move(options));
}
};
}
std::unique_ptr<::mlir::Pass> createTosaValidation() {
return impl::createTosaValidation();
}
std::unique_ptr<::mlir::Pass> createTosaValidation(TosaValidationOptions options) {
return impl::createTosaValidation(std::move(options));
}
#undef GEN_PASS_DEF_TOSAVALIDATION
#endif
#ifdef GEN_PASS_REGISTRATION
inline void registerTosaInferShapes() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createTosaInferShapesPass();
});
}
inline void registerTosaInferShapesPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createTosaInferShapesPass();
});
}
inline void registerTosaLayerwiseConstantFoldPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createTosaLayerwiseConstantFoldPass();
});
}
inline void registerTosaLayerwiseConstantFoldPassPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createTosaLayerwiseConstantFoldPass();
});
}
inline void registerTosaMakeBroadcastable() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createTosaMakeBroadcastablePass();
});
}
inline void registerTosaMakeBroadcastablePass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createTosaMakeBroadcastablePass();
});
}
inline void registerTosaOptionalDecompositions() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return tosa::createTosaOptionalDecompositions();
});
}
inline void registerTosaOptionalDecompositionsPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return tosa::createTosaOptionalDecompositions();
});
}
inline void registerTosaReduceTransposes() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createTosaReduceTransposes();
});
}
inline void registerTosaReduceTransposesPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createTosaReduceTransposes();
});
}
inline void registerTosaValidation() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createTosaValidation();
});
}
inline void registerTosaValidationPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createTosaValidation();
});
}
inline void registerTosaOptPasses() {
registerTosaInferShapes();
registerTosaLayerwiseConstantFoldPass();
registerTosaMakeBroadcastable();
registerTosaOptionalDecompositions();
registerTosaReduceTransposes();
registerTosaValidation();
}
#undef GEN_PASS_REGISTRATION
#endif
#ifdef GEN_PASS_CLASSES
template <typename DerivedT>
class TosaInferShapesBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = TosaInferShapesBase;
TosaInferShapesBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaInferShapesBase(const TosaInferShapesBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
TosaInferShapesBase& operator=(const TosaInferShapesBase &) = delete;
TosaInferShapesBase(TosaInferShapesBase &&) = delete;
TosaInferShapesBase& operator=(TosaInferShapesBase &&) = delete;
~TosaInferShapesBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-infer-shapes");
}
::llvm::StringRef getArgument() const override { return "tosa-infer-shapes"; }
::llvm::StringRef getDescription() const override { return "Propagate shapes across TOSA operations"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaInferShapes");
}
::llvm::StringRef getName() const override { return "TosaInferShapes"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
registry.insert<func::FuncDialect>();
registry.insert<tensor::TensorDialect>();
registry.insert<tosa::TosaDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaInferShapesBase<DerivedT>)
protected:
};
template <typename DerivedT>
class TosaLayerwiseConstantFoldPassBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = TosaLayerwiseConstantFoldPassBase;
TosaLayerwiseConstantFoldPassBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaLayerwiseConstantFoldPassBase(const TosaLayerwiseConstantFoldPassBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
TosaLayerwiseConstantFoldPassBase& operator=(const TosaLayerwiseConstantFoldPassBase &) = delete;
TosaLayerwiseConstantFoldPassBase(TosaLayerwiseConstantFoldPassBase &&) = delete;
TosaLayerwiseConstantFoldPassBase& operator=(TosaLayerwiseConstantFoldPassBase &&) = delete;
~TosaLayerwiseConstantFoldPassBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-layerwise-constant-fold");
}
::llvm::StringRef getArgument() const override { return "tosa-layerwise-constant-fold"; }
::llvm::StringRef getDescription() const override { return "Fold layerwise operations on constant tensors"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaLayerwiseConstantFoldPass");
}
::llvm::StringRef getName() const override { return "TosaLayerwiseConstantFoldPass"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaLayerwiseConstantFoldPassBase<DerivedT>)
protected:
::mlir::Pass::Option<bool> aggressiveReduceConstant{*this, "aggressive-reduce-constant", ::llvm::cl::desc("Always perform the reduce constant optimizationMay add more tosa.const but would reduce runtime calculations"), ::llvm::cl::init(false)};
};
template <typename DerivedT>
class TosaMakeBroadcastableBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = TosaMakeBroadcastableBase;
TosaMakeBroadcastableBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaMakeBroadcastableBase(const TosaMakeBroadcastableBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
TosaMakeBroadcastableBase& operator=(const TosaMakeBroadcastableBase &) = delete;
TosaMakeBroadcastableBase(TosaMakeBroadcastableBase &&) = delete;
TosaMakeBroadcastableBase& operator=(TosaMakeBroadcastableBase &&) = delete;
~TosaMakeBroadcastableBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-make-broadcastable");
}
::llvm::StringRef getArgument() const override { return "tosa-make-broadcastable"; }
::llvm::StringRef getDescription() const override { return "TOSA rank Reshape to enable Broadcasting"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaMakeBroadcastable");
}
::llvm::StringRef getName() const override { return "TosaMakeBroadcastable"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaMakeBroadcastableBase<DerivedT>)
protected:
};
template <typename DerivedT>
class TosaOptionalDecompositionsBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = TosaOptionalDecompositionsBase;
TosaOptionalDecompositionsBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaOptionalDecompositionsBase(const TosaOptionalDecompositionsBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
TosaOptionalDecompositionsBase& operator=(const TosaOptionalDecompositionsBase &) = delete;
TosaOptionalDecompositionsBase(TosaOptionalDecompositionsBase &&) = delete;
TosaOptionalDecompositionsBase& operator=(TosaOptionalDecompositionsBase &&) = delete;
~TosaOptionalDecompositionsBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-optional-decompositions");
}
::llvm::StringRef getArgument() const override { return "tosa-optional-decompositions"; }
::llvm::StringRef getDescription() const override { return "Applies Tosa operations optional decompositions"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaOptionalDecompositions");
}
::llvm::StringRef getName() const override { return "TosaOptionalDecompositions"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaOptionalDecompositionsBase<DerivedT>)
protected:
};
template <typename DerivedT>
class TosaReduceTransposesBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = TosaReduceTransposesBase;
TosaReduceTransposesBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaReduceTransposesBase(const TosaReduceTransposesBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
TosaReduceTransposesBase& operator=(const TosaReduceTransposesBase &) = delete;
TosaReduceTransposesBase(TosaReduceTransposesBase &&) = delete;
TosaReduceTransposesBase& operator=(TosaReduceTransposesBase &&) = delete;
~TosaReduceTransposesBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-reduce-transposes");
}
::llvm::StringRef getArgument() const override { return "tosa-reduce-transposes"; }
::llvm::StringRef getDescription() const override { return "Reduce transposes through other operators"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaReduceTransposes");
}
::llvm::StringRef getName() const override { return "TosaReduceTransposes"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaReduceTransposesBase<DerivedT>)
protected:
};
template <typename DerivedT>
class TosaValidationBase : public ::mlir::OperationPass<mlir::ModuleOp> {
public:
using Base = TosaValidationBase;
TosaValidationBase() : ::mlir::OperationPass<mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
TosaValidationBase(const TosaValidationBase &other) : ::mlir::OperationPass<mlir::ModuleOp>(other) {}
TosaValidationBase& operator=(const TosaValidationBase &) = delete;
TosaValidationBase(TosaValidationBase &&) = delete;
TosaValidationBase& operator=(TosaValidationBase &&) = delete;
~TosaValidationBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("tosa-validate");
}
::llvm::StringRef getArgument() const override { return "tosa-validate"; }
::llvm::StringRef getDescription() const override { return "Validates TOSA dialect"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("TosaValidation");
}
::llvm::StringRef getName() const override { return "TosaValidation"; }
static bool classof(const ::mlir::Pass *pass) {
return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
}
std::unique_ptr<::mlir::Pass> clonePass() const override {
return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
}
void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaValidationBase<DerivedT>)
protected:
::mlir::Pass::Option<mlir::tosa::TosaProfileEnum> profile{*this, "profile", ::llvm::cl::desc("Validate if operations match for the given profile"), ::llvm::cl::init(mlir::tosa::TosaProfileEnum::Undefined), ::llvm::cl::values(
clEnumValN(mlir::tosa::TosaProfileEnum::BaseInference, "bi",
"Use Base Inference profile."),
clEnumValN(mlir::tosa::TosaProfileEnum::MainInference, "mi",
"Use Main Inference profile."),
clEnumValN(mlir::tosa::TosaProfileEnum::MainTraining, "mt",
"Use Main Training profile."),
clEnumValN(mlir::tosa::TosaProfileEnum::Undefined, "undefined",
"Do not define a profile.")
)};
::mlir::Pass::Option<bool> StrictOperationSpecAlignment{*this, "strict-op-spec-alignment", ::llvm::cl::desc("Verify if the properties of certain operations align the spec requirement"), ::llvm::cl::init(false)};
::mlir::Pass::Option<mlir::tosa::TosaLevelEnum> level{*this, "level", ::llvm::cl::desc("Validate if operator parameters are within specfication for the given level"), ::llvm::cl::init(mlir::tosa::TosaLevelEnum::EightK), ::llvm::cl::values(
clEnumValN(mlir::tosa::TosaLevelEnum::EightK, "8k",
"Ranges are expected to be sufficient for applications with frame sizes up to 8K."),
clEnumValN(mlir::tosa::TosaLevelEnum::None, "none",
"Allows the full range of arguments specified by the operations according "
"to the operation data types.")
)};
};
#undef GEN_PASS_CLASSES
#endif