forked from microsoft/Olive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix perftuning to meet DLIS integration requirements (microsoft#820)
## Describe your changes * Change the execution provider priority to use the parameters instead of that one in inference_settings. Bug description: In DLIS scenarios, the inferenece_settings is something like: {'execution_provider': [('MIGraphXExecutionProvider', {})]} and the provider_lists specified in perf_tuning is: ['ROCMExecutionProvider', 'MIGraphXExecutionProvider']. Originally, the inference_settings priority is higher than the execution_providers specified in arguments. As the result, when calling OnnxEvaluator.evaluate with the provider_list in baseline evaluation, the execution provider will be used as ["MIGraphXExecutionProvider"]. Later, the OnnxEvaluator.disable_ort_fallback(session, execution_providers) will check whether the underlying session's providers(MIGraphXExecutionProvider, CPUExecutionProvider) contains the execution_providers(ROCMExecutionProvider, MIGraphXExecutionProvider). In this case, the ROCMExecutionProvider is excluded when creating inference session. and the OliveEvaluationError exception will be raised. To fix this issue, we need move the check_ort_fallback into prepare_session in onnx model. perf tuning will always pass None as the execution provider to evaluate to make the logic clear * Change perf tuning to always has execution provider info regardless of whether the best result is baseline or from perf tuning. * Change perf tuning to accept both provider list and provider list with provider options. * Add force_evaluate_other_eps to force run all other EPs if the current EP is not same with the additional EPs * Change OnnxModel.prepare_session to accept both execution provider list and (execution provider, provider options) list In this way, the EP/provider option handling logic is normalized. * Add MIGraphXExecutionProvider to the accelerator map * Fix the critical bug when creating inference session that doesn't respect provider options in ort_inference.py * Add io_bind inference for accuracy since illegal memory access in cuda will be thrown if enable_cuda_graph. If io_bind is not enabled and enable_cuda_graph is True, the following errors will be raised: onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : CUDA failure 700: an illegal memory access was encountered ; GPU=0 ; hostname=c93f1847c000000 ; file=/onnxruntime_src/onnxruntime/core/providers/cuda/cuda_graph.cc ; line=49 ; expr=cudaGraphLaunch(graph_exec_, stream_); [E:onnxruntime:Default, cuda_call.cc:116 CudaCall] CUDA failure 700: an illegal memory access was encountered ; GPU=0 ; hostname=c93f1847c000000 ; file=/onnxruntime_src/onnxruntime/core/providers/cuda/cuda_execution_provider.cc ; line=286 ; expr=cudaStreamDestroy(stream_); [E:onnxruntime:Default, cuda_call.cc:116 CudaCall] CUDNN failure 4: CUDNN_STATUS_INTERNAL_ERROR ; GPU=0 ; hostname=c93f1847c000000 ; file=/onnxruntime_src/onnxruntime/core/providers/cuda/cuda_execution_provider.cc ; line=181 ; expr=cudnnDestroy(cudnn_handle_); ## Checklist before requesting a review - [x] Add unit tests for this change. - [x] Make sure all tests can pass. - [ ] Update documents if necessary. - [x] Lint and apply fixes to your code by running `lintrunner -a` - [x] Is this a user-facing change? If yes, give a description of this change to be included in the release notes. ## (Optional) Issue link
- Loading branch information
1 parent
69c2aa7
commit 855be5d
Showing
11 changed files
with
763 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.