I tried a simple program:

```
import tvm
from tvm.ir.module import IRModule
from tvm.script import tir as T
import numpy as np

def foo(A):
    A[0] = 2.0

@T.prim_func
def main(a: T.handle):
    T.func_attr({"global_symbol": "main", "tir.noalias": True})
    A = T.match_buffer(a, (5,), "float32")
    tvm.tir.call_packed("foo", A)

if __name__ == "__main__":
    mod = IRModule.from_expr(main)
    f = tvm.build(mod, target="llvm")
    a = tvm.nd.array(np.array([1, 2, 3, 4, 5], dtype=np.float32), 
device=tvm.cpu())
    f(a)
    print(a.numpy())
```

But got the error:
```
error: Internal Error: function must be of type Intrin, ScopeHandler or 
SpecialStmt, but it is function
    |  
 13 |      tvm.tir.call_packed("foo", A)
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

Inlining `foo` manually instead of using `tvm.tir.call_packed` works.

Am I using `call_packed` incorrectly? Do I need to convert `A` to some other 
type before passing it?





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/provide-external-functions-as-tvmscript/18371/3)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/ef3372504af23b97c49a90d4bef95947d34e1e8ea827d89d307338a4dbba98bf).

Reply via email to