Why tvm.relay.transform needs to looking for "main" symbol?

I have the input of subgraph relay under BYOC mode.

However, I noticed that I cannot use any useful APIs under tvm.relay.transform namespace, since the later always looking for “main” symbol.

In my input subgraph, I only got the symbol like the customized accelerator name, e.g. “acc_xx”.

I am wondering the necessarity behind why tvm.relay.transform passes all need to look for “main” symbol and it there any work-around in my case, like maybe inserting a “main” into my relay subgraph?

main is the official entry point of a module so it’s reasonable to look for it as the starting point. I’m not sure what’s your purpose, tho. If you want to apply some passes to your subgraph function, the most straightward way is

mod = IRModule()
mod["main"] = subgraph
mod = transform.XX()(mod)
subgraph = mod["main"]
1 Like