[AOT] Problem in microTVM (uTVM) host driven application

I am building a model using the AoT executor and the CRT runtime, trying to run the model in a host driven manner, because I want to compare it with the Graph executor (I noticed @alanmacd added this to the CRT runtime, so perhaps he can give me a hint).

What I am doing is the following:

RUNTIME = tvm.relay.backend.Runtime("crt", {"system-lib": True})
TARGET = tvm.target.target.Target({"kind": "c", "link-params": True})
if executor == "aot":
    EXECUTOR = tvm.relay.backend.Executor("aot",options={'interface-api': 'c','unpacked-api': 1})
elif executor == "graph":
    EXECUTOR = tvm.relay.backend.Executor("graph")
with tvm.transform.PassContext(opt_level=3, disabled_pass=["AlterOpLayout"]):
    module = relay.build(mod, executor=EXECUTOR ,runtime=RUNTIME, target=TARGET, params=params)
with tvm.micro.Session(generated_project.transport()) as session:
    if executor == "graph":
        module_executor = tvm.micro.create_local_graph_executor(
            module.get_graph_json(), session.get_system_lib(), session.device
        module_executor = tvm.runtime.executor.aot_executor.AotModule(session.create_aot_executor())

When using the Graph executor, the model works fine. But when selecting the AoT executor, I get the following error:

[14:23:48] .../tvm/src/runtime/micro/micro_session.cc:368: remote: .../generated-project/src/standalone_crt/src/runtime/crt/aot_executor/aot_executor.c:81: Check failed: rv >= 0: cannot find 'predict_images:0' among input.
[14:23:48] .../tvm/src/runtime/micro/micro_session.cc:368: remote: TVMPlatformAbort: 0x00000500

I see this output when running the “with” clause:

[14:23:48] .../tvm/src/runtime/micro/micro_session.cc:368: remote: DumpMetadata:
[14:23:48] .../tvm/src/runtime/micro/micro_session.cc:368: remote:     mod_name=tvmgen_default
[14:23:48] .../tvm/src/runtime/micro/micro_session.cc:368: remote:     version=1
[14:23:48] .../tvm/src/runtime/micro/micro_session.cc:368: remote:     num_inputs=0
[14:23:48] .../tvm/src/runtime/micro/micro_session.cc:368: remote:     num_outputs=0
[14:23:48] .../tvm/src/runtime/micro/micro_session.cc:368: remote:     num_workspace_pools=0
[14:23:48] .../tvm/src/runtime/micro/micro_session.cc:368: remote:     num_constant_pools=0

So the question is:

  1. Am I using it correctly?
  2. Does the AoT executor change the name of the input of the model?
  3. Is there any step I am missing?

@fPecc I think when using the AOTExecutor via RPC you need to remove {'interface-api': 'c','unpacked-api': 1} from the Executor() definition. Could you give that a shot? Otherwise I don’t think the metadata will properly print. We should add a better assert around that, filed https://github.com/apache/tvm/issues/12060

Hi @areusch thanks for the answer!

Sadly, it did not work. Not matter which options I pass to the AoTExecutor, I always become an empty metadata.