syang-ng opened a new pull request #8983:
URL: https://github.com/apache/tvm/pull/8983


   Similar to the bug reported in [PR 
8961](https://github.com/apache/tvm/pull/8961), I find there are other three 
divisions in  
[src/arith/rewrite_simplify.cc](https://github.com/apache/tvm/blob/main/src/arith/rewrite_simplify.cc)
 also don't check whether the divisor is 0.
   
   ## Bug Description
   
   Each line of  `rewrite_simplify` can trigger the segmentation fault error.
   
   ```python
   import tvm
   
   analyzer = tvm.arith.Analyzer()
   # mod
   analyzer.rewrite_simplify(tvm.tir.Mod(tvm.tir.Ramp(1,1,2), 
tvm.tir.Broadcast(0, 2)))
   # floordiv
   analyzer.rewrite_simplify(tvm.tir.FloorDiv(tvm.tir.Ramp(1,1,2), 
tvm.tir.Broadcast(0, 2)))
   # floormod
   analyzer.rewrite_simplify(tvm.tir.FloorMod(tvm.tir.Ramp(1,1,2), 
tvm.tir.Broadcast(0, 2)))
   ```
   
   
   To fix these errors, I add three zero checks in operator `mod`, `floordiv`, 
`floormod`. And I hope there will be no division by zero errors elsewhere :-)


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


Reply via email to