-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MIGraphX EP] Add migx ep fp8 support and int4 weights #23534
base: main
Are you sure you want to change the base?
[MIGraphX EP] Add migx ep fp8 support and int4 weights #23534
Conversation
* Add fp8 and int4 types in supported list for Onnxruntime EP * Add support for int4 inputs Map things to int8 right now as we don't explicitly set an int4 input type and pack/unpack int4 operands * Add flag to allow for fp8 quantization through Onnxruntime API * Add fp8 quantization to the compile stage of the MIGraphX EP Mirror the same calibration code we use for int8 and just change which quantize we call through the MIGraphx API * cleanup logging * Cleanup and encapsulate quantization / compile functions - Add additional flags for fp8 thats shared for int8 - Add lockout warning message when int8/fp8 used at the same time * Run lintrunner pass * Fix session options inputs + add better logging. Previous runs using session options failed as we were missing pulling in inputs from the python interface. This plus additional logging allowed me to track what options were invoked via env and what were added during the start of an inference session * Fix naming for save/load path varibles to be consistent with enable. * Print only env variables that are set as warnings need this so the user knows there's any of the environment variables running in the background to ensure proper consistently between runs. --------- Co-authored-by: Ted Themistokleous <[email protected]>
ping @tianleiwu required for additional support of quantization through the MIGraphX API |
/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows CPU CI Pipeline,Windows GPU CUDA CI Pipeline,Windows GPU DML CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline |
/azp run Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline,Linux QNN CI Pipeline,MacOS CI Pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,onnxruntime-binary-size-checks-ci-pipeline,Big Models,Linux Android Emulator QNN CI Pipeline |
/azp run Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline,CoreML CI Pipeline,Linux DNNL CI Pipeline,Linux MIGraphX CI Pipeline,Linux ROCm CI Pipeline |
Azure Pipelines successfully started running 7 pipeline(s). |
Azure Pipelines successfully started running 8 pipeline(s). |
Azure Pipelines successfully started running 10 pipeline(s). |
/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows CPU CI Pipeline,Windows GPU CUDA CI Pipeline,Windows GPU DML CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline |
/azp run Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline,Linux QNN CI Pipeline,MacOS CI Pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,onnxruntime-binary-size-checks-ci-pipeline,Big Models,Linux Android Emulator QNN CI Pipeline |
/azp run Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline,CoreML CI Pipeline,Linux DNNL CI Pipeline,Linux MIGraphX CI Pipeline,Linux ROCm CI Pipeline |
Azure Pipelines successfully started running 7 pipeline(s). |
Azure Pipelines successfully started running 10 pipeline(s). |
Azure Pipelines successfully started running 8 pipeline(s). |
@TedThemistokleous, please take a look at build error: /onnxruntime_src/onnxruntime/core/providers/migraphx/migraphx_execution_provider.cc:345:18: error: ‘migraphx_shape_fp8e4m3fn_type’ was not declared in this scope; did you mean ‘migraphx_shape_fp8e4m3fnuz_type’? |
Shoot, You'll need to use a later version of MIGraphx in your CI. We've added the quantize_fp8 function as part of our api recently. Where in your CI does it pull/use MIGraphX or do you pin things to a ROCm version? |
This is the docker file used in CI: Related commit: |
Lets put this on ice then and I can gate this feature based on ROCm 6.4. That's where this change is targeted to for MIGraphX. In the meantime, do you want me to help updating your CI to ROCm 6.3? We just released ROCm 6.3.2 and it looks like you're using a ROCm 6.2.3 build in your CI instead |
related: #23535 |
Actually, ROCm 6.3.2 release is sufficient for this API call as we've added this in. Quick check shows this. CI change to ROCm 6.3.2 should be enough.
It would pull the existing package found on our public repo.radeon found here: https://repo.radeon.com/rocm/apt/6.3.2/pool/main/m/migraphx/ |
Add fp8 and int4 types in supported list for Onnxruntime EP
Add support for int4 inputs
Map things to int8 right now as we don't explicitly set an int4 input type and pack/unpack int4 operands
Add flag to allow for fp8 quantization through Onnxruntime API
Add fp8 quantization to the compile stage of the MIGraphX EP
Mirror the same calibration code we use for int8 and just change which quantize we call through the MIGraphx API
cleanup logging
Cleanup and encapsulate quantization / compile functions
Add additional flags for fp8 thats shared for int8
Add lockout warning message when int8/fp8 used at the same time
Run lintrunner pass
Fix session options inputs + add better logging.
Previous runs using session options failed as we were missing pulling in inputs from the python interface. This plus additional logging allowed me to track what options were invoked via env and what were added during the start of an inference session
Fix naming for save/load path varibles to be consistent with enable.
Print only env variables that are set as warnings
need this so the user knows there's any of the environment variables running in the background to ensure proper consistently between runs.
Description
Changes to cleanup the MIGraphX EP quantization code as well as adding fp8 quantization support along with int4 support.
Cleanup changes handle a few instances of issues seen with the python interface when taking in provider options
Motivation and Context
Required as we fix ignored flags when using provider_options for the MIGraphX EP
Adding fp8 quantization through the MIGraphX API
Adding int4 weight support for packed int4 weights for MIGraphX inference