mulanxiaodingdang opened a new issue, #18146:
URL: https://github.com/apache/tvm/issues/18146
The error message is as follows:
>
(base) hgs@hgs:~/tvm_25_06/tvm/my_example$ g++ -std=c++17 -O2 -fPIC
-I/home/hgs/tvm_25_06/tvm/include
-I/home/hgs/tvm_25_06/tvm/3rdparty/dmlc-core/include
-I/home/hgs/tvm_25_06/tvm/3rdparty/dlpack/include
-DDMLC_USE_LOGGING_LIBRARY=\<tvm/runtime/logging.h\> -o lib/compiled_artifact
cc_deploy.cc lib/test_addone_sys.o lib/libtvm_runtime_pack.o
-L/home/hgs/tvm_25_06/tvm/tvm_build -ldl -pthread
cc_deploy.cc:12:21: error: ‘PackedFunc’ has not been declared in
‘tvm::runtime’
12 | using tvm::runtime::PackedFunc; // 打包函数接口
| ^~~~~~~~~~
cc_deploy.cc: In function ‘int main()’:
cc_deploy.cc:26:5: error: ‘PackedFunc’ was not declared in this scope
26 | PackedFunc vm_load_executable =
mod.GetFunction("vm_load_executable");
| ^~~~~~~~~~
In file included from
/home/hgs/tvm_25_06/tvm/3rdparty/dmlc-core/include/dmlc/./logging.h:132,
from
/home/hgs/tvm_25_06/tvm/3rdparty/dmlc-core/include/dmlc/io.h:15,
from
/home/hgs/tvm_25_06/tvm/include/tvm/runtime/module.h:29,
from
/home/hgs/tvm_25_06/tvm/include/tvm/runtime/relax_vm/executable.h:27,
from cc_deploy.cc:3:
cc_deploy.cc:28:11: error: ‘vm_load_executable’ was not declared in this
scope
28 | CHECK(vm_load_executable != nullptr)
| ^~~~~~~~~~~~~~~~~~
/home/hgs/tvm_25_06/tvm/include/tvm/runtime/logging.h:574:9: note: in
definition of macro ‘CHECK’
574 | if (!(x)) \
| ^
cc_deploy.cc:33:12: error: redeclaration of ‘tvm::runtime::Module mod’
33 | Module mod = vm_load_executable(); // 执行加载函数创建虚拟机模块
| ^~~
cc_deploy.cc:22:12: note: ‘tvm::runtime::Module mod’ previously declared here
22 | Module mod = Module::LoadFromFile(path); // 加载.so文件创建TVM模块
| ^~~
cc_deploy.cc:33:18: error: ‘vm_load_executable’ was not declared in this
scope
33 | Module mod = vm_load_executable(); // 执行加载函数创建虚拟机模块
| ^~~~~~~~~~~~~~~~~~
cc_deploy.cc:36:15: error: expected ‘;’ before ‘vm_initialization’
36 | PackedFunc vm_initialization =
mod.GetFunction("vm_initialization");
| ^~~~~~~~~~~~~~~~~~
| ;
cc_deploy.cc:41:11: error: ‘vm_initialization’ was not declared in this scope
41 | CHECK(vm_initialization != nullptr)
| ^~~~~~~~~~~~~~~~~
/home/hgs/tvm_25_06/tvm/include/tvm/runtime/logging.h:574:9: note: in
definition of macro ‘CHECK’
574 | if (!(x)) \
| ^
cc_deploy.cc:50:5: error: ‘vm_initialization’ was not declared in this scope
50 | vm_initialization(static_cast<int>(device.device_type),
| ^~~~~~~~~~~~~~~~~
cc_deploy.cc:57:15: error: expected ‘;’ before ‘main’
57 | PackedFunc main = mod.GetFunction("main");
| ^~~~~
| ;
cc_deploy.cc:73:40: error: too many arguments to function ‘int main()’
73 | tvm::runtime::NDArray output = main(input); // 运行模型
| ~~~~^~~~~~~
cc_deploy.cc:16:5: note: declared here
16 | int main()
| ^~~~
cc_deploy.cc:73:40: error: conversion from ‘int’ to non-scalar type
‘tvm::runtime::NDArray’ requested
73 | tvm::runtime::NDArray output = main(input); // 运行模型
| ~~~~^~~~~~~
The C++ deployment and the code for generating the .so file using TVM Relax
compilation come from this
link.[https://discuss.tvm.apache.org/t/deploy-relax-ir-using-c-api/17989](url)
What code should be used now to deploy a .so file compiled by TVM Relax
using C++?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]