-
Notifications
You must be signed in to change notification settings - Fork 496
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 support for returning more than one copy of the same tensor #1228
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.
Fascinating. I always though that getUsers was deduped.
Did you actually run into this in a real test? I would have thought that by construction in our pipeline we wouldn't hit this situation of multiple uses. If that's the case, then we can change it to a check that there is only one use. |
Yeah, I thought it was weird too.
I ran into this while running the unit tests I had written for my torchdynamo compiler. It is definitely something that can be modified to not return two copies of the same tensor. In real world applications, I imagine this case is not common.
What aspects of the pipeline would guarantee this? |
Okay, that is real enough. Let's land this.
I was thinking that something could end up inserting one copy per operand of the return op which would guarantee that the return op always had distinct values. But I guess that isn't the case here since you hit it from "user code". |
52402e4
to
6446cf0
Compare
One of the simplifications made by the pass `RefinePublicReturn` currently only happens if the tensor in question only has one user. However, the current method of checking this does not correctly handle the case of a user having multiple uses of the same tensor. This commit makes sure only unique users are considered.
6446cf0
to
646fc32
Compare
* Replace DLCp by NNPA Signed-off-by: Tung D. Le <tung@jp.ibm.com> * Missing files Signed-off-by: Tung D. Le <tung@jp.ibm.com> * Clang format Signed-off-by: Tung D. Le <tung@jp.ibm.com> * Remove ++ Signed-off-by: Tung D. Le <tung@jp.ibm.com> * Replace dlc by nnpa Signed-off-by: Tung D. Le <tung@jp.ibm.com> * clang format Signed-off-by: Tung D. Le <tung@jp.ibm.com> * NNPAompiler to NNPACompiler Signed-off-by: Tung D. Le <tung@jp.ibm.com>
One of the simplifications made by the pass
RefinePublicReturn
currently only happens if the tensor in question only has one
user. However, the current method of checking this does not correctly
handle the case of a user having multiple uses of the same
tensor. This commit makes sure only unique users are considered.