You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "wrongtest-intellif (via GitHub)" <gi...@apache.org> on 2023/01/31 04:06:33 UTC
[GitHub] [tvm] wrongtest-intellif opened a new pull request, #13880: support floordiv in deduce bound
wrongtest-intellif opened a new pull request, #13880:
URL: https://github.com/apache/tvm/pull/13880
Hi, the patch handle floordiv `a // positive` in bound deducer. So that we could know `x >= 24` in `x // 8 >= 3`
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] wrongtest-intellif commented on a diff in pull request #13880: [ARITH] support floordiv in deduce bound
Posted by "wrongtest-intellif (via GitHub)" <gi...@apache.org>.
wrongtest-intellif commented on code in PR #13880:
URL: https://github.com/apache/tvm/pull/13880#discussion_r1091452355
##########
tests/python/unittest/test_arith_deduce_bound.py:
##########
@@ -233,5 +232,39 @@ def test_non_support(lhs):
test_non_support(tvm.tir.BufferLoad(decl_buffer([16], "int32"), [a]))
+def test_deduce_floordiv():
+ def do_test(gen_expr, dom_map, expect_min, expect_max):
+ a = te.var("a")
+ expr = gen_expr(a)
+ res = tvm.arith.deduce_bound(a, expr, dom_map, dom_map)
+ if isinstance(expect_min, str):
+ assert str(res.min_value) == expect_min
+ else:
+ tvm.testing.assert_prim_expr_equal(res.min_value, expect_min)
+ if isinstance(expect_max, str):
+ assert str(res.max_value) == expect_max
+ else:
+ tvm.testing.assert_prim_expr_equal(res.max_value, expect_max)
+
+ # test basic cases
+ do_test(lambda a: a // 8 > 3, {}, 32, "pos_inf")
+ do_test(lambda a: a // 8 >= 3, {}, 24, "pos_inf")
+ do_test(lambda a: a // 8 < 3, {}, "neg_inf", 23)
+ do_test(lambda a: a // 8 <= 3, {}, "neg_inf", 31)
+ do_test(lambda a: a // 8 == 3, {}, "pos_inf", "neg_inf")
+ do_test(lambda a: a // 8 > -3, {}, -16, "pos_inf")
+ do_test(lambda a: a // 8 >= -3, {}, -24, "pos_inf")
+ do_test(lambda a: a // -8 > 3, {}, "pos_inf", "neg_inf")
Review Comment:
I think it is not hard to cover negative divisors. But for EQ some changes seems have to be made across all op impls, currently the detector only maintain single side states.
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] Hzfengsy commented on a diff in pull request #13880: support floordiv in deduce bound
Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy commented on code in PR #13880:
URL: https://github.com/apache/tvm/pull/13880#discussion_r1091435527
##########
tests/python/unittest/test_arith_deduce_bound.py:
##########
@@ -233,5 +232,39 @@ def test_non_support(lhs):
test_non_support(tvm.tir.BufferLoad(decl_buffer([16], "int32"), [a]))
+def test_deduce_floordiv():
+ def do_test(gen_expr, dom_map, expect_min, expect_max):
+ a = te.var("a")
+ expr = gen_expr(a)
+ res = tvm.arith.deduce_bound(a, expr, dom_map, dom_map)
+ if isinstance(expect_min, str):
+ assert str(res.min_value) == expect_min
+ else:
+ tvm.testing.assert_prim_expr_equal(res.min_value, expect_min)
+ if isinstance(expect_max, str):
+ assert str(res.max_value) == expect_max
+ else:
+ tvm.testing.assert_prim_expr_equal(res.max_value, expect_max)
+
+ # test basic cases
+ do_test(lambda a: a // 8 > 3, {}, 32, "pos_inf")
+ do_test(lambda a: a // 8 >= 3, {}, 24, "pos_inf")
+ do_test(lambda a: a // 8 < 3, {}, "neg_inf", 23)
+ do_test(lambda a: a // 8 <= 3, {}, "neg_inf", 31)
+ do_test(lambda a: a // 8 == 3, {}, "pos_inf", "neg_inf")
+ do_test(lambda a: a // 8 > -3, {}, -16, "pos_inf")
+ do_test(lambda a: a // 8 >= -3, {}, -24, "pos_inf")
+ do_test(lambda a: a // -8 > 3, {}, "pos_inf", "neg_inf")
Review Comment:
I wonder how hard to support these two cases, is it easy to have a quick patch to this PR?
`a // 8 == 3` and `a // -8 > 3`
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] tvm-bot commented on pull request #13880: support floordiv in deduce bound
Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #13880:
URL: https://github.com/apache/tvm/pull/13880#issuecomment-1409722839
<!---bot-comment-->
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
<!--bot-comment-ccs-start-->
* No users to auto-tag found, no teams are specified in PR title <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
<sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] wrongtest-intellif merged pull request #13880: [ARITH] support floordiv in deduce bound
Posted by "wrongtest-intellif (via GitHub)" <gi...@apache.org>.
wrongtest-intellif merged PR #13880:
URL: https://github.com/apache/tvm/pull/13880
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org