[GraphExecutor] Question about the usage of link-params

Hi,

I just have a quick question: I am using the GraphExecutor to build a model with TVM, and generating C code. When I use the AOTExecutor and I set link-params = True, I can see the parameters in the generated C files, and they are being compiled together with the code. When I set link-params = True in the GraphExecutor, I dont see the parameters in the generated C code.

This is for a host-driven project, where the parameters are just to large to send them every time from the host. I need them to be statically linked.

Thanks!

How are you building your model? Are you creating the Executor parameter to tvm.relay.build, or are you adding the link-params flag to target?

Hi @kparzysz,

I am adding the Executor parameter to tvm.relay.build, like this:

...
RUNTIME = tvm.relay.backend.Runtime("crt", {"system-lib": True})
TARGET = tvm.target.target.Target({"kind": "c"})
EXECUTOR = tvm.relay.backend.Executor("graph",{"link-params": True})
...
module = tvm.relay.build(mod, executor=EXECUTOR, runtime=RUNTIME, target=TARGET,params=params)
...

Hi @kparzysz ,

I noticed the problem. It has to do with a change I made in the FuseOps pass, in order to try to solve this issue (see last comment to see my change). If I go back that change i can see the params being statically linked, but of course I still have the problem addressed in that issue.

I also opened a Github issue for that bug, perhaps the expert @areusch has an idea regarding what could cause that problem :wink:

1 Like