-
Notifications
You must be signed in to change notification settings - Fork 75
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
#12355: Support vector of optional tensor and example #12356
Conversation
36cdca1
to
919e8f7
Compare
auto size = value.size(); | ||
output_tensors.reserve(size); | ||
|
||
auto dummy_tensor = Tensor(); |
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.
Yeah, this part does not look good to me.
@dmakoviichuk-tt i remember you added a support for a return of vector of optional tensors ~2 months ago. Can you please take a look? This blocks Moreh and id appreciate your feedback 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.
I added support for the launch_op and for a few more cases.
Seems like decorators changed a lot since this time.
919e8f7
to
4f89a70
Compare
This change basically means you return a vector, not vector<optional>, right? I think for vector<optional> to properly work with register_operation_with_auto_launch_op we need to do next:
Infra should be aware about which outputs have to be created. This requires those methods to accept more args. |
In other words: If op returns
|
In other words: You solution makes things compile, but it changes the op type from the expected |
ConclusionWe can't provide a better alternative at the moment. In most of the migrated PRs you use register_operation, which requires a manual call to launch_op, else an operation host code and dispatch will run in the main thread. This will likely be a regression in behavior and performance for you. Unless you have time to implement a more proper solution, which I outline here, I am ok if this is merged. This change should enable you to use register_operation_with_auto_launch_op in all cases. |
abbe15e
to
dcb09ca
Compare
Thank you for the detailed explanation. I plan to merge this PR as it is for now, and I would appreciate it if you could make the proper corrections when you have time. |
dcb09ca
to
6c40943
Compare
Ticket
#12355
Problem description
There is currently an issue in ttnn where if you create an op that returns a vector of optional tensors and use register_operation_with_auto_launch_op, the build fails.
The problematic part is in decorator.hpp where only cases for tensor, tensors, and tuple are allowed, causing the static_assert to fail.
What's changed
Add handling for a vector of optional tensors and create an example that returns a vector of optional tensors.
Checklist