Skip to content
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

Handle Tensor.__deepcopy__ via clone(), on IPU (#89129) #89999

Merged
merged 1 commit into from Dec 7, 2022

Conversation

charlie-wt
Copy link
Contributor

Link to landed master PR (if applicable):
#89129

Criteria Category:
2: This affects correct behaviour of IPU tensors, in the out-of-tree IPU backend.

I'm hoping this is a low-risk change, since it only affects how IPU tensors are tagged, and since the IPU backend is out-of-tree, it shouldn't affect anything here.

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 1, 2022

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/89999

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 Failures

As of commit 1e0e36c:

The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@atalman
Copy link
Contributor

atalman commented Dec 6, 2022

@pytorchbot rebase -b release/1.13

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a rebase job. Check the current status here

Currently it falls through to a call to `storage()`, which the IPU doesn't support.

I've made the minimal change here for ease of merging (this'd help us if it was in for 1.13.1), however...

**QUESTION**: Is there any reason why `not torch._C._has_storage(self)` needs to *also* be guarded on `self.device.type == privateuseone`? in other words, could the condition for using `clone` not be this?

```python
self.is_sparse
or self.device.type
in ["lazy", "xla", "mps", "ort", "meta", "hpu", "ipu"]
or not torch._C._has_storage(self)
or (type(self) is not Tensor and self.data_ptr() == 0)
```

If the condition fails, the very next thing is a call to `self._typed_storage()` which will fail, so it feels to me like *any* case without storage shouldn't fall through to the `storage()` call.

The original PR for adding the 'no storage and device is `PrivateUse1`' condition ([86557](pytorch#86557)) doesn't discuss whether this could be broadened.
Pull Request resolved: pytorch#89129
Approved by: https://github.com/albanD
@pytorchmergebot
Copy link
Collaborator

Successfully rebased release/1.13-ipu-deepcopy onto refs/remotes/origin/release/1.13, please pull locally before adding more changes (for example, via git checkout release/1.13-ipu-deepcopy && git pull --rebase)

Copy link
Contributor

@atalman atalman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@atalman atalman merged commit 80abad3 into pytorch:release/1.13 Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants