Hi all,
TVM version: v0.15.0 Built on: Ubuntu 18.0.4.
I’m currently trying to manually compile and run a simple TVM example from a TVM module stored in model library format (MLF). I’ve produced the model library format for an example with the following settings:
target = tvm.micro.testing.get_target(platform=“crt”, board=None)
runtime = tvm.relay.backend.Runtime(“crt”, {“system-lib”: True})
executor = tvm.relay.backend.Executor( “aot”, {“unpacked-api”: True, “interface-api”: “c”} )
with tvm.transform.PassContext( opt_level=3, config={“tir.disable_vectorize”: True}, ): module = tvm.relay.build( relay_mod, target=target, runtime=runtime, executor=executor, params=params )
tvm.micro.export_model_library_format(module, “test.tar”)
I’ve had no problems building and integrating the TVM runtime in the MLF file into my build. However, when I try to include the headers and code from the codegen into my build, I find multiple conflicting definitions of the tvmgen_default_run function (among others) are defined in the same files:
[ 93%] Building C object CMakeFiles/tvm_demo.dir/tvm/codegen/host/src/default_lib0.c.o
In file included from /path/to/tvm/codegen/host/src/default_lib0.c:436789:
/path/to/tvm/codegen/host/include/tvmgen_default.h:36:9: error: conflicting types for ‘tvmgen_default_run’; have ‘int32_t(struct tvmgen_default_inputs *, struct tvmgen_default_outputs *)’ {aka ‘int(struct tvmgen_default_inputs *, struct tvmgen_default_outputs *)’}
36 | int32_t tvmgen_default_run(
| ^~~~~~~~~~~~~~~~~~
/path/to/tvm/codegen/host/src/default_lib0.c:5:17: note: previous declaration of ‘tvmgen_default_run’ with type ‘int32_t(TVMValue *, int *, int, TVMValue *, int *, void *)’ {aka 'int(TVMValue , int , int, TVMValue , int , void )’}
5 | TVM_DLL int32_t tvmgen_default_run(TVMValue args, int type_code, int num_args, TVMValue out_value, int out_type_code, void resource_handle);
| ^~~~~~~~~~~~~~~~~~
/path/to/tvm/codegen/host/src/default_lib0.c:436790:17: error: conflicting types for ‘tvmgen_default___tvm_main__’; have ‘int32_t(void *, void *, uint8_t *, uint8_t *)’ {aka 'int(void , void , unsigned char , unsigned char )’}
436790 | TVM_DLL int32_t tvmgen_default___tvm_main__(void input0,void output0,uint8_t global_const_workspace_0_var,uint8_t global_workspace_1_var);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/path/to/tvm/codegen/host/src/default_lib0.c:317:17: note: previous declaration of ‘tvmgen_default___tvm_main__’ with type ‘int32_t(TVMValue *, int *, int, TVMValue *, int *, void *)’ {aka 'int(TVMValue , int , int, TVMValue , int , void )’}
317 | TVM_DLL int32_t tvmgen_default___tvm_main__(TVMValue args, int type_code, int num_args, TVMValue out_value, int out_type_code, void resource_handle);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/path/to/tvm/codegen/host/src/default_lib0.c:436791:9: error: conflicting types for ‘tvmgen_default_run’; have 'int32_t(struct tvmgen_default_inputs , struct tvmgen_default_outputs )’ {aka 'int(struct tvmgen_default_inputs , struct tvmgen_default_outputs )’}
436791 | int32_t tvmgen_default_run(struct tvmgen_default_inputs inputs,struct tvmgen_default_outputs outputs) {return tvmgen_default___tvm_main__(inputs->input0,outputs->output,((uint8_t)&global_const_workspace),((uint8_t)&global_workspace));
| ^~~~~~~~~~~~~~~~~~
/path/to/tvm/codegen/host/src/default_lib0.c:5:17: note: previous declaration of ‘tvmgen_default_run’ with type ‘int32_t(TVMValue *, int *, int, TVMValue *, int *, void *)’ {aka 'int(TVMValue , int , int, TVMValue , int , void )’}
5 | TVM_DLL int32_t tvmgen_default_run(TVMValue args, int type_code, int num_args, TVMValue out_value, int out_type_code, void resource_handle);
| ^~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/tvm_demo.dir/build.make:90: CMakeFiles/tvm_demo.dir/tvm/codegen/host/src/default_lib0.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:121: CMakeFiles/tvm_demo.dir/all] Error 2
Any suggestions for how to fix or work around this problem?
Thanks.