-
Notifications
You must be signed in to change notification settings - Fork 615
[TOSA] Retag resource literals to signless constants #4367
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
base: main
Are you sure you want to change the base?
Conversation
Lallapallooza
commented
Nov 5, 2025
- Extend ValueTensorLiteral lowering so DenseResourceElementsAttr integers are rebuilt with signless element types before emitting tosa.const, matching the converted tensor type.
- Add lit coverage for resource-backed i32/i64 vtensor literals.
- Add FX importer e2e tests that return constant int32/int64 tensors.
- Extend ValueTensorLiteral lowering so DenseResourceElementsAttr integers are rebuilt with signless element types before emitting tosa.const, matching the converted tensor type. - Add lit coverage for resource-backed i32/i64 vtensor literals. - Add FX importer e2e tests that return constant int32/int64 tensors. Change-Id: I2fecd474c9516b868cd5184f00d4998cf44661d5
a58c1ce to
640d4c6
Compare
| attr = DenseResourceElementsAttr::get(newTy, res.getRawHandle()); | ||
| } | ||
| } | ||
| rewriter.replaceOpWithNewOp<tosa::ConstOp>(op, outputTy, attr); |
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.
Small: these two lines could be removed and the same call would be make from rewriter.replaceOpWithNewOptosa::ConstOp on line 3020.
|
Other than the above small nit this looks good to me. Reviewed. |
sahas3
left a comment
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.
LGTM.
| if (auto intTy = dyn_cast<IntegerType>(shapedAttrTy.getElementType())) { | ||
| auto signlessTy = | ||
| IntegerType::get(rewriter.getContext(), intTy.getWidth()); | ||
| if (intTy != signlessTy) { |
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.
Suggestion: You can check !intTy.isSignless() and then create the signedless type here instead of creating signedless type always and comparing.