MIGraphX Field Guide

Concepts

The main MIGraphX concepts: programs, targets, shapes, arguments, compilation, and saved artifacts.

MIGraphX has a small set of concepts. Understanding these makes the C++ and Python APIs much easier to use.

Program

A program is the graph representation MIGraphX executes. You usually create it by parsing a model:

ONNX file -> migraphx::program

After parsing, the program can be inspected, compiled, saved, loaded, and executed.

Target

A target selects where the program will run.

gpu  AMD GPU through ROCm
ref  reference target, useful for debugging
cpu  CPU target when available in your build

For performance work on AMD hardware, the important target is gpu.

Shape

A shape describes tensor type and dimensions.

Example image input:

float_type, {1, 3, 640, 640}

For ONNX models with dynamic dimensions, provide input dimensions during parsing or compilation so MIGraphX can produce an optimized program for the shape range you expect.

Argument

An argument is tensor storage for a parameter or output. In quick examples, generated arguments are fine:

arg = migraphx.generate_argument(shape)

In real services, you usually fill argument buffers from your own preprocessing output.

Compile

Compilation transforms the parsed graph into an optimized executable program for a target:

parse_onnx -> compile(gpu)

Compilation can take meaningfully longer than a single inference. Keep it out of the per-request path.

Save And Load

Saved programs are the closest MIGraphX equivalent to a TensorRT engine file:

compile -> save .mxr
load .mxr -> run

Use this pattern for production services and command-line build flows.

Where MIGraphX Fits

Application
  -> preprocessing
  -> input tensor
  -> MIGraphX compiled program
  -> output tensor
  -> postprocessing

MIGraphX does not replace video decode, image preprocessing, networking, stream muxing, or business logic. It replaces the model inference backend.

On this page