Tune model performance#
2026-10-12
2 min read time
MIGraphX exposes environment variables that change compilation behavior and kernel selection at runtime. Set these variables before you compile or run a model to experiment with performance options without changing application code.
For the complete list of environment variables, including developer-only tracing and debugging options, see MIGraphX environment variables.
Set environment variables#
Export a variable in your shell before running migraphx-driver or your
application. Forcing eligible operations through rocMLIR is a common starting
point for performance experiments:
export MIGRAPHX_MLIR_USE_SPECIFIC_OPS="attention,convolution,dot,fused"
migraphx-driver perf model.onnx --onnx --gpu
Replace model.onnx with your model path.
Variables that take comma-separated lists must not include spaces between entries. Quote the value when your shell requires it.
Common tuning variables#
The following variables are the most commonly used for model performance tuning. Each entry describes accepted values and default behavior documented in the MIGraphX source tree.
Environment variable |
Values |
|---|---|
|
JSON object of backend options (for example, |
|
|
|
|
|
|
|
|
|
Comma-separated list of operations (for example, |
|
|
|
|
|
|
|
|
|
|
|
|
Tuning examples#
Force operations through rocMLIR#
Set a comma-separated list of operations that should lower through MLIR:
export MIGRAPHX_MLIR_USE_SPECIFIC_OPS="attention,convolution,dot,fused"
migraphx-driver perf model.onnx --onnx --gpu
Replace model.onnx with your model path.
Select a GEMM provider#
Set the general matrix multiply (GEMM) provider before compilation:
export MIGRAPHX_SET_GEMM_PROVIDER=hipblaslt
migraphx-driver perf model.onnx --onnx --gpu
Replace model.onnx with your model path.
Enable exhaustive GEMM tuning#
Search for the fastest GEMM kernel configuration:
export MIGRAPHX_ENABLE_GEMM_TUNING=1
migraphx-driver perf model.onnx --onnx --gpu --exhaustive-tune
You can also pass --exhaustive-tune on the command line. The environment
variable enables exhaustive GEMM tuning even when that flag is omitted.
Measure the effect#
Compare performance before and after changing a variable:
migraphx-driver perf model.onnx --onnx --gpu -n 50
Replace model.onnx with your model path and adjust -n for the number
of timing iterations.
See also#
MIGraphX driver for
perfandcompilecommands.MIGraphX environment variables for the full variable reference, including pass controls and compilation tracing.