You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/10/14 14:04:38 UTC

[GitHub] [tvm] Lunderberg opened a new pull request, #13081: [TIR][Arith] Support negative coeff in ModularSet

Lunderberg opened a new pull request, #13081:
URL: https://github.com/apache/tvm/pull/13081

   Prior to this commit, any use of negative coefficients in `ModularSet` would result in an error.  This included cases where a constraint is being entered, such as `floormod(i, -2)==0` appearing as the condition of an if/else block.  These negative indices can also arise as intermediate simplification steps produced by `CanonicalSimplifier`, such as `floormod(-i,2)` being canonicalized to `floormod(i,-2)`.
   
   This commit adds support for negative coefficients in `ModularSet`, using the same sign convention as is used by `CanonicalSimplifier` for negative denominators, and adds unit tests to verify that sign convention.


-- 
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] Lunderberg commented on pull request #13081: [TIR][Arith] Support negative coeff in ModularSet

Posted by GitBox <gi...@apache.org>.
Lunderberg commented on PR #13081:
URL: https://github.com/apache/tvm/pull/13081#issuecomment-1279319828

   Rebasing onto main to get the bug fix from #13067


-- 
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] vinx13 commented on a diff in pull request #13081: [TIR][Arith] Support negative coeff in ModularSet

Posted by GitBox <gi...@apache.org>.
vinx13 commented on code in PR #13081:
URL: https://github.com/apache/tvm/pull/13081#discussion_r1001232247


##########
tests/python/unittest/test_arith_canonical_simplify.py:
##########
@@ -97,6 +97,8 @@ def test_split_index_simplify():
     # cannot simplify mixed case, unless we canonicalize into one mode.
     ck.verify(tdiv(x, 6) * 2 + tmod(fld(x, 3), 2), tdiv(x, 6) * 2 + tmod(fld(x, 3), 2))
 
+    ck.verify(tmod(-x, 2), tmod(x, -2) * -1)

Review Comment:
   does this cover modular set analysis?



-- 
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] Lunderberg commented on a diff in pull request #13081: [TIR][Arith] Support negative coeff in ModularSet

Posted by GitBox <gi...@apache.org>.
Lunderberg commented on code in PR #13081:
URL: https://github.com/apache/tvm/pull/13081#discussion_r1003498450


##########
tests/python/unittest/test_arith_canonical_simplify.py:
##########
@@ -97,6 +97,8 @@ def test_split_index_simplify():
     # cannot simplify mixed case, unless we canonicalize into one mode.
     ck.verify(tdiv(x, 6) * 2 + tmod(fld(x, 3), 2), tdiv(x, 6) * 2 + tmod(fld(x, 3), 2))
 
+    ck.verify(tmod(-x, 2), tmod(x, -2) * -1)

Review Comment:
   This test only covers the CanonicalSimplify behavior of negative indices, but the ModularSet's behavior should be consistent with the sign convention in CanonicalSimplify.  Since CanonicalSimplify's sign convention for negative indices wasn't checked by any test I could find, I wanted to add a test for its behavior.



-- 
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] Lunderberg commented on pull request #13081: [TIR][Arith] Support negative coeff in ModularSet

Posted by GitBox <gi...@apache.org>.
Lunderberg commented on PR #13081:
URL: https://github.com/apache/tvm/pull/13081#issuecomment-1279056794

   This was originally discovered in a failing unit test for https://github.com/apache/tvm/pull/13024.  An unrolled loop produced a `T.if_then_else(floormod(-i,2)==0, ...)`, which resulted in an error thrown from ModularSet.


-- 
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 #13081: [TIR][Arith] Support negative coeff in ModularSet

Posted by GitBox <gi...@apache.org>.
tvm-bot commented on PR #13081:
URL: https://github.com/apache/tvm/pull/13081#issuecomment-1279055176

   <!---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-->
    * cc @Hzfengsy, @junrushao <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] jwfromm merged pull request #13081: [TIR][Arith] Support negative coeff in ModularSet

Posted by GitBox <gi...@apache.org>.
jwfromm merged PR #13081:
URL: https://github.com/apache/tvm/pull/13081


-- 
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