[Bugfix] Match eager stride semantics for cloned tensors with preserve_format in compile#163017
[Bugfix] Match eager stride semantics for cloned tensors with preserve_format in compile#163017Lucaskabela wants to merge 6 commits intomainfrom
Conversation
…tensor when exactly one tensor is given
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/163017
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit b4df60a with merge base 8590c3a ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot label "topic: not user facing" |
|
Want to wait to see if there are any comments from @zou3519 since he had some insights on the previous PR |
| if utils.is_non_overlapping_and_dense(input): | ||
| computed_stride = input.stride() | ||
| else: | ||
| computed_stride = utils.compute_elementwise_output_strides(input) |
There was a problem hiding this comment.
I think compute_elementwise_output_strides is wrong in general. We should update it to do:
if utils.is_non_overlapping_and_dense(input):
computed_stride = input.stride()
else:
something()
So while you should feel free to ship this PR, there are still problems lurking in whatever relies on compute_elementwise_output_strides (e.g. the other unary pointwise ops).
In the other PR we did try to update compute_elementwise_output_strides to do the above and it led to some issues that were not yet debugged.
There was a problem hiding this comment.
cc @morrison-turnansky ah let's follow up with this - these test cases in this PR pass, and I am not aware of others we are missing, but let's think on this and if we find anything we can work together to put out a follow up PR fixing any issues in compute_elementwise_output_strides
|
@pytorchmergebot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…e_format in compile (pytorch#163017) Fixes pytorch#161010 by making `clone_meta` match the semantics of strides for eager mode. This is: * Case 1: Tensor is_non_overlapping_and_dense; in this case, stride should match input tensor stride * Case 2: Otherwise, stride should be contiguous computed from input tensor using `compute_elementwise_output_strides` Pull Request resolved: pytorch#163017 Approved by: https://github.com/williamwen42, https://github.com/xmfan Co-authored-by: morrison-turnansky <mturnans@redhat.com>
…e_format in compile (pytorch#163017) Fixes pytorch#161010 by making `clone_meta` match the semantics of strides for eager mode. This is: * Case 1: Tensor is_non_overlapping_and_dense; in this case, stride should match input tensor stride * Case 2: Otherwise, stride should be contiguous computed from input tensor using `compute_elementwise_output_strides` Pull Request resolved: pytorch#163017 Approved by: https://github.com/williamwen42, https://github.com/xmfan Co-authored-by: morrison-turnansky <mturnans@redhat.com>
…e_format in compile (pytorch#163017) Fixes pytorch#161010 by making `clone_meta` match the semantics of strides for eager mode. This is: * Case 1: Tensor is_non_overlapping_and_dense; in this case, stride should match input tensor stride * Case 2: Otherwise, stride should be contiguous computed from input tensor using `compute_elementwise_output_strides` Pull Request resolved: pytorch#163017 Approved by: https://github.com/williamwen42, https://github.com/xmfan Co-authored-by: morrison-turnansky <mturnans@redhat.com>
Continuation of work from #161400 and #163017. Updating stride semantics for ```clone_meta``` and underlying function, ```compute_elementwise_output_strides```. Pull Request resolved: #164252 Approved by: https://github.com/Lucaskabela
Continuation of work from pytorch#161400 and pytorch#163017. Updating stride semantics for ```clone_meta``` and underlying function, ```compute_elementwise_output_strides```. Pull Request resolved: pytorch#164252 Approved by: https://github.com/Lucaskabela
Fixes #161010 by making
clone_metamatch the semantics of strides for eager mode.This is:
compute_elementwise_output_stridescc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames