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

   ### Actual behavior
   
   Calling `opi.acos` with an integer-typed input tensor (e.g. int16) leads to 
a `tvm.error.InternalError` during LowerIntrin / IntrinInjecter in the TIR 
build pipeline.
   Instead of reporting a user-facing dtype validation error (or inserting an 
implicit cast), TVM crashes while constructing an IntImm<int16> with a value 
outside the valid range.
   
   This appears to be missing dtype validation in TOPI for floating-point–only 
math intrinsics.
   
   ### Environment
   tvm:
   
   ### Steps to reproduce
   ```python
   import tvm
   from tvm import te, topi, tir
   import numpy as np
   
   def model_func(x):
       return topi.acos(x)
   
   x = te.placeholder((1, 128, 256), dtype="int16", name="x")
   out = model_func(x)
   
   func = te.create_prim_func([x, out]).with_attr(
       "target", tvm.target.Target("llvm")
   )
   
   sch = tir.Schedule(func)
   np_input = np.random.uniform(-1, 1, size=(1, 128, 256)).astype("int16")
   with tvm.transform.PassContext(opt_level=0):
       mod = tvm.build(sch.mod, target="llvm")
   
   ```
   
   ### Triage
   * lowering
   * TOPI
   * 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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to