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

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

//===----------------------------------------------------------------------===//
// ShardingPropagation
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_SHARDINGPROPAGATION
struct ShardingPropagationOptions {
  mlir::mesh::TraversalOrder traversal = mlir::mesh::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 "sharding propagation"; }

  /// 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<mesh::MeshDialect>();
  }

  /// 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::mesh::TraversalOrder> traversal{*this, "traversal", ::llvm::cl::desc("Traversal order to use for sharding propagation:"), ::llvm::cl::init(mlir::mesh::TraversalOrder::BackwardForward), ::llvm::cl::values(
              clEnumValN(mlir::mesh::TraversalOrder::Forward, "forward",
              "Forward only traversal."),
              clEnumValN(mlir::mesh::TraversalOrder::Backward, "backward",
              "backward only traversal."),
              clEnumValN(mlir::mesh::TraversalOrder::ForwardBackward, "forward-backward",
              "forward-backward traversal."),
              clEnumValN(mlir::mesh::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

//===----------------------------------------------------------------------===//
// Spmdization
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_SPMDIZATION
std::unique_ptr<::mlir::Pass> createSpmdization();
#undef GEN_PASS_DECL_SPMDIZATION
#endif // GEN_PASS_DECL_SPMDIZATION
#ifdef GEN_PASS_DEF_SPMDIZATION

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

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

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

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

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

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

  /// 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<mesh::MeshDialect>();
  }

  /// 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(SpmdizationBase<DerivedT>)

protected:
private:

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

std::unique_ptr<::mlir::Pass> createSpmdization() {
  return impl::createSpmdization();
}
#undef GEN_PASS_DEF_SPMDIZATION
#endif // GEN_PASS_DEF_SPMDIZATION
#ifdef GEN_PASS_REGISTRATION

//===----------------------------------------------------------------------===//
// ShardingPropagation Registration
//===----------------------------------------------------------------------===//

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();
  });
}

//===----------------------------------------------------------------------===//
// Spmdization Registration
//===----------------------------------------------------------------------===//

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

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

//===----------------------------------------------------------------------===//
// Mesh Registration
//===----------------------------------------------------------------------===//

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

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 "sharding propagation"; }

  /// 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<mesh::MeshDialect>();
  }

  /// 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::mesh::TraversalOrder> traversal{*this, "traversal", ::llvm::cl::desc("Traversal order to use for sharding propagation:"), ::llvm::cl::init(mlir::mesh::TraversalOrder::BackwardForward), ::llvm::cl::values(
              clEnumValN(mlir::mesh::TraversalOrder::Forward, "forward",
              "Forward only traversal."),
              clEnumValN(mlir::mesh::TraversalOrder::Backward, "backward",
              "backward only traversal."),
              clEnumValN(mlir::mesh::TraversalOrder::ForwardBackward, "forward-backward",
              "forward-backward traversal."),
              clEnumValN(mlir::mesh::TraversalOrder::BackwardForward, "backward-forward",
              "backward-forward traversal.")
            )};
};

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

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

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

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

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

  /// 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<mesh::MeshDialect>();
  }

  /// 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(SpmdizationBase<DerivedT>)

protected:
};
#undef GEN_PASS_CLASSES
#endif // GEN_PASS_CLASSES
