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

TosaToTensor: Support reshape on unsigned #179

Merged
merged 2 commits into from
May 8, 2024

Conversation

mgehre-amd
Copy link
Collaborator

Update the conversion for tosa.reshape to properly use the type converter, so tosa.reshape on unsigned types work.

@mgehre-amd mgehre-amd requested review from cferry-AMD and josel-amd May 7, 2024 14:37
@cferry-AMD
Copy link
Collaborator

Is there an element-wise cast operator for tensors that would account for the unrealized casts? Besides, unless I'm mistaking, tensor reshaping should not depend on the element type, so I think I missed something here.

@mgehre-amd
Copy link
Collaborator Author

Is there an element-wise cast operator for tensors that would account for the unrealized casts? Besides, unless I'm mistaking, tensor reshaping should not depend on the element type, so I think I missed something here.

When converting from TOSA to linalg, we need to convert unsigned to signless integers. This is done via the type converted, but all RewritePatterns need to correctly use it to determine the destination types.
The one for tosa.reshape didn't do that, so it would create linalg IR with unsigned types.

The casts are unrealized casts because they are expected to fold away, and not be realized into actual operations like tensor.cast.

Copy link
Collaborator

@cferry-AMD cferry-AMD left a comment

Choose a reason for hiding this comment

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

This looks OK from a technical standpoint. I don't want my absence of knowledge of TOSA-to-{Linalg,Tensor} to block you for the rest.

@mgehre-amd mgehre-amd requested review from TinaAMD and removed request for josel-amd May 8, 2024 14:11
Copy link

@TinaAMD TinaAMD left a comment

Choose a reason for hiding this comment

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

LGTM

@mgehre-amd mgehre-amd enabled auto-merge (squash) May 8, 2024 14:44
@mgehre-amd mgehre-amd merged commit fa72e68 into feature/fused-ops May 8, 2024
3 checks passed
@mgehre-amd mgehre-amd deleted the matthias.reshape_uint8 branch May 8, 2024 14:53
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.

3 participants