Targets#

2024-12-04

4 min read time

Applies to Linux

target#

struct 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.

supported_segments target_is_supported(T&, const_module_ref mod, support_metric metric) const#

Get the ranges of instructions that are supported on a target.

Parameters:
  • module – Module to check for supported instructions

  • metric – Used to define how the quality of the support should be measured

Returns:

the supported segments of the graph

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 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 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#