-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Add refs/decomps for dot/vdot #108194
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
Add refs/decomps for dot/vdot #108194
Conversation
Follow-up on #108127 (comment) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/108194
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 3632437 with merge base b7624fc ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Follow-up on #108127 (comment) ghstack-source-id: 829d50f Pull Request resolved: #108194
yield ErrorInput(SampleInput(make_input(1, 1), args=(make_input(3),)), | ||
error_regex='1D tensors expected') | ||
yield ErrorInput(SampleInput(make_input(9), args=(make_input(3),)), | ||
error_regex='inconsistent tensor size') | ||
if device != "cpu": | ||
ErrorInput(SampleInput(make_input(3), args=(make_input(3, device="cpu"),)), | ||
error_regex='Expected all tensors to be on the same device') |
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.
Why are we changing the tests here? Shouldn't you fix the refs to match the test.
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.
We don't check the device in almost any op, so I figured that it's a bit unnecessary. I can roll back.
As to the other, checking for that error disallows using the elementwise wrapper, which is, if anything, a good thing. One of the initial designs of primtorch was that we should add more support for ops if it's easy to do so.
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.
Adding more functionality to the ref seems fine, but removing testing from eager definitely seems bad,
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 do you suggest then? Should I just xfail these tests?
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.
Could you override the error_inputs_func
of the ref info to pass in an is_ref=True
option?
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.
Fair enough. Done.
"_refs.dot", | ||
torch_opinfo_name="dot", | ||
# .conj() returns a view on complex tensors?? | ||
validate_view_consistency=False, |
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.
Why aren't we getting the view behavior right 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.
At a guess, return torch.dot(self, other.conj()).conj()
probably needs to come outside of elementwise_type_promotion_wrapper
.
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.
Not quite. I checked under this branch:
elif other.is_conj():
return torch.dot(self, other.conj()).conj()
which is the one that triggers the issue, and torch.dot(self, other.conj())
is not a view, but torch.dot(self, other.conj()).conj()
is a view.
On the other hand, if I put the same code in ATen, it says that torch.dot(self, other.conj()).conj()
is conj but not a view... I'm submitting a different fix.
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.
Nvm, the other fix doesn't work. I'm not quite sure what's going on there.
I'm voting for leaving as is right now as we don't even support complex numbers at the moment in inductor.
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.
Okay the eager result having is_conj()
but not _is_view()
is weird but not really our fault here, so I guess thats fine. This comment should be updated to reflect that though; .conj()
is expected to return a view so the comment doesn't make much sense.
Follow-up on #108127 (comment) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov [ghstack-poisoned]
Follow-up on #108127 (comment) ghstack-source-id: 399c51e Pull Request resolved: #108194
Follow-up on #108127 (comment) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov [ghstack-poisoned]
Follow-up on #108127 (comment) ghstack-source-id: 81642a5 Pull Request resolved: #108194
Follow-up on #108127 (comment) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov [ghstack-poisoned]
Follow-up on #108127 (comment) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov [ghstack-poisoned]
Follow-up on #108127 (comment) ghstack-source-id: 849d47b Pull Request resolved: #108194
@pytorchbot 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 |
Merge failedReason: 1 jobs have failed, first few of them are: trunk / macos-12-py3-arm64-mps / test (default, 1, 1) Details for Dev Infra teamRaised by workflow job |
Follow-up on #108127 (comment) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov [ghstack-poisoned]
Follow-up on #108127 (comment) ghstack-source-id: 992cf08 Pull Request resolved: #108194
TORCH_CHECK( | ||
self.device() == other.device(), | ||
"expected all tensors to be on the same device. Found: ", | ||
self.device(), | ||
", ", | ||
other.device()); |
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.
@peterbell10 removing this as it's unreachable. We currently check this in the dispatcher and throw
Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument tensor in method wrapper_CUDA__dot
@pytorchbot 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 |
Stack from ghstack (oldest at bottom):
Follow-up on #108127 (comment)
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @ngimel @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov