Install ONNX Runtime for ROCm#
ONNX Runtime accelerates machine learning inference using the AMD MIGraphX execution provider on ROCm-supported GPUs.
Prerequisites#
ONNX Runtime 1.29.0 is currently supported on:
gfx950AMD Instinct MI355X, MI350X, and MI350Pgfx942AMD Instinct MI325X, MI300X, and MI300Agfx90aAMD Instinct MI250X, MI250, and MI210gfx1200,gfx1201,gfx1100,gfx1101, andgfx1102Radeon GPUs.gfx1153,gfx1152,gfx1151, andgfx1150Ryzen AI processors.
See the ROCm compatibility matrix for more information.
Ensure your system has Python 3.12 installed and accessible.
ONNX Runtime is currently supported on:
gfx950AMD Instinct MI355X and MI350Xgfx942AMD Instinct MI325X and MI300Xgfx1200,gfx1201,gfx1100,gfx1101, andgfx1102Radeon GPUs.
See the ROCm compatibility matrix for more information.
Ensure your system has Python 3.14 or 3.12 installed and accessible.
ONNX Runtime is currently supported on gfx950 AMD Instinct MI355X and MI350X
data center GPUs and gfx942 MI325X and MI300X GPUs. See the ROCm
compatibility matrix (ROCm 7.14.1)
for more information.
Ensure your system has Python 3.12 installed and accessible.
ONNX Runtime is currently supported on gfx950 AMD Instinct MI355X and MI350X
data center GPUs and gfx942 MI325X and MI300X GPUs. See the ROCm
compatibility matrix (ROCm 7.14.0)
for more information.
Ensure your system has Python 3.12 installed and accessible.
Install ONNX Runtime on Linux#
ONNX Runtime requires ROCm to be installed on your system first.
Install ROCm#
For instructions, see Install AMD ROCm. Use the selector panel on that page to view instructions appropriate for your system environment.
For instructions, see Install AMD ROCm. Use the selector panel on that page to view instructions appropriate for your system environment.
For instructions, see Install AMD ROCm 7.14.1. Use the selector panel on that page to view instructions appropriate for your system environment.
For instructions, see Install AMD ROCm 7.14.0. Use the selector panel on that page to view instructions appropriate for your system environment.
Install ONNX Runtime using pip#
Create and activate a virtual environment or activate an existing ROCm 10.1.0 environment.
python3.12 -m venv .venv source .venv/bin/activate
Install MIGraphX using pip. See Install MIGraphX for installation instructions.
Important
MIGraphX must be installed using pip. The
onnxruntime-ep-migraphxwheel declares a dependency onmigraphx-libs, which is only available from the MIGraphX pip repository. Installing MIGraphX using the package manager or tarball method doesn’t satisfy this dependency, and installing the execution provider in the next step fails to resolve.Install ONNX Runtime and the
onnxruntime-ep-migraphxexecution provider plugin.python -m pip install --extra-index-url https://stable.repo.amd.com/rocm/onnxruntime/whl-next/ "onnxruntime-ep-migraphx==1.0.0+rocm10.1.0"
Confirm ONNX Runtime is correctly installed and the MIGraphX execution provider is available.
The EP plugin must be explicitly registered using
onnxruntime_ep_migraphxbefore querying available providers.python -c "import onnxruntime as ort, onnxruntime_ep_migraphx as m; [ort.register_execution_provider_library(n,p) for n,p in zip(m.get_ep_names(), m.get_library_paths())]; print(ort.get_available_providers())"
You should see
MIGraphXExecutionProviderin the output:['CPUExecutionProvider', 'MIGraphXExecutionProvider']
Create and activate a virtual environment or activate an existing ROCm 10.0.0 environment.
python3.14 -m venv .venv source .venv/bin/activate
python3.12 -m venv .venv source .venv/bin/activate
Install MIGraphX using pip. See Install MIGraphX for installation instructions.
Install ONNX Runtime and the
onnxruntime-ep-migraphxexecution provider plugin.python -m pip install --extra-index-url https://stable.repo.amd.com/rocm/onnxruntime/whl-next/ "onnxruntime-ep-migraphx==1.0.0+rocm10.0.0"
As a workaround due to packaging issues, create the required soname symlink and set library search paths. For example, if you installed MIGraphX using pip:
SP=$(python -c "import site; print(site.getsitepackages()[0])") ln -sf $SP/onnxruntime/capi/libonnxruntime.so.1.29.0 $SP/onnxruntime/capi/libonnxruntime.so.1 export LD_LIBRARY_PATH=$SP/onnxruntime/capi:$SP/migraphx_libs:$LD_LIBRARY_PATH
Tip
The symlink only needs to be created once. For persistence,
LD_LIBRARY_PATHshould be set for each shell session or added to your shell startup script (e.g.~/.bashrc).Confirm ONNX Runtime is correctly installed and the MIGraphX execution provider is available.
The EP plugin must be explicitly registered using
onnxruntime_ep_migraphxbefore querying available providers.migraphxmust be imported first to initialize the ROCm runtime.python -c "import migraphx, onnxruntime as ort, onnxruntime_ep_migraphx as m; [ort.register_execution_provider_library(n,p) for n,p in zip(m.get_ep_names(), m.get_library_paths())]; print(ort.get_available_providers())"
You should see
MIGraphXExecutionProviderin the output:['CPUExecutionProvider', 'MIGraphXExecutionProvider']
Create and activate a virtual environment or activate an existing ROCm 7.14.1 environment. To create a new Python 3.12 virtual environment:
python3.12 -m venv .venv source .venv/bin/activate
Download and install the wheels.
python -m pip install https://rocm.frameworks.amd.com/whl-multi-arch/onnxruntime-migraphx/onnxruntime_migraphx-1.23.2%2Brocm7.14.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Create and activate a virtual environment or activate an existing ROCm 7.14.0 environment. To create a new Python 3.12 virtual environment:
python3.12 -m venv .venv source .venv/bin/activate
Download and install the wheels.
python -m pip install https://rocm.frameworks.amd.com/whl-multi-arch/onnxruntime-migraphx/onnxruntime_migraphx-1.23.2%2Brocm7.14.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
See also
See MIGraphX Execution Provider (ONNX Runtime docs) for more information.