# \[Solved\] Cannot use \`sqrt\`, 'exp', etc. in TIR

**URL:** <https://discuss.tvm.apache.org/t/solved-cannot-use-sqrt-exp-etc-in-tir/11081>\
**Category:** Troubleshooting\
**Created:** [September 20, 2021, 2:07am UTC](https://discuss.tvm.apache.org/t/solved-cannot-use-sqrt-exp-etc-in-tir/11081 "2021-09-20T02:07:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ganler](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/ganler/32/2795_2.png) [@ganler](https://discuss.tvm.apache.org/u/ganler)\
**Post date:** [September 20, 2021, 2:07am UTC](https://discuss.tvm.apache.org/t/solved-cannot-use-sqrt-exp-etc-in-tir/11081/1 "2021-09-20T02:07:59Z")

</div>

I was trying to build a TIR with operators like `tir.exp`, but it says “Check failed: (f) is false: Cannot find intrinsic declaration, possible type mismatch: llvm.exp”. However, I do found that TVM has modeled such operators for LLVM ([https://github.com/apache/tvm/blob/main/src/target/llvm/intrin\_rule\_llvm.cc#L40](https://github.com/apache/tvm/blob/main/src/target/llvm/intrin_rule_llvm.cc#L40)). Can anyone help with this? Many thanks.

To reproduce

```python
from tvm import tir
import tvm

a = tir.Var('a', dtype='int32') # [Solved Thx to @masahi] type should be float

# some simple tir function
f = tir.PrimFunc([a], tir.Evaluate(tir.ret(tir.exp(a))))

# compile the function
tvm.build(f)
"""
---------------------------------------------------------------
An error occurred during the execution of TVM.
For more information, please see: https://tvm.apache.org/docs/errors.html
---------------------------------------------------------------
  Check failed: (f) is false: Cannot find intrinsic declaration, possible type mismatch: llvm.exp
"""

```

---

<div class="post-metadata">

**Author:** ![masahi](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/masahi/32/74_2.png) [@masahi](https://discuss.tvm.apache.org/u/masahi)\
**Post date:** [September 20, 2021, 2:22am UTC](https://discuss.tvm.apache.org/t/solved-cannot-use-sqrt-exp-etc-in-tir/11081/2 "2021-09-20T02:22:17Z")

</div>

Maybe `a` is not floating point?

---

<div class="post-metadata">

**Author:** ![ganler](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/ganler/32/2795_2.png) [@ganler](https://discuss.tvm.apache.org/u/ganler)\
**Post date:** [September 20, 2021, 2:46am UTC](https://discuss.tvm.apache.org/t/solved-cannot-use-sqrt-exp-etc-in-tir/11081/3 "2021-09-20T02:46:36Z")

</div>

@masahi Thank you. You are right. I should apply a casting node to work this around.
