MIGraphX driver#
2025-11-11
4 min read time
The MIGraphX driver is a command-line tool that allows you to utilize many of the MIGraphX core functions without having to write a program. It can read, compile, run, and test the performance of a model with randomized data.
It is installed by default when you install MIGraphX. You can find it in /opt/rocm/bin/migraphx-driver or in AMDMIGraphX/build/bin/migraphx-driver after building the source code.
Commands#
The table below summarizes the MIGraphX driver commands.
Command |
Description |
op |
Prints all operators of MIGraphX when followed by the option |
params |
Prints the input and output parameter shapes |
run |
Compiles, allocates parameters, evaluates, and prints input graph |
read |
Loads and prints input graph |
compile |
Compiles and prints input graph |
verify |
Runs reference and GPU implementations and checks outputs for consistency |
perf |
Compiles and runs input graph followed by printing the performance report |
Options#
The table below summarizes the various options to be used with the MIGraphX driver commands. To learn which options can be used with which commands, see the MIGraphX driver options.
Option |
Description |
–help | -h |
Prints help section. |
–test |
Test MIGraphX with single layer GEMM model. |
–onnx |
Loads the file as an ONNX graph. |
–tf |
Loads the file as a tensorflow graph. |
–migraphx |
Loads the file as a migraphx graph. |
–migraphx-json |
Loads the file as a migraphx JSON graph. |
–batch |
Sets batch size for a static model. Sets the batch size at runtime for a dynamic batch model. |
–nhwc |
Treats tensorflow format as nhwc. |
–nchw |
Treats tensorflow format as nchw. |
–skip-unknown-operators |
Skips unknown operators when parsing and continues to parse. |
–trim | -t |
Trims instructions from the end. |
–optimize | -O |
Optimizes read |
–graphviz | -g |
Prints a graphviz representation |
–brief |
Makes the output brief |
–cpp |
Prints the program in .cpp format |
–json |
Prints the program in .json format |
–text |
Prints the program in .txt format |
–binary |
Prints the program in binary format |
–netron |
Prints the program in Netron viewable JSON format |
–output | -o |
Writes output in a file |
–fill0 |
Fills parameter with 0s |
–fill1 |
Fills parameter with 1s |
–input-dim |
Sets static dimensions of a parameter |
–dyn-input-dim |
Sets dynamic dimensions of a parameter |
–default-dyn-dim |
Sets default dynamic dimension |
–gpu |
Compiles on the GPU |
–cpu |
Compiles on the CPU |
–ref |
Compiles on the reference implementation |
–enable-offload-copy |
Enables implicit offload copying |
–disable-fast-math |
Disables fast math optimization |
–exhaustive-tune |
Enables exhaustive search to find the fastest kernel |
–fp16 |
Quantizes for fp16 |
–bf16 |
Quantizes for bf16 |
–int8 |
Quantizes for int8 |
–fp8 |
Quantize for |
–rms-tol |
Sets tolerance for the RMS error (Default: 0.001) |
–atol |
Sets tolerance for elementwise absolute difference (Default: 0.001) |
–rtol |
Sets tolerance for elementwise relative difference (Default: 0.001) |
–per-instruction | -i |
Verifies each instruction |
–reduce | -r |
Reduces program and verifies |
–iterations | -n |
Sets the number of iterations to run for perf report |
–list | -l |
Lists all the MIGraphX operators |
Usage#
This section demonstrates the usage of MIGraphX driver tool with some commonly used options. Note that these examples use a simple MNIST ConvNet as the input graph for demonstration purposes as models of higher complexity generate considerably larger outputs in most cases.
Option: op#
$ /opt/rocm/bin/migraphx-driver op –list
Option: params#
$ /opt/rocm/bin/migraphx-driver params simple_graph.pb
Option: run (ONNX file input)#
$ /opt/rocm/bin/migraphx-driver run –onnx simple_graph.onnx
Option: read#
$ /opt/rocm/bin/migraphx-driver read simple_graph.pb
Option: compile (on GPU, quantized for fp16)#
$ /opt/rocm/bin/migraphx-driver compile –gpu –fp16 simple_graph.pb
Option: verify#
$ /opt/rocm/bin/migraphx-driver verify simple_graph.pb
Option: perf#
$ /opt/rocm/bin/migraphx-driver perf simple_graph.pb