AndrewZhaoLuo commented on code in PR #13056:
URL: https://github.com/apache/tvm/pull/13056#discussion_r993938350
##########
src/relay/transforms/simplify_expr.cc:
##########
@@ -146,7 +146,7 @@ class SimplifyConsecutiveCast : public DFPatternRewrite {
// BFloat cast cannot be omitted
return false;
}
- if (origin.code() < cast.code()) {
+ if (origin.code() < cast.code() && origin.bits() <= cast.bits()) {
Review Comment:
Hmm, Reading the comment of hierarchy int --> uint --> float does not make
sense to me as uint can not represent negative numbers so it should be lowest
on hiearchy in a sense.
I think this simplification pass is a bit hacky or at least it's assumptions
are not super clear. int --> uint hierarchy makes sense as long as we assume
all uint casts are done on int types we know are only positive, or the cast
clips negatives values to 0 and that is what we want.
Not sure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]