-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Fix FakeTensor device creation for MPS #144796
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/144796
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 2 Pending, 1 Unrelated FailureAs of commit c799cef with merge base 95b41d2 ( NEW FAILURE - The following job has failed:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
and device.index is None | ||
): | ||
if getattr(torch, device.type).is_initialized(): | ||
if device.type != "mps" and getattr(torch, device.type).is_initialized(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's going on here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it documented anywhere, that torch.device.is_initialized()
should be available? I can implement that function, but I'm unsure what it actually means. That memory were allocated on GPU?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, we have torch.cuda.is_initialized which means the CUDA context has been initialized. If your accelerator has no meaningful concept of initialization you can just always return True.
Stack from ghstack (oldest at bottom):
pow()
#144827abs
in MetalPrintExpr #144826test_remove_no_ops
#144795By promoting torch.device("mps") to
torch.device("mps:0")
, but skippingis_initialized
check, as MPS does not really support multi-GPU right nowThis fixes
GPUTests.test_remove_no_ops_mps
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @chauhang @aakhundov @BoyuanFeng