#ifdef GEN_PASS_DECL
#define GEN_PASS_DECL_LOWERQUANTOPS
#define GEN_PASS_DECL_STRIPFUNCQUANTTYPES
#undef GEN_PASS_DECL
#endif
#ifdef GEN_PASS_DECL_LOWERQUANTOPS
std::unique_ptr<::mlir::Pass> createLowerQuantOps();
#undef GEN_PASS_DECL_LOWERQUANTOPS
#endif
#ifdef GEN_PASS_DEF_LOWERQUANTOPS
namespace impl {
std::unique_ptr<::mlir::Pass> createLowerQuantOps();
}
namespace impl {
template <typename DerivedT>
class LowerQuantOpsBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = LowerQuantOpsBase;
LowerQuantOpsBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
LowerQuantOpsBase(const LowerQuantOpsBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
LowerQuantOpsBase& operator=(const LowerQuantOpsBase &) = delete;
LowerQuantOpsBase(LowerQuantOpsBase &&) = delete;
LowerQuantOpsBase& operator=(LowerQuantOpsBase &&) = delete;
~LowerQuantOpsBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("lower-quant-ops");
}
::llvm::StringRef getArgument() const override { return "lower-quant-ops"; }
::llvm::StringRef getDescription() const override { return "Lower quant.dcast and quant.qcast ops"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("LowerQuantOps");
}
::llvm::StringRef getName() const override { return "LowerQuantOps"; }
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<arith::ArithDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<quant::QuantDialect>();
registry.insert<shape::ShapeDialect>();
registry.insert<tensor::TensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerQuantOpsBase<DerivedT>)
protected:
private:
friend std::unique_ptr<::mlir::Pass> createLowerQuantOps() {
return std::make_unique<DerivedT>();
}
};
}
std::unique_ptr<::mlir::Pass> createLowerQuantOps() {
return impl::createLowerQuantOps();
}
#undef GEN_PASS_DEF_LOWERQUANTOPS
#endif
#ifdef GEN_PASS_DECL_STRIPFUNCQUANTTYPES
std::unique_ptr<::mlir::Pass> createStripFuncQuantTypes();
#undef GEN_PASS_DECL_STRIPFUNCQUANTTYPES
#endif
#ifdef GEN_PASS_DEF_STRIPFUNCQUANTTYPES
namespace impl {
std::unique_ptr<::mlir::Pass> createStripFuncQuantTypes();
}
namespace impl {
template <typename DerivedT>
class StripFuncQuantTypesBase : public ::mlir::OperationPass<> {
public:
using Base = StripFuncQuantTypesBase;
StripFuncQuantTypesBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
StripFuncQuantTypesBase(const StripFuncQuantTypesBase &other) : ::mlir::OperationPass<>(other) {}
StripFuncQuantTypesBase& operator=(const StripFuncQuantTypesBase &) = delete;
StripFuncQuantTypesBase(StripFuncQuantTypesBase &&) = delete;
StripFuncQuantTypesBase& operator=(StripFuncQuantTypesBase &&) = delete;
~StripFuncQuantTypesBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("strip-func-quant-types");
}
::llvm::StringRef getArgument() const override { return "strip-func-quant-types"; }
::llvm::StringRef getDescription() const override { return "Strip quantized types from function headers"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("StripFuncQuantTypes");
}
::llvm::StringRef getName() const override { return "StripFuncQuantTypes"; }
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<quant::QuantDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StripFuncQuantTypesBase<DerivedT>)
protected:
private:
friend std::unique_ptr<::mlir::Pass> createStripFuncQuantTypes() {
return std::make_unique<DerivedT>();
}
};
}
std::unique_ptr<::mlir::Pass> createStripFuncQuantTypes() {
return impl::createStripFuncQuantTypes();
}
#undef GEN_PASS_DEF_STRIPFUNCQUANTTYPES
#endif
#ifdef GEN_PASS_REGISTRATION
inline void registerLowerQuantOps() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createLowerQuantOps();
});
}
inline void registerLowerQuantOpsPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createLowerQuantOps();
});
}
inline void registerStripFuncQuantTypes() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createStripFuncQuantTypes();
});
}
inline void registerStripFuncQuantTypesPass() {
::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
return createStripFuncQuantTypes();
});
}
inline void registerQuantPasses() {
registerLowerQuantOps();
registerStripFuncQuantTypes();
}
#undef GEN_PASS_REGISTRATION
#endif
#ifdef GEN_PASS_CLASSES
template <typename DerivedT>
class LowerQuantOpsBase : public ::mlir::OperationPass<func::FuncOp> {
public:
using Base = LowerQuantOpsBase;
LowerQuantOpsBase() : ::mlir::OperationPass<func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
LowerQuantOpsBase(const LowerQuantOpsBase &other) : ::mlir::OperationPass<func::FuncOp>(other) {}
LowerQuantOpsBase& operator=(const LowerQuantOpsBase &) = delete;
LowerQuantOpsBase(LowerQuantOpsBase &&) = delete;
LowerQuantOpsBase& operator=(LowerQuantOpsBase &&) = delete;
~LowerQuantOpsBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("lower-quant-ops");
}
::llvm::StringRef getArgument() const override { return "lower-quant-ops"; }
::llvm::StringRef getDescription() const override { return "Lower quant.dcast and quant.qcast ops"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("LowerQuantOps");
}
::llvm::StringRef getName() const override { return "LowerQuantOps"; }
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<arith::ArithDialect>();
registry.insert<linalg::LinalgDialect>();
registry.insert<quant::QuantDialect>();
registry.insert<shape::ShapeDialect>();
registry.insert<tensor::TensorDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerQuantOpsBase<DerivedT>)
protected:
};
template <typename DerivedT>
class StripFuncQuantTypesBase : public ::mlir::OperationPass<> {
public:
using Base = StripFuncQuantTypesBase;
StripFuncQuantTypesBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
StripFuncQuantTypesBase(const StripFuncQuantTypesBase &other) : ::mlir::OperationPass<>(other) {}
StripFuncQuantTypesBase& operator=(const StripFuncQuantTypesBase &) = delete;
StripFuncQuantTypesBase(StripFuncQuantTypesBase &&) = delete;
StripFuncQuantTypesBase& operator=(StripFuncQuantTypesBase &&) = delete;
~StripFuncQuantTypesBase() = default;
static constexpr ::llvm::StringLiteral getArgumentName() {
return ::llvm::StringLiteral("strip-func-quant-types");
}
::llvm::StringRef getArgument() const override { return "strip-func-quant-types"; }
::llvm::StringRef getDescription() const override { return "Strip quantized types from function headers"; }
static constexpr ::llvm::StringLiteral getPassName() {
return ::llvm::StringLiteral("StripFuncQuantTypes");
}
::llvm::StringRef getName() const override { return "StripFuncQuantTypes"; }
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<quant::QuantDialect>();
}
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StripFuncQuantTypesBase<DerivedT>)
protected:
};
#undef GEN_PASS_CLASSES
#endif