-
Notifications
You must be signed in to change notification settings - Fork 544
Migrate torch_xla.device()
to torch.device('xla')
#9253
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
base: master
Are you sure you want to change the base?
Conversation
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.
approved pending successful ci/cd tests. Thank you for finally getting this fixed! As another issue, we should update all our docs to reflect this (the MDs not just the docstrings, which I think this PR covers). THANK YOU!!!
2a8f9e9
to
0c01883
Compare
b9ed0df
to
2fd8ab0
Compare
So, after some digging I realized that the semantics of |
Thanks for this good analysis. Clearly the APIs are not the same, but, do they have enough expressiveness to do the same thing? setting an ordinal for device number appears supported. The one area that does not appear supported is SPMD. I wonder if torch.device("gspmd") would be the better way to do it rather than torch_xla.device() which always returns "xla:0". There is room to get this right. The closest I can think of is torch.device("meta"). similarly, "gspmd" might represent a virtual device. That said, if we are going to try to redo the gSPMD stuff to align with DTensor, we should just worry about it then. |
If you know which ordinal you are querying for, both have the same expressiveness. Apart from SPMD, |
Thanks. I don't know what is the setter for I wonder if this would allow us to have a get and set default device that is idiomatic. https://docs.pytorch.org/docs/stable/generated/torch.set_default_device.html |
fixes #9252