Allow ORT actively fallback CUDAExecutionProvider to ROCMExecutionProvider#16895
Closed
Allow ORT actively fallback CUDAExecutionProvider to ROCMExecutionProvider#16895
Conversation
6e24e9c to
a9cb7ce
Compare
pranavsharma
reviewed
Aug 2, 2023
|
|
||
| def set_provider_options(name, options): | ||
| if ( | ||
| os.environ.get("ORT_FALLBACK_CUDA_EP_TO_ROCM_EP", "0") == "1" |
Contributor
There was a problem hiding this comment.
We've avoided env variables so far for configs. Let's continue this convention.
Contributor
Author
There was a problem hiding this comment.
This is not config, this is a walkaround. This fallback logic happens right before the construction of Session, so entry ORT_FALLBACK_CUDA_EP_TO_ROCM_EP neither fits into session options nor provider options.
Co-authored-by: Thiago Crepaldi <thiago.crepaldi@microsoft.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the wild, for example, pytorch and huggingface (pytorch pipelines) use
cudafor amd gpu. Their user can basically painless switch from cuda devices to rocm devices. That is, in pytorch world they fallback cuda to rocm.When switched to hf ort backend, it will populate a string
CUDAExecutionProviderautomatically to pin down the provider. Then ORT will not play well in this case because the framework will fallback cuda to cpu.The disparity creates a lot of headache during benchmarking the ROCm EP when reusing scripts for cuda.
This PR address it by allow cuda to fallback to rocm.