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 with a value outside the valid range.
This appears to be missing dtype validation in TOPI for floating-point–only math intrinsics.
Environment
tvm: v0.22-dev
Steps to reproduce
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
Actual behavior
Calling
opi.acoswith an integer-typed input tensor (e.g. int16) leads to atvm.error.InternalErrorduring 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 with a value outside the valid range.
This appears to be missing dtype validation in TOPI for floating-point–only math intrinsics.
Environment
tvm: v0.22-dev
Steps to reproduce
Triage