Hi all, I'm a new user of TVM and am learning TIR. Now I want to define my own 
operator using TIR interface, which means I'd create a `PrimFunc` at the top 
level, initialize an `IRModule` from it and build this `IRModule`. 

The problem is that I also want to define multiple `PrimFunc`s called by the 
top-level `PrimFunc`, but I could not. I know I may simply put all things into 
one `PrimFunc`, but I just want to know whether cross-function call is possible.

The following minimal working example demonstrate my purpose:

```python
A = te.var('A')
B = te.var('B')

callee = tir.PrimFunc([A, B], tir.Evaluate(tir.Add(A, B)))
callee = callee.with_attr('global_symbol', 'callee')

main = tir.PrimFunc([A, B], tir.Evaluate(tir.Call('int32', callee, [A, B])))
# OR main = tir.PrimFunc([A, B], tir.Evaluate(tir.Call('int32', 
GlobalVar('callee'), [A, B])))
main = main.with_attr("global_symbol", "main")
main = main.with_attr("tir.noalias", True)

mod = tvm.IRModule({"main": main, "callee": callee})
tvm.build(mod)
```





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/does-tir-support-cross-function-call/10338/1)
 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/47a9d61c9be861cb83ab5a847f28d7a3d662f54bb4e7118160222d7ebd9db1b2).

Reply via email to