Skip to content

Invalid MIGraphX EP option: migraphx_load_compiled_path #25379

Closed

Description

Describe the issue

MIGraphXExecutionProvider: "migraphx_load_compiled_path" and "migraphx_save_compiled_path" are rejected as invalid options

According to the documentation here:
https://onnxruntime.ai/docs/execution-providers/MIGraphX-ExecutionProvider.html#session-variables

The MIGraphXExecutionProvider is supposed to support options like migraphx_load_compiled_path and migraphx_save_compiled_path to load or store a precompiled .mxr model.

However, these options trigger a runtime error when used in Python:

*************** EP Error ***************
EP Error /onnxruntime/onnxruntime/python/onnxruntime_pybind_state.cc:966 std::unique_ptronnxruntime::IExecutionProvider onnxruntime::python::CreateExecutionProviderInstance(const onnxruntime::SessionOptions&, const std::string&, const onnxruntime::ProviderOptionsMap&) Invalid MIGraphX EP option: migraphx_load_compiled_path
when using [('MIGraphXExecutionProvider', {'device_id': '0', 'migraphx_fp16_enable': True, 'migraphx_load_compiled_model': True, 'migraphx_load_compiled_path': '2dfan4.mxr'})]
Falling back to ['CPUExecutionProvider'] and retrying.


This seems to contradict the current documentation, suggesting that these options are either not implemented or not exposed in the Python bindings.


important note, when not using either migraphx_load_compiled_path" and or "migraphx_save_compiled_path" the .mxr files are properly created and used, just on a non disclosed location rendering this process not useful as these files are not saved for future usage

System Info

  • OS: Ubuntu 24.04.2 LTS
    -GPU driver version: 6.12.12
  • GPU: AMD RX 6800 XT
  • ROCm: 6.4.1
  • Python: 3.12.11 (in Conda env) conda list.txt
  • ONNX Runtime: onnxruntime-rocm==1.21.0 from https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4.1/

Despite successful inference (falling back to CPUExecutionProvider), MIGraphX EP fails to initialize due to the unrecognized option.

Is this a documentation mismatch, or are these options only supported in a specific build or version of ONNX Runtime?

If so, what would be the required version or build flags to enable support for these migraphx_*_compiled_path options in Python?

Thanks for your help!

To reproduce

Code to Reproduce

python
import numpy as np
import onnxruntime as ort

input_name = 'input'
input_shape = (1, 3, 256, 256)

dummy_input = np.random.rand(*input_shape).astype(np.float32)

session = ort.InferenceSession('2dfan4.onnx', providers=[
    ('MIGraphXExecutionProvider', {
        'device_id': '0',
        'migraphx_fp16_enable': True,
        'migraphx_load_compiled_model': True,
        'migraphx_load_compiled_path': '2dfan4.mxr',
    })
])
outputs = session.run(None, {input_name: dummy_input})
print("Inference OK, output shape:", [o.shape for o in outputs])

link to model files: https://drive.google.com/file/d/1D3sHQyMCKksBmNZfA0zCufOPxpx493Pn/view

Urgency

No response

Platform

Linux

OS Version

Ubuntu 24.04.2 LTS

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.21.0

ONNX Runtime API

Python

Architecture

X64

Execution Provider

MIGraphX

Execution Provider Library Version

ROCm 6.4.1

Activity

  1. added
    ep:MIGraphXissues related to AMD MI GraphX execution provider
    ep:ROCmquestions/issues related to ROCm execution provider
    on Jul 13, 2025
  2. ivancebellansanchez commented on Aug 13, 2025

    @ivancebellansanchez
    Author

    How great, just saw an email notification about this and turns out it's just an automated response, could anyone please check what happens with this issue?

  3. TedThemistokleous commented on Sep 2, 2025

    @TedThemistokleous
    Contributor

    Iván Cebellán Sánchez (@ivancebellansanchez) please use migraphx_model_cache_path instead of save/load/ Interface was changed and we're working on updating documentation for a later ROCM release for this to capture this change.

  4. ivancebellansanchez commented on Sep 2, 2025

    @ivancebellansanchez
    Author

    Ted Themistokleous (@TedThemistokleous) thanks for your answer, I just tried it but doesn't seem to be working either I'm still getting the same kind of "Invalid MIGraphX EP option" error.

    python test.py
    *************** EP Error ***************
    EP Error /onnxruntime/onnxruntime/python/onnxruntime_pybind_state.cc:938 std::unique_ptr<onnxruntime::IExecutionProvider> onnxruntime::python::CreateExecutionProviderInstance(const onnxruntime::SessionOptions&, const std::string&, const onnxruntime::ProviderOptionsMap&) Invalid MIGraphX EP option: migraphx_model_cache_path
     when using [('MIGraphXExecutionProvider', {'device_id': '0', 'migraphx_fp16_enable': True, 'migraphx_load_compiled_model': True, 'migraphx_model_cache_path': '2dfan4.mxr'})]
    Falling back to ['CPUExecutionProvider'] and retrying.
    ****************************************
    Inference OK, output shape: [(1, 68, 3), (1, 68, 64, 64)]
    
  5. TedThemistokleous commented on Sep 2, 2025

    @TedThemistokleous
    Contributor

    remove the use of migraphx_load_compiled_model, you dont need that flag anymore either.

    If you set the model cache it will both save and load the model

    If migraphx_modeL_cache_path is set it will look for the .mxr from pwd if you haven't specified an absolute path

  6. ivancebellansanchez commented on Sep 2, 2025

    @ivancebellansanchez
    Author

    did that too, just copied the wrong output, but the same error remains even when I set migraphx_model_cache_path to ".caches" instead

    *************** EP Error ***************
    EP Error /onnxruntime/onnxruntime/python/onnxruntime_pybind_state.cc:938 std::unique_ptr<onnxruntime::IExecutionProvider> onnxruntime::python::CreateExecutionProviderInstance(const onnxruntime::SessionOptions&, const std::string&, const onnxruntime::ProviderOptionsMap&) Invalid MIGraphX EP option: migraphx_model_cache_path
     when using [('MIGraphXExecutionProvider', {'device_id': '0', 'migraphx_model_cache_path': '.caches'})]
    Falling back to ['CPUExecutionProvider'] and retrying.
    ****************************************
    Inference OK, output shape: [(1, 68, 3), (1, 68, 64, 64)]
    

    code right now looks like this

    import numpy as np
    import onnxruntime as ort
    
    input_name = 'input'
    input_shape = (1, 3, 256, 256)
    
    dummy_input = np.random.rand(*input_shape).astype(np.float32)
    
    session = ort.InferenceSession('2dfan4.onnx', providers=[
        ('MIGraphXExecutionProvider', {
            'device_id': '0',
            'migraphx_model_cache_path': '.caches',
        })
    ])
    outputs = session.run(None, {input_name: dummy_input})
    print("Inference OK, output shape:", [o.shape for o in outputs])
    
  7. TedThemistokleous commented on Sep 2, 2025

    @TedThemistokleous
    Contributor

    If you're off main, its been changed to

    "migraphx_model_cache_dir"

    From migraphx_execution_provider_info.h

  8. ivancebellansanchez commented on Sep 2, 2025

    @ivancebellansanchez
    Author

    OK, "migraphx_model_cache_dir" does seem to work

    2025-09-02 16:03:37.830034928 [W:onnxruntime:Default, migraphx_execution_provider.cc:168 get_flags_from_env] [MIGraphX EP] MIGraphX ENV Override Variables Set:
    2025-09-02 16:03:38.391188435 [W:onnxruntime:Default, migraphx_execution_provider.cc:1289 calibrate_and_quantize] Quantizing input program to fp16
    

    confirmed to be working

    Image
  9. TedThemistokleous commented on Sep 2, 2025

    @TedThemistokleous
    Contributor

    form migraphx_execution_provider.cc
    Image

    Defined in migraphx_execution_provider_info.h
    Image

  10. TedThemistokleous commented on Sep 2, 2025

    @TedThemistokleous
    Contributor

    Iván Cebellán Sánchez (@ivancebellansanchez) Glad this worked. We've recently updated and amalgamated interfaces for a few different OS builds (*Nix/ Windows) so these flags have been in some flux for some time, especially for save/loading mxr files.

    I'll get the documentation updated as we're slated for an upcoming ROCm release and sync our updates to major releases

    Thanks for pointing this out and if you have any MIGraphX EP issues feel free to open issues here or on MIGraphX and ping me.

  11. ivancebellansanchez commented on Sep 2, 2025

    @ivancebellansanchez
    Author

    thank you for spending some of your time to help me get this running

  12. TedThemistokleous commented on Sep 2, 2025

    @TedThemistokleous
    Contributor

    No Problem. If there's any issues, ping me. Its not a problem. Glad I could help

  13. songding-sd commented on Jul 11, 2026

    @songding-sd

    No Problem. If there's any issues, ping me. Its not a problem. Glad I could help

    Hi,

    I'm trying to use INT8 quantization with the MIGraphX Execution Provider.

    According to the documentation, migraphx_int8_enable requires
    migraphx_int8_calibration_table_name to be set. However, I couldn't find any
    documentation describing how this calibration table should be generated.

    I have a few questions:

    1. What file format is expected for migraphx_int8_calibration_table_name?
    2. Is there an official tool or script to generate this calibration table?
    3. Can it be generated directly from an FP32 ONNX model using ONNX Runtime or MIGraphX?
    4. What is the difference between the native calibration table
      (migraphx_int8_use_native_calibration_table=1) and the JSON format
      (migraphx_int8_use_native_calibration_table=0)?
    5. Is there an example calibration table available in the repository?

    Any documentation or example would be greatly appreciated.

    Thanks!

  14. TedThemistokleous commented on Jul 11, 2026

    @TedThemistokleous
    Contributor

    songding-sd I'm attaching an example from how we use the int8 calibration table

    https://github.com/microsoft/onnxruntime-inference-examples/blob/main/quantization/nlp/bert/migraphx/e2e_migraphx_bert_example.py#L588

    Answers inline

    I have a few questions:

    1. What file format is expected for `migraphx_int8_calibration_table_name`?
    

    Its a flatbuffer - the EP will take a full precision run (fp32) and then use that to generate the calibration data so we can get an idea of how scales/biases are used for the int8 quant. You should use batch 1 to generate the table

    2. Is there an official tool or script to generate this calibration table?
    

    No script - I have an example here - https://github.com/microsoft/onnxruntime-inference-examples/blob/main/quantization/nlp/bert/migraphx/e2e_migraphx_bert_example.py#L557

    The table gets written by doing a fp32 run first and then using that data for int8 quant. Same process for fp8

    3. Can it be generated directly from an FP32 ONNX model using ONNX Runtime or MIGraphX?
    

    Yes

    4. What is the difference between the native calibration table
       (`migraphx_int8_use_native_calibration_table=1`) and the JSON format
       (`migraphx_int8_use_native_calibration_table=0`)?
    

    Naitve is more for Nvidia native format. This is because we take similar format to handle int8. JSON is the default if its a non nvidia native table

    5. Is there an example calibration table available in the repository?
    

    No but there's other examples in microsoft/onnxruntime-inference-examples here's a few

    resnet50 - https://github.com/microsoft/onnxruntime-inference-examples/blob/main/quantization/image_classification/migraphx/resnet50/e2e_migraphx_resnet_example.py
    bert - https://github.com/microsoft/onnxruntime-inference-examples/blob/main/quantization/nlp/bert/migraphx/e2e_migraphx_bert_example.py

    Any documentation or example would be greatly appreciated.

    Documentation would be here

    https://onnxruntime.ai/docs/execution-providers/MIGraphX-ExecutionProvider.html#docker-support

    This will be moving in the coming months as we're compliant with the OnnxRT plugin system - so please ensure you're using Onnxruntime 1.23.x builds and the corresponding prebuilds.

    Support matrix for ROCm and OnnxRT is here.

    https://onnxruntime.ai/docs/execution-providers/MIGraphX-ExecutionProvider.html#requirements

    Thanks!

    Thanks for your question.

  15. songding-sd commented on Jul 13, 2026

    @songding-sd

    Ted Themistokleous (@TedThemistokleous) Thanks for your reply! I'll try quantizing and running some FP32 YOLO ONNX models using the ONNX Runtime MIGraphX Execution Provider. I'll investigate this further and report back if I find anything useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ep:MIGraphXissues related to AMD MI GraphX execution providerep:ROCmquestions/issues related to ROCm execution provider

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions