Skip to content
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 Matmul, Conv, and AllGather to compute_ouput_specs #15978

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

sminakov-tt
Copy link
Contributor

@sminakov-tt sminakov-tt commented Dec 12, 2024

Ticket

Problem description

We're continuing to port ops from compute_output_shapes to the new compute_output_specs

What's changed

Ported matmul, all_gather, all_gather_matmul, conv2d, and halo ops to use compute_output_specs

Checklist

  • Post commit CI passes
  • Blackhole Post commit (if applicable)
  • Model regression CI testing passes (if applicable)
  • Device performance regression CI testing passes (if applicable)
  • (For models and ops writers) Full new models tests passes
  • New/Existing tests provide coverage for changes

return {create_device_tensor(output_shape, output_dtype, Layout::ROW_MAJOR, input_tensor.device(), out_mem_config)};
return {TensorSpec(
output_shape.logical_shape(),
TensorLayout::fromLegacyPaddedShape(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch.. means we will have to make another pass to get rid of this constructor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, getting rid of fromLegacyPaddedShape is not trivial and will require help from op writers. It's a part of the planned refactoring to remove all Shape/LegacyShape from ops

Copy link
Contributor

@TT-BrianLiu TT-BrianLiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with minor comment

Comment on lines -430 to -431
} // namespace detail

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason for moving it out of detail namespae?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved default_create_output_tensors out of detail namespace, so I can use it in matmul.

auto output_tensor_shape = ttnn::Shape(tt::tt_metal::LegacyShape({1, 1, padded_shape_w, padded_shape_c}, output_padding));
return {output_tensor_shape.value};
}
auto output_shape = tt::tt_metal::LegacyShape({1, 1, padded_shape_w, padded_shape_c}, output_padding);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removal of the use of LegacyShape is on the OP owners?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Removal of Shape/LegacyShape within each individual OP is on the OP's owners. It may involve modifying the operation to avoid unnecessary paddings.

Copy link
Contributor

@mywoodstock mywoodstock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conv2d anf halo updates look good.

@sminakov-tt sminakov-tt merged commit b314a49 into main Dec 13, 2024
120 checks passed
@sminakov-tt sminakov-tt deleted the sminakov/tensor-spec-matmul-conv branch December 13, 2024 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants