/* Autogenerated by mlir-tblgen; don't manually edit */

#ifdef GEN_PASS_DECL
// Generate declarations for all passes.
#define GEN_PASS_DECL_PARTITION
#define GEN_PASS_DECL_SHARDINGPROPAGATION
#undef GEN_PASS_DECL
#endif // GEN_PASS_DECL

//===----------------------------------------------------------------------===//
// Partition
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_PARTITION
std::unique_ptr<::mlir::Pass> createPartition();
#undef GEN_PASS_DECL_PARTITION
#endif // GEN_PASS_DECL_PARTITION
#ifdef GEN_PASS_DEF_PARTITION

namespace impl {
  std::unique_ptr<::mlir::Pass> createPartition();
} // namespace impl
namespace impl {

template <typename DerivedT>
class PartitionBase : public ::mlir::InterfacePass<mlir::FunctionOpInterface> {
public:
  using Base = PartitionBase;

  PartitionBase() : ::mlir::InterfacePass<mlir::FunctionOpInterface>(::mlir::TypeID::get<DerivedT>()) {}
  PartitionBase(const PartitionBase &other) : ::mlir::InterfacePass<mlir::FunctionOpInterface>(other) {}
  PartitionBase& operator=(const PartitionBase &) = delete;
  PartitionBase(PartitionBase &&) = delete;
  PartitionBase& operator=(PartitionBase &&) = delete;
  ~PartitionBase() = default;

  /// Returns the command-line argument attached to this pass.
  static constexpr ::llvm::StringLiteral getArgumentName() {
    return ::llvm::StringLiteral("shard-partition");
  }
  ::llvm::StringRef getArgument() const override { return "shard-partition"; }

  ::llvm::StringRef getDescription() const override { return R"PD(Partition a function into SPMD form.)PD"; }

  /// Returns the derived pass name.
  static constexpr ::llvm::StringLiteral getPassName() {
    return ::llvm::StringLiteral("Partition");
  }
  ::llvm::StringRef getName() const override { return "Partition"; }

  /// Support isa/dyn_cast functionality for the derived pass class.
  static bool classof(const ::mlir::Pass *pass) {
    return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
  }

  /// A clone method to create a copy of this pass.
  std::unique_ptr<::mlir::Pass> clonePass() const override {
    return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
  }

  /// Return the dialect that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
    registry.insert<shard::ShardDialect>();
  }

  /// Explicitly declare the TypeID for this class. We declare an explicit private
  /// instantiation because Pass classes should only be visible by the current
  /// library.
  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PartitionBase<DerivedT>)

protected:
private:

  friend std::unique_ptr<::mlir::Pass> createPartition() {
    return std::make_unique<DerivedT>();
  }
};
} // namespace impl

std::unique_ptr<::mlir::Pass> createPartition() {
  return impl::createPartition();
}
#undef GEN_PASS_DEF_PARTITION
#endif // GEN_PASS_DEF_PARTITION

//===----------------------------------------------------------------------===//
// ShardingPropagation
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_SHARDINGPROPAGATION
struct ShardingPropagationOptions {
  mlir::shard::TraversalOrder traversal = mlir::shard::TraversalOrder::BackwardForward;
};
std::unique_ptr<::mlir::Pass> createShardingPropagation();
std::unique_ptr<::mlir::Pass> createShardingPropagation(ShardingPropagationOptions options);
#undef GEN_PASS_DECL_SHARDINGPROPAGATION
#endif // GEN_PASS_DECL_SHARDINGPROPAGATION
#ifdef GEN_PASS_DEF_SHARDINGPROPAGATION

namespace impl {
  std::unique_ptr<::mlir::Pass> createShardingPropagation();
} // namespace impl

namespace impl {
  std::unique_ptr<::mlir::Pass> createShardingPropagation(ShardingPropagationOptions options);
} // namespace impl
namespace impl {

template <typename DerivedT>
class ShardingPropagationBase : public ::mlir::InterfacePass<mlir::FunctionOpInterface> {
public:
  using Base = ShardingPropagationBase;

  ShardingPropagationBase() : ::mlir::InterfacePass<mlir::FunctionOpInterface>(::mlir::TypeID::get<DerivedT>()) {}
  ShardingPropagationBase(const ShardingPropagationBase &other) : ::mlir::InterfacePass<mlir::FunctionOpInterface>(other) {}
  ShardingPropagationBase& operator=(const ShardingPropagationBase &) = delete;
  ShardingPropagationBase(ShardingPropagationBase &&) = delete;
  ShardingPropagationBase& operator=(ShardingPropagationBase &&) = delete;
  ~ShardingPropagationBase() = default;

  /// Returns the command-line argument attached to this pass.
  static constexpr ::llvm::StringLiteral getArgumentName() {
    return ::llvm::StringLiteral("sharding-propagation");
  }
  ::llvm::StringRef getArgument() const override { return "sharding-propagation"; }

  ::llvm::StringRef getDescription() const override { return R"PD(sharding propagation)PD"; }

  /// Returns the derived pass name.
  static constexpr ::llvm::StringLiteral getPassName() {
    return ::llvm::StringLiteral("ShardingPropagation");
  }
  ::llvm::StringRef getName() const override { return "ShardingPropagation"; }

  /// Support isa/dyn_cast functionality for the derived pass class.
  static bool classof(const ::mlir::Pass *pass) {
    return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
  }

  /// A clone method to create a copy of this pass.
  std::unique_ptr<::mlir::Pass> clonePass() const override {
    return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
  }

  /// Return the dialect that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
    registry.insert<shard::ShardDialect>();
  }

  /// Explicitly declare the TypeID for this class. We declare an explicit private
  /// instantiation because Pass classes should only be visible by the current
  /// library.
  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ShardingPropagationBase<DerivedT>)

  ShardingPropagationBase(ShardingPropagationOptions options) : ShardingPropagationBase() {
    traversal = std::move(options.traversal);
  }
protected:
  ::mlir::Pass::Option<mlir::shard::TraversalOrder> traversal{*this, "traversal", ::llvm::cl::desc(R"PO(Traversal order to use for sharding propagation:)PO"), ::llvm::cl::init(mlir::shard::TraversalOrder::BackwardForward), ::llvm::cl::values(
              clEnumValN(mlir::shard::TraversalOrder::Forward, "forward",
              "Forward only traversal."),
              clEnumValN(mlir::shard::TraversalOrder::Backward, "backward",
              "backward only traversal."),
              clEnumValN(mlir::shard::TraversalOrder::ForwardBackward, "forward-backward",
              "forward-backward traversal."),
              clEnumValN(mlir::shard::TraversalOrder::BackwardForward, "backward-forward",
              "backward-forward traversal.")
            )};
private:

  friend std::unique_ptr<::mlir::Pass> createShardingPropagation() {
    return std::make_unique<DerivedT>();
  }

  friend std::unique_ptr<::mlir::Pass> createShardingPropagation(ShardingPropagationOptions options) {
    return std::make_unique<DerivedT>(std::move(options));
  }
};
} // namespace impl

std::unique_ptr<::mlir::Pass> createShardingPropagation() {
  return impl::createShardingPropagation();
}

std::unique_ptr<::mlir::Pass> createShardingPropagation(ShardingPropagationOptions options) {
  return impl::createShardingPropagation(std::move(options));
}
#undef GEN_PASS_DEF_SHARDINGPROPAGATION
#endif // GEN_PASS_DEF_SHARDINGPROPAGATION
#ifdef GEN_PASS_REGISTRATION
// Generate registrations for all passes.
#define GEN_PASS_REGISTRATION_PARTITION
#define GEN_PASS_REGISTRATION_SHARDINGPROPAGATION
#endif // GEN_PASS_REGISTRATION

//===----------------------------------------------------------------------===//
// Partition Registration
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_REGISTRATION_PARTITION

inline void registerPartition() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return createPartition();
  });
}

// Old registration code, kept for temporary backwards compatibility.
inline void registerPartitionPass() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return createPartition();
  });
}

#undef GEN_PASS_REGISTRATION_PARTITION
#endif // GEN_PASS_REGISTRATION_PARTITION

//===----------------------------------------------------------------------===//
// ShardingPropagation Registration
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_REGISTRATION_SHARDINGPROPAGATION

inline void registerShardingPropagation() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return createShardingPropagation();
  });
}

// Old registration code, kept for temporary backwards compatibility.
inline void registerShardingPropagationPass() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return createShardingPropagation();
  });
}

#undef GEN_PASS_REGISTRATION_SHARDINGPROPAGATION
#endif // GEN_PASS_REGISTRATION_SHARDINGPROPAGATION
#ifdef GEN_PASS_REGISTRATION

//===----------------------------------------------------------------------===//
// Shard Registration
//===----------------------------------------------------------------------===//

inline void registerShardPasses() {
  registerPartition();
  registerShardingPropagation();
}
#undef GEN_PASS_REGISTRATION
#endif // GEN_PASS_REGISTRATION
// Deprecated. Please use the new per-pass macros.
#ifdef GEN_PASS_CLASSES

template <typename DerivedT>
class PartitionBase : public ::mlir::InterfacePass<mlir::FunctionOpInterface> {
public:
  using Base = PartitionBase;

  PartitionBase() : ::mlir::InterfacePass<mlir::FunctionOpInterface>(::mlir::TypeID::get<DerivedT>()) {}
  PartitionBase(const PartitionBase &other) : ::mlir::InterfacePass<mlir::FunctionOpInterface>(other) {}
  PartitionBase& operator=(const PartitionBase &) = delete;
  PartitionBase(PartitionBase &&) = delete;
  PartitionBase& operator=(PartitionBase &&) = delete;
  ~PartitionBase() = default;

  /// Returns the command-line argument attached to this pass.
  static constexpr ::llvm::StringLiteral getArgumentName() {
    return ::llvm::StringLiteral("shard-partition");
  }
  ::llvm::StringRef getArgument() const override { return "shard-partition"; }

  ::llvm::StringRef getDescription() const override { return R"PD(Partition a function into SPMD form.)PD"; }

  /// Returns the derived pass name.
  static constexpr ::llvm::StringLiteral getPassName() {
    return ::llvm::StringLiteral("Partition");
  }
  ::llvm::StringRef getName() const override { return "Partition"; }

  /// Support isa/dyn_cast functionality for the derived pass class.
  static bool classof(const ::mlir::Pass *pass) {
    return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
  }

  /// A clone method to create a copy of this pass.
  std::unique_ptr<::mlir::Pass> clonePass() const override {
    return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
  }

  /// Register the dialects that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
    registry.insert<shard::ShardDialect>();
  }

  /// Explicitly declare the TypeID for this class. We declare an explicit private
  /// instantiation because Pass classes should only be visible by the current
  /// library.
  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PartitionBase<DerivedT>)

protected:
};

template <typename DerivedT>
class ShardingPropagationBase : public ::mlir::InterfacePass<mlir::FunctionOpInterface> {
public:
  using Base = ShardingPropagationBase;

  ShardingPropagationBase() : ::mlir::InterfacePass<mlir::FunctionOpInterface>(::mlir::TypeID::get<DerivedT>()) {}
  ShardingPropagationBase(const ShardingPropagationBase &other) : ::mlir::InterfacePass<mlir::FunctionOpInterface>(other) {}
  ShardingPropagationBase& operator=(const ShardingPropagationBase &) = delete;
  ShardingPropagationBase(ShardingPropagationBase &&) = delete;
  ShardingPropagationBase& operator=(ShardingPropagationBase &&) = delete;
  ~ShardingPropagationBase() = default;

  /// Returns the command-line argument attached to this pass.
  static constexpr ::llvm::StringLiteral getArgumentName() {
    return ::llvm::StringLiteral("sharding-propagation");
  }
  ::llvm::StringRef getArgument() const override { return "sharding-propagation"; }

  ::llvm::StringRef getDescription() const override { return R"PD(sharding propagation)PD"; }

  /// Returns the derived pass name.
  static constexpr ::llvm::StringLiteral getPassName() {
    return ::llvm::StringLiteral("ShardingPropagation");
  }
  ::llvm::StringRef getName() const override { return "ShardingPropagation"; }

  /// Support isa/dyn_cast functionality for the derived pass class.
  static bool classof(const ::mlir::Pass *pass) {
    return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
  }

  /// A clone method to create a copy of this pass.
  std::unique_ptr<::mlir::Pass> clonePass() const override {
    return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
  }

  /// Register the dialects that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
    registry.insert<shard::ShardDialect>();
  }

  /// Explicitly declare the TypeID for this class. We declare an explicit private
  /// instantiation because Pass classes should only be visible by the current
  /// library.
  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ShardingPropagationBase<DerivedT>)

protected:
  ::mlir::Pass::Option<mlir::shard::TraversalOrder> traversal{*this, "traversal", ::llvm::cl::desc(R"PO(Traversal order to use for sharding propagation:)PO"), ::llvm::cl::init(mlir::shard::TraversalOrder::BackwardForward), ::llvm::cl::values(
              clEnumValN(mlir::shard::TraversalOrder::Forward, "forward",
              "Forward only traversal."),
              clEnumValN(mlir::shard::TraversalOrder::Backward, "backward",
              "backward only traversal."),
              clEnumValN(mlir::shard::TraversalOrder::ForwardBackward, "forward-backward",
              "forward-backward traversal."),
              clEnumValN(mlir::shard::TraversalOrder::BackwardForward, "backward-forward",
              "backward-forward traversal.")
            )};
};
#undef GEN_PASS_CLASSES
#endif // GEN_PASS_CLASSES
