This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch v0.6
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/v0.6 by this push:
     new 60c5e48  Fix Canonical Simplifier for v0.6 (#5509)
60c5e48 is described below

commit 60c5e485f873803b9bcf5811fd212968506391fd
Author: Yao Wang <kevinthesu...@gmail.com>
AuthorDate: Mon May 4 13:03:47 2020 -0700

    Fix Canonical Simplifier for v0.6 (#5509)
---
 src/arithmetic/canonical_simplify.cc                   | 1 +
 tests/python/unittest/test_arith_canonical_simplify.py | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/arithmetic/canonical_simplify.cc 
b/src/arithmetic/canonical_simplify.cc
index 1b576a6..2a05834 100644
--- a/src/arithmetic/canonical_simplify.cc
+++ b/src/arithmetic/canonical_simplify.cc
@@ -860,6 +860,7 @@ SplitModConst(SplitExpr lhs, int64_t cval, DivMode 
div_mode) {
           lhs->upper_factor != SplitExprNode::kPosInf) {
         auto updated = ToSplitExpr(Mutate(ModImpl(
             lhs->index, make_const(lhs.type(), new_upper_factor), div_mode)));
+        updated.CopyOnWrite()->scale = lhs->scale;
         // re-apply the lower_factor
         if (lhs->lower_factor != 1) {
           return SplitDivConst(updated, lhs->lower_factor, div_mode);
diff --git a/tests/python/unittest/test_arith_canonical_simplify.py 
b/tests/python/unittest/test_arith_canonical_simplify.py
index 28a4388..08038ff 100644
--- a/tests/python/unittest/test_arith_canonical_simplify.py
+++ b/tests/python/unittest/test_arith_canonical_simplify.py
@@ -123,7 +123,7 @@ def test_floormod_simplify():
     x, y = tvm.var("x"), tvm.var("y")
     ck.verify(flm(flm((x*4) + y  - 466036, 24528) - 24512,  16),
               flm((x*4) + y  + 12, 16))
-
+    ck.verify(flm(flm((x*4), 16), 8), flm(x, 2) * 4)
 
 
 def test_canonical_mixed():

Reply via email to