-
Notifications
You must be signed in to change notification settings - Fork 636
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
[vmvx] Relax requirement on fptosi lowering #11553
Conversation
auto resultType = getTypeConverter()->convertType(dstType); | ||
// This uses the resultType rather than dstType as any truncation | ||
// required will be handled via interpretation by consumer. | ||
if (resultType.isSignlessInteger(32) || resultType.isSignedInteger(32)) { | ||
rewriter.replaceOpWithNewOp<IREE::VM::CastF32SI32Op>( | ||
srcOp, resultType, adaptor.getOperands()[0]); |
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.
since you're touching the code around this area, could you also update adaptor.getOperands()[0]
to adaptor.getIn()
?
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.
I was referring l.935, but it's still good that you fix the other part..
auto resultType = getTypeConverter()->convertType(dstType); | ||
// This uses the resultType rather than dstType as any truncation | ||
// required will be handled via interpretation by consumer. | ||
if (resultType.isSignlessInteger(32) || resultType.isSignedInteger(32)) { | ||
rewriter.replaceOpWithNewOp<IREE::VM::CastF32SI32Op>( | ||
srcOp, resultType, adaptor.getOperands()[0]); |
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.
I was referring l.935, but it's still good that you fix the other part..
// CHECK: vm.cast.f32.si32 %[[ARG0]] : f32 -> i32 | ||
%1 = arith.fptosi %arg0 : f32 to i8 | ||
return %1 : i8 |
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.
Are there other IRs that truncate i32 to i8? If so, should we check it as well?
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.
We checked the integer ones yesterday (8a3d270). At least for those individually the result wrt llvm and vmvx was the same.
The consumption of si of small width is already handled successfully by consumers of this op. This was not true for the ui version - although I suspect consumer op there, but keeping it more restricted until checked.
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, thanks!
This reverts commit cee9b3c.
This reverts commit cee9b3c.
The consumption of si of small width is already handled successfully by
consumers of this op (at least in limited trial). This was not true for the ui version ---although I suspect consumer op there, but keeping it more restricted until
checked.