# Passes

## pass

struct migraphx::internal::pass

  An interface for applying a transformation to the instructions in a `program`

  Public Functions

  std::string name() const

    A unique name used to identify the pass.

  void apply(module_pass_manager &mpm) const

    Run the pass on the module.

  void apply(module &m) const
  void apply(program &p) const

    Run the pass on the program.

## dead_code_elimination

struct migraphx::internal::dead_code_elimination

  Remove instructions where the output is not used.

  Public Functions

  inline std::string name() const
  void apply(module &m) const
  void apply(program &p) const

## eliminate_common_subexpression

struct migraphx::internal::eliminate_common_subexpression

  Remove identical instructions.

  Public Functions

  inline std::string name() const
  void apply(module &p) const

## eliminate_concat

struct migraphx::internal::eliminate_concat

  Remove concat operators by having each operator can write to different chunk of memory.

  Public Functions

  inline std::string name() const
  void apply(module &p) const

  Public Members

  concat_optimization concat_opt

## eliminate_contiguous

struct migraphx::internal::eliminate_contiguous

  Remove contiguous instructions by checking if the operator can use non-standard shapes.

  Public Functions

  inline std::string name() const
  void apply(module &p) const

  Public Members

  std::string op_name

## eliminate_identity

struct migraphx::internal::eliminate_identity

  Remove identity instructions. Currently when used as the last pass, it will preserve the semantics of previous program state, therefore dead code elimination should not be used afterwards.

  Public Functions

  inline std::string name() const
  void apply(module &p) const

## eliminate_pad

struct migraphx::internal::eliminate_pad

  Remove pads if they can be written as an attribute to another op (im2col, convolution, pooling)

  Public Functions

  inline std::string name() const
  void apply(module &m) const

## propagate_constant

struct migraphx::internal::propagate_constant

  Replace instructions which take all literals with a literal of the computation.

  Public Functions

  inline std::string name() const
  void apply(module &p) const

## rewrite_batchnorm

struct migraphx::internal::rewrite_batchnorm

  Rewrite batchnorm to a multiply and add.

  Public Functions

  inline std::string name() const
  void apply(module &p) const

## rewrite_rnn

struct migraphx::internal::rewrite_rnn

  Rewrite rnn to gemm and add.

  Public Functions

  inline std::string name() const
  void apply(module &prog) const

## schedule

struct migraphx::internal::schedule

  Schedule instructions for concurrent execution

  Public Functions

  inline std::string name() const
  void apply(module &p) const

  Public Members

  schedule_model model = {}
  bool enable = true

## simplify_algebra

struct migraphx::internal::simplify_algebra

  Simplify many algebraic instructions to more efficient versions.

  Public Functions

  inline std::string name() const
  void apply(module &p) const

## simplify_reshapes

struct migraphx::internal::simplify_reshapes

  Eliminate redundant reshapes.

  Public Functions

  inline std::string name() const
  void apply(module &p) const