-
Notifications
You must be signed in to change notification settings - Fork 480
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
Fix XLA tensor storage device by using XlaDeviceToAtenDevice
.
#5743
Conversation
@JackCaoG The failing CI doesn't seem to be related to this PR. Can we re-run it? |
Let me also give you write access so you can rerun CI too |
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 wonder have you experienced any similar bugs on python level?
This is originally a hack see: https://github.com/pytorch/xla/blob/master/torch_xla/csrc/tensor.h#L334
We don't expect people to actually use storage_
.
As of now, we do hit that bug when running this example. That said, there are 2 things I'd like to clarify:
|
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.
LGTM.
Got it. Hopefully we can remove this workaround on fake storage soon. |
…rch#5743) * Add test. * Convert storage device using `XlaDeviceToAtenDevice`.
* Add test. * Convert storage device using `XlaDeviceToAtenDevice`.
* Add test. * Convert storage device using `XlaDeviceToAtenDevice`.
…rch#5743) * Add test. * Convert storage device using `XlaDeviceToAtenDevice`.
* Add test. * Convert storage device using `XlaDeviceToAtenDevice`.
* Add test. * Convert storage device using `XlaDeviceToAtenDevice`.
Discussion: pytorch/pytorch#111506
This PR replaces
backendDeviceToAtenDevice
byXlaDeviceToAtenDevice
when instantiating a new storage in the newly created XLA tensor.Problem: there are 2 problems:
backendDeviceToAtenDevice
doesn't take into consideration the device typeXlaDeviceType
enum as the device type, while eager usesc10::DeviceType
Solution: use
XlaDeviceToAtenDevice
function, since we know that the input is an XLA device anyway.