syang-ng opened a new pull request #8961: URL: https://github.com/apache/tvm/pull/8961
## Bug Description I found there will be a segfault when we try to use `rewrite_simplify` to simplify div expr whose dividend and divisor are `Ramp` and `Broadcast` respectively. Here is the code to trigger the segmentation fault error. ```python import tvm analyzer = tvm.arith.Analyzer() analyzer.rewrite_simplify(tvm.tir.Div(tvm.tir.Ramp(1,1,2), tvm.tir.Broadcast(0, 2))) ``` ```shell (tvm-build) ➜ ~ python test_div_zero.py [1] 44116 floating point exception (core dumped) python test_div_zero.py ``` ## Bug Analysis The root cause of this bug is that two numbers are divided directly in [src/arith/rewrite_simplify.cc, Line 477](https://github.com/apache/tvm/blob/main/src/arith/rewrite_simplify.cc#L477).  Thus, I add a zero check in `src/arith/rewrite_simplify.cc` to prevent division by 0 in this commit. I also add a test case in `tests/python/unittest/test_arith_rewrite_simplify.py` to cover this problem. -- 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]
