-
Notifications
You must be signed in to change notification settings - Fork 90
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
#0: Port eltwise and some misc ops to use TensorSpec #15471
Conversation
const auto& tensor_b = tensor_args.input_tensor_b; | ||
const auto input_shape_b = tensor_b.has_value() ? tensor_b->shape() : ttnn::Shape{1, 1}; | ||
const auto input_shape_b = tensor_b.has_value() ? tensor_b->logical_shape() : ttnn::SimpleShape{}; |
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.
Has value
what does it mean?
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.
tensor_b
is optional here. I'm unsure what it means for a binary op to have a second argument as optional, but preserving the behavior
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 remember now. This is how float scalar is handled. Think of it like there is a union. It’s or float or tensor. Just expressed in this way
if (output_tensor.has_value()) { | ||
return output_tensor.value(); | ||
} | ||
auto output_shape = compute_broadcasted_output(input_shape_a, input_shape_b); | ||
|
||
auto program_factory = select_program_factory(operation_attributes, tensor_args); |
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.
Got a bit surprised that we call this method here. It means we call it at least two times per operation call. Not that it’s a problem but it’s a surprise.
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. I would expect that select_program_factory
should be really quick. It makes sense, at least to some extent, that the output tensor specs depend on the actual factory being used for these input arguments.
if (tensor_args.output_tensor.has_value()) { | ||
return *tensor_args.output_tensor; | ||
} | ||
return create_device_tensor(compute_output_specs(operation_attributes, tensor_args), tensor_args.input_tensor_a.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.
So interesting. Tensor might have multiple devices today. I see this part of code did not change, but I wonder..
On this level multidevice basically does not exist today if I get it right.
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.
Yes. Multi-device seems to be problematic overall at the moment. With having single MeshDevice it should work as expected though.
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.
Please link test runs.
Otherwise looks fine to me.
Left some comments they would be good to discuss but they are not related to this change.
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 may have missed it but I don't see any padding calculations. Is this because none of these ops used the padded shape anywhere?
@ntarafdar None of the ops did anything before to request a custom padding. |
@sminakov-tt awesome. Ya next week I'm going to do the same for data movement ops. I think only transpose uses padding for anything so hoping it should be rather smooth for me as well! |
Ticket
Problem description
We need to migrate all ops to use
compute_output_specs
with TensorSpec, instead of oldercompute_output_shapes
What's changed
Migrated ops to TensorSpec:
Fixes in the infrastructure to support the migration.
Checklist