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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]