You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "lhutton1 (via GitHub)" <gi...@apache.org> on 2023/03/08 10:40:42 UTC

[GitHub] [tvm] lhutton1 opened a new pull request, #14232: [TEST] Fix division by 0 in llvm codegen test

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

   In the test `test_llvm_div`, some cases can lead to a division by 0. Consider the case when `start=-12, end=-12, dstart=-2 and dend=0`, the range of values input to clipb() will be: [-12, ..., -1, 1] (with 1 being specially selected to prevent division by 0). For the input 1, clipb evaluates to: min(/*dend=*/0, max(/*dstart=*/-12, /*i=*/1)) = 0, thus leading to a division by 0.
   
   LLVM11, which runs in CI, doesn't seem to throw any kind of error, while using LLVM15 leads to a "floating point exception". Regardless, since division by 0 is undefined behaviour and the compiler can do anything, the solution here is to fix the test so division by 0 doesn't occur.


-- 
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] ashutosh-arm commented on a diff in pull request #14232: [TEST] Fix division by 0 in llvm codegen test

Posted by "ashutosh-arm (via GitHub)" <gi...@apache.org>.
ashutosh-arm commented on code in PR #14232:
URL: https://github.com/apache/tvm/pull/14232#discussion_r1129419945


##########
tests/python/unittest/test_target_codegen_llvm.py:
##########
@@ -534,7 +534,7 @@ def _show_info():
             (2, 2),
             (-11, 11),
         ]:
-            if end < start or dend < dstart or (dend == 0 and dstart == 0):

Review Comment:
   Thanks for the cross verification.



-- 
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 #14232: [TEST] Fix division by 0 in llvm codegen test

Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #14232:
URL: https://github.com/apache/tvm/pull/14232#issuecomment-1459965118

   <!---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 tag found in teams: `test` <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] lhutton1 commented on a diff in pull request #14232: [TEST] Fix division by 0 in llvm codegen test

Posted by "lhutton1 (via GitHub)" <gi...@apache.org>.
lhutton1 commented on code in PR #14232:
URL: https://github.com/apache/tvm/pull/14232#discussion_r1129405627


##########
tests/python/unittest/test_target_codegen_llvm.py:
##########
@@ -534,7 +534,7 @@ def _show_info():
             (2, 2),
             (-11, 11),
         ]:
-            if end < start or dend < dstart or (dend == 0 and dstart == 0):

Review Comment:
   This test seems to be checking for div by 0 at compile time due to the use of constants, in the case of `test_llvm_div`, the div by 0 occurs at runtime, so I don't think this is something we can check here 



-- 
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] junrushao merged pull request #14232: [TEST] Fix division by 0 in llvm codegen test

Posted by "junrushao (via GitHub)" <gi...@apache.org>.
junrushao merged PR #14232:
URL: https://github.com/apache/tvm/pull/14232


-- 
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] ashutosh-arm commented on a diff in pull request #14232: [TEST] Fix division by 0 in llvm codegen test

Posted by "ashutosh-arm (via GitHub)" <gi...@apache.org>.
ashutosh-arm commented on code in PR #14232:
URL: https://github.com/apache/tvm/pull/14232#discussion_r1129281636


##########
tests/python/unittest/test_target_codegen_llvm.py:
##########
@@ -534,7 +534,7 @@ def _show_info():
             (2, 2),
             (-11, 11),
         ]:
-            if end < start or dend < dstart or (dend == 0 and dstart == 0):

Review Comment:
   nit: could you please tally against https://github.com/apache/tvm/blob/902c2e2db70b75c36f9bd8c253707b1e8761cc18/tests/python/unittest/test_tir_nodes.py#L300 to check the divide by zero test case is covered there?



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