# Targets

## target

struct migraphx::internal::target

  An interface for a compilation target.

  Public Functions

  std::string name() const

    A unique name used to identify the target.

  std::vector<pass> get_passes(context &ctx, const compile_options &options) const

    The transformation pass to be run during compilation.

    Parameters

      - ctx – This is the target-dependent context that is created by `get_context`

      - options – Compiling options passed in by the user

    Returns

      The passes to be ran

  context get_context() const

    Construct a context for the target.

    Returns

      The context to be used during compilation and execution.

  argument copy_to(const argument &arg) const

    copy an argument to the current target.

    Parameters

      arg – Input argument to be copied to the target

    Returns

      Argument in the target.

  argument copy_from(const argument &arg) const

    copy an argument from the current target.

    Parameters

      arg – Input argument to be copied from the target

    Returns

      Argument in the host.

  argument allocate(const shape &s) const

    Allocate an argument based on the input shape.

    Parameters

      s – Shape of the argument to be allocated in the target

    Returns

      Allocated argument in the target.

## gpu::target

struct migraphx::internal::gpu::target

  Public Functions

  std::string name() const
  std::vector<pass> get_passes(migraphx::context &gctx, const compile_options &options) const
  migraphx::context get_context() const
  argument copy_to(const argument &arg) const
  argument copy_from(const argument &arg) const
  argument allocate(const shape &s) const

## cpu::target

struct migraphx::internal::cpu::target

  Public Functions

  std::string name() const
  std::vector<pass> get_passes(migraphx::context &gctx, const compile_options&) const
  inline migraphx::context get_context() const
  inline argument copy_to(const argument &arg) const
  inline argument copy_from(const argument &arg) const
  argument allocate(const shape &s) const