Repository navigation
Avoid probing MPS twice after automatic device selection fails - #256
Open
gezerui888 wants to merge 1 commit into
Open
gezerui888 wants to merge 1 commit into
gezerui888 wants to merge 1 commit into
Conversation
Author
|
Hi @jaredpalmer, could you review my fix for the repeated MPS probe when you have a moment? I would also appreciate approval for the pending CI workflow. |
3 tasks done
Author
|
Hi @jaredpalmer, I would appreciate a review when you have time. Could you also approve the pending CI workflow? |
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.
On Apple Silicon,
select("auto")already probes MPS. If that child fails or times out, the fallback probes MPS again before selecting CPU. This repeats the same failure and can double the wait.I have the child announce its selected device before allocating a tensor. When a failed automatic probe reports MPS, the parent goes directly to CPU. If the child fails before reporting a device, the existing MPS fallback remains. The announcement uses a separate marker from the success result, so it cannot make a failed probe look successful.
Fixes #255.
Test plan
.github/workflows/ci.yml: 598 passed, 26 skipped.pytest tests/test_device.py tests/test_conventions.py -q: 91 passed, including regression cases for missing output, CUDA fallback, MPS errors, timeouts and signals.torch.float8_e4m3fn: one failed MPS probe before CPU fallback, instead of two.