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

Convert aten.repeat to ttnn.repeat #189

Merged
merged 5 commits into from
Sep 13, 2024
Merged

Convert aten.repeat to ttnn.repeat #189

merged 5 commits into from
Sep 13, 2024

Conversation

jdh8
Copy link
Collaborator

@jdh8 jdh8 commented Sep 12, 2024

Ticket

Subproblem of tenstorrent/tt-metal#12853

Problem description

This happens when repeating non-aligned innermost dimension. Luckily, this does not happen in our input variations.

E       RuntimeError: TT_FATAL @ /home/runner/work/tt-metal/tt-metal/ttnn/cpp/ttnn/operations/data_movement/repeat/repeat.cpp:37: (input_tensor.get_legacy_shape()[dim] * input_tensor.element_size()) % input_tensor.buffer()->alignment() == 0
E       info:
E       Current repeat implementation requires aligned last dim when repeating on last dim
E       backtrace:
E        --- /home/jdh8/venv/lib/python3.8/site-packages/ttnn/_ttnn.cpython-38-x86_64-linux-gnu.so(+0x4f082a) [0x7f60cb3dd82a]
E        --- /home/jdh8/venv/lib/python3.8/site-packages/ttnn/_ttnn.cpython-38-x86_64-linux-gnu.so(+0x4f15b0) [0x7f60cb3de5b0]
E        --- /home/jdh8/venv/lib/python3.8/site-packages/ttnn/_ttnn.cpython-38-x86_64-linux-gnu.so(+0x4f219f) [0x7f60cb3df19f]
E        --- tt::tt_metal::Device::push_work(std::__1::shared_ptr<std::__1::function<void ()>>, bool)
E        --- ttnn::operations::data_movement::RepeatOperation::invoke(unsigned char, tt::tt_metal::Tensor const&, ttnn::types::Shape const&, std::__1::optional<tt::tt_metal::MemoryConfig> const&)
E        --- /home/jdh8/venv/lib/python3.8/site-packages/ttnn/_ttnn.cpython-38-x86_64-linux-gnu.so(+0x17df968) [0x7f60cc6cc968]
E        --- /home/jdh8/venv/lib/python3.8/site-packages/ttnn/_ttnn.cpython-38-x86_64-linux-gnu.so(+0x17e0753) [0x7f60cc6cd753]
E        --- /home/jdh8/venv/lib/python3.8/site-packages/ttnn/_ttnn.cpython-38-x86_64-linux-gnu.so(+0x17e0dbf) [0x7f60cc6cddbf]
E        --- tt::tt_metal::Device::push_work(std::__1::shared_ptr<std::__1::function<void ()>>, bool)

What's changed

  • Restore conversion aten.repeatttnn.repeat
  • Reenable test for aten.repeatttnn.repeat

@ayerofieiev-tt
Copy link
Member

@jdh8 can you please review this list?
https://github.com/tenstorrent/pytorch2.0_ttnn/blob/main/docs/cumulative_input_variations.md#atenrepeatdefault

We have this for every op.
I think it is great to have it in lowering tests.
If some test fails - mark it xfailed and add a check in the lowering pass for it to fallback.

Wdyt?

@jdh8 jdh8 changed the title Try converting aten.repeat to ttnn.repeat Convert aten.repeat to ttnn.repeat Sep 13, 2024
((6, 2), (361, 1)),
((6, 2), (4, 1)),
((6, 2), (400, 1)),
((6, 2), (9, 1)),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just refined the conversion so that our use cases should pass.

reason="Current repeat implementation requires aligned last dim when repeating on last dim"
),
),
((5, 16), (2, 3)),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These cases are not in the list of input variations. I leave them for future improvement.

Error message:
```
E       RuntimeError: TT_FATAL @ /home/runner/work/tt-metal/tt-metal/ttnn/cpp/ttnn/operations/data_movement/repeat/repeat.cpp:37: (input_tensor.get_legacy_shape()[dim] * input_tensor.element_size()) % input_tensor.buffer()->alignment() == 0
E       info:
E       Current repeat implementation requires aligned last dim when repeating on last dim
```
@jdh8
Copy link
Collaborator Author

jdh8 commented Sep 13, 2024

I'm merging this because it may help #146

@jdh8 jdh8 added this pull request to the merge queue Sep 13, 2024
@ayerofieiev-tt ayerofieiev-tt removed this pull request from the merge queue due to a manual request Sep 13, 2024
@ayerofieiev-tt ayerofieiev-tt merged commit 97a4285 into main Sep 13, 2024
1 check passed
@ayerofieiev-tt ayerofieiev-tt deleted the feature/repeat branch September 13, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants