wrongtest commented on a change in pull request #9941:
URL: https://github.com/apache/tvm/pull/9941#discussion_r787265041
##########
File path: src/arith/rewrite_simplify.cc
##########
@@ -153,6 +153,16 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const
AddNode* op) {
TVM_TRY_REWRITE(max(x, y - z) + z, max(x + z, y));
TVM_TRY_REWRITE(max(x - z, y) + z, max(x, y + z));
+ TVM_TRY_REWRITE(min(c1, x - c2) + c3, min(c1 + c3, x + (c3 - c2)));
Review comment:
Background: after process region only use `canonical_simplify` and
intersect with buffer shape bound, the region max to compare now are (after
https://github.com/apache/tvm/pull/9880). The issue is to cancel `hh_0*8` in
min.
- `min(0, ((hh_0*8) - 215)) + 223)`
- `min(((hh_0*8) + 9), 224) - 1)`
My thought for the rule is it would do reduce the expression depth, because
`c1`, `c2`, `c3` are `PVar<IntImm>` and get immediately folded. Other possible
rule replacements I can imagine could be:
- (make min to a "canonical" form) `min(c1, x-c2)` => `min(0, x-(c1+c2)) +
c1`
- (specifically match things to cancel) `min(c1, x-c2) - min(c3, x-c4)` =>
c4-c2 if c1+c2=c3+c4
--
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]