blufissure opened a new issue, #14910:
URL: https://github.com/apache/tvm/issues/14910

   Recently I have found a AE error that TVM didn't return the correct value. 
It's known that the division function x/y, TVM checks the valaue of y. If y is 
zero, TVM will throw the exception. I found a bug that when I used the call 
function, such as **tir.Call** and **tir.call_intrin** with the function that 
returned the boolean type and casted the value, the value was 0 if the boolean 
type was False and 1 instead. When I set the "casted" zero as the parameter of 
the division, TVM return zero rather than threwing the exception.  I'm curious 
about the reason, it seems like a float point exception but I'm not sure.
   
   ### Expected behavior
   
   TVM throw exception
   
   ### Actual behavior
   
   Returned zero
   
   ### Environment
   
   Ubuntu 18.04, TVM 0.10dev0, the git is 
ee319d9d23c80091da9c4fb764b1e6d49d462714
   
   ### Steps to reproduce
   ```
   import tvm
   from tvm import tir
   a=tir.call_intrin('float32','tir.isinf',tir.const(15.0,'float32'))
   inf1=tir.Cast('uint32',a)
   print(inf1.dtype)
   fl1=tir.Div(tir.const(10000,'uint32'),inf1)
   f=tir.PrimFunc({},tir.Evaluate(tir.ret(fl1)))
   mod1=tvm.build(f)
   print(mod1())
   
   b=tir.call_intrin('float32','tir.isnan',tir.const(15.0,'float32'))
   nan1=tir.Cast('int32',a)
   fl2=tir.FloorDiv(tir.const(10000,'int32'),nan1)
   func=tir.PrimFunc({},tir.Evaluate(tir.ret(fl2)))
   mod2=tvm.build(func)
   print(mod2())
   ```
   
   ### Triage
   * tir
   
   * needs-triage
   


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