-
Notifications
You must be signed in to change notification settings - Fork 15
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
[TTNN] Adding support for data type workarounds and introducing Embedding workarounds #1583
Merged
sdjordjevicTT
merged 1 commit into
main
from
sdjordjevic/add_data_format_workaround_infra
Dec 23, 2024
Merged
[TTNN] Adding support for data type workarounds and introducing Embedding workarounds #1583
sdjordjevicTT
merged 1 commit into
main
from
sdjordjevic/add_data_format_workaround_infra
Dec 23, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@sdjordjevicTT can you just add in the PR description example of how IR looks today (without this change), and how it will look with the change? |
4df3134
to
6da4ac9
Compare
6da4ac9
to
2ab9e8a
Compare
mtopalovicTT
approved these changes
Dec 20, 2024
b595a45
to
0816699
Compare
0816699
to
f8a4157
Compare
This was referenced Jan 10, 2025
pmarkovicTT
added a commit
that referenced
this pull request
Jan 20, 2025
This was referenced Jan 27, 2025
Merged
pmarkovicTT
added a commit
to tenstorrent/tt-tvm
that referenced
this pull request
Jan 27, 2025
We don't need explicit embedding dataformat cast in tvm (from float32 to bf16) as dataformat workaround for this case is implemented in mlir. PRs for reference: - [TVM cast workaround](#55) - [Embedding Op workaround](tenstorrent/tt-mlir#1583) - [EmbeddingBackward Op workaround](tenstorrent/tt-mlir#1756) Related to this issue tenstorrent/tt-forge-fe#1112
pmarkovicTT
added a commit
to tenstorrent/tt-forge-fe
that referenced
this pull request
Feb 7, 2025
#1111) ### Ticket Close #1112 ### Problem description We don't need explicit embedding dataformat cast in tvm (from float32 to bf16) as dataformat workaround for this case is implemented in mlir. PRs for reference: - [TVM change](tenstorrent/tt-tvm#59) - [Embedding Op workaround](tenstorrent/tt-mlir#1583) - [EmbeddingBackward Op workaround](tenstorrent/tt-mlir#1756) ### What's changed Removed explicit cast to bfloat16 if dataformat for embedding weights is float32. Updated llama backward test to reflect new forge api for training (setting training argument). ### Checklist - [x] Remove explicit cast in third_party/tvm/python/tvm/relay/frontend/pytorch.py - [x] Update test_llama_backward.py --------- Co-authored-by: Vladimir Milosevic <157983820+vmilosevic@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a solution for handling data type workarounds for operation operands and results. To address input operand data type workarounds, we insert a
toLayout
operation between the input operands and the operation itself. This casts the input to the desired data type. If the data type of the output result changes due to a workaround, we will revert it to the previous data type by inserting aToLayoutOp
after the operation's output.Additionally, this PR provides necessary workarounds to ensure that the embedding operation functions correctly. Specifically, it changes the input to an RM layout and casts both the input weight and the output to bf16. Other ops will be onboarded to this type of workaround in a separate PR.
Example of IR today:
An example of IR with this change where embedding op has bf16 workaround applied for weight operand: