Program

Contents

Program#

Applies to Linux

2024-05-07

11 min read time

instruction#

struct instruction#

Public Functions

inline instruction()#
instruction(operation o, shape r, std::vector<instruction_ref> args)#
instruction(operation o, shape r, std::vector<instruction_ref> args, std::vector<module_ref> modules)#
instruction(literal l)#
void replace(operation o)#
void recompute_shape()#
void clear_arguments()#
bool valid(instruction_ref start, bool check_order = false) const#
bool valid() const#
shape get_shape() const#
const literal &get_literal() const#
const operation &get_operator() const#
std::string name() const#
const std::vector<instruction_ref> &inputs() const#
const std::vector<module_ref> &module_inputs() const#
const std::vector<instruction_ref> &outputs() const#

Where this instruction is used as an input to another instruction.

void add_output(instruction_ref ins)#
template<class T>
inline void remove_output(const T &ins)#
bool can_eval() const#
bool is_undefined() const#
argument eval(bool check_eval = true) const#
void finalize(context &ctx)#
void set_normalized(bool value = true)#
bool is_normalized() const#
bool need_normalization() const#
operation normalized_operator() const#
std::size_t get_target_id() const#
void set_target_id(std::size_t tid)#
void debug_print() const#

Public Static Functions

static void replace_refs(instruction_ref ins, const std::unordered_map<instruction_ref, instruction_ref> &map_insts, const std::unordered_map<module_ref, module_ref> &map_mods)#
static void backreference(instruction_ref ref)#
static void replace_argument(instruction_ref ins, instruction_ref old, instruction_ref new_ins)#
static void replace_mod_argument(instruction_ref ins, module_ref old, module_ref new_mod)#
static void replace(instruction_ref ins, operation o, const shape &r, std::vector<instruction_ref> args)#
static void replace(instruction_ref ins, operation o, const shape &r, std::vector<instruction_ref> args, std::vector<module_ref> module_args)#
static instruction_ref get_output_alias(instruction_ref ins, bool shallow = false)#
static void print(std::ostream &os, instruction_ref ins, const std::unordered_map<instruction_ref, std::string> &names)#

Friends

friend bool operator==(const instruction &i, instruction_ref ref)#
friend bool operator==(const instruction &x, const instruction &y)#
friend bool operator!=(const instruction &x, const instruction &y)#
friend bool operator==(instruction_ref ref, const instruction &i)#
friend bool operator!=(const instruction &i, instruction_ref ref)#
friend bool operator!=(instruction_ref ref, const instruction &i)#

instruction_ref#

type migraphx::internal::instruction_ref#

References an instruction in the program.

program#

struct program#

Stores the instruction stream.

Public Functions

program()#
program(program&&) noexcept#
program(const program&)#
program &operator=(program)#
~program() noexcept#
std::vector<std::string> get_parameter_names() const#
shape get_parameter_shape(std::string name) const#
instruction_ref get_parameter(std::string name) const#
std::unordered_map<std::string, shape> get_parameter_shapes() const#
std::vector<argument> eval(parameter_map params, execution_environment exec_env = execution_environment{}) const#
std::vector<argument> eval_with_context(std::vector<context> &ctx, parameter_map params) const#
void finish() const#
std::size_t size() const#
std::vector<shape> get_output_shapes() const#
context &get_context() const#
instruction_ref validate() const#
target_assignments get_target_assignments(const std::vector<target> &targets, assignment_options options = assignment_options{})#
void compile(const target &t, compile_options options = compile_options{})#
void compile(const std::vector<target> &targets, std::vector<compile_options> compile_opts = {})#
bool is_compiled() const#
void finalize()#
void perf_report(std::ostream &os, std::size_t n, parameter_map params, std::size_t batch = 1, bool detailed = false) const#
void mark(const parameter_map &params, marker &&m)#
value to_value() const#
void from_value(const value &v)#
void debug_print() const#
void debug_print(instruction_ref ins) const#
void print(std::unordered_map<instruction_ref, std::string> &names, const std::function<void(instruction_ref, std::unordered_map<instruction_ref, std::string>)> &print_func) const#
void print(const std::function<void(instruction_ref ins, std::unordered_map<instruction_ref, std::string>)> &print_func) const#
void print_graph(std::ostream &os, bool brief = false) const#
void print_py(std::ostream &os) const#
void print_cpp(std::ostream &os) const#
void dry_run(parameter_map params) const#
void annotate(std::ostream &os, const std::function<void(instruction_ref)> &a) const#
program &sort()#
module *create_module(const std::string &name)#
module *create_module(const std::string &name, module m)#
module *get_module(const std::string &name)#
const module *get_module(const std::string &name) const#
module *get_main_module()#
const module *get_main_module() const#
std::vector<const module*> get_modules() const#
std::vector<module*> get_modules()#
std::unordered_multimap<module_ref, module_ref> get_module_tree()#
void remove_module(const std::string &name)#
void rename_module(const std::string &old_name, const std::string &new_name)#
void remove_unused_modules()#

Friends

friend std::ostream &operator<<(std::ostream &os, const program &p)#
friend bool operator==(const program &x, const program &y)#
inline friend bool operator!=(const program &x, const program &y)#

parse_onnx#

program migraphx::internal::parse_onnx(const std::string &name, const onnx_options& = onnx_options{})#

Create a program from an onnx file.

parse_tf#

program migraphx::internal::parse_tf(const std::string &name, const tf_options &options = tf_options{})#

Create a program from a tf pb file (default is nhwc format)

onnx_options#

struct onnx_options#

struct to pass in onnx options to parser

tf_options#

struct tf_options#

struct to pass in tf options to parser