We’re trying to use the example app “howto_deploy” on the RPI4b (8GB RAM). TVM libraries build correctly and the environment is set up properly (as far as I know). Here’s the error that the script displays after successfully running the prepare_test_libs.py program:
Run the example
Run the deployment with all in one packed library…
[14:07:53] cpp_deploy.cc:77: Verify dynamic loading from test_addone_dll.so
[14:07:53] cpp_deploy.cc:69: Finish verification…
[14:07:53] cpp_deploy.cc:81: Verify load function from system lib
terminate called after throwing an instance of ‘tvm::runtime::InternalError’
what(): [14:07:53] cpp_deploy.cc:34: InternalError: Check failed: (f != nullptr) is false:
This same thing happens on MacOS (x64 and arm64). Is there a simple fix to get past this error?
The reason is that currently TVM implicitly identifies a module as “system-lib” according to whether it has the attribute system_lib_prefix. If not, the function used to register the symbols TVMBackendRegisterSystemLibSymbol won’t be included in the compiled library (“test_addone_sys.o”).
So a direct solution is to explicitly set the attribute to the IRModule lowered from te.Schedule, before the codegen process.
Hope this could help and more elegant solutions could be provided.
I tried that change to the prepare_test_libs.py, but it didn’t fix the problem. The error changed slightly:
Run the example
Run the deployment with all in one packed library…
[08:38:00] cpp_deploy.cc:77: Verify dynamic loading from test_addone_dll.so
[08:38:00] cpp_deploy.cc:69: Finish verification…
[08:38:00] cpp_deploy.cc:81: Verify load function from system lib
terminate called after throwing an instance of ‘tvm::runtime::InternalError’
what(): [08:38:00] cpp_deploy.cc:34: InternalError: Check failed: (f != nullptr) is false:
Stack trace:
[bt] (0) lib/cpp_deploy_pack(+0x13c4c) [0x5559233c4c]
[bt] (1) lib/cpp_deploy_pack(+0xdca4) [0x555922dca4]
[bt] (2) lib/cpp_deploy_pack(+0xb5b8) [0x555922b5b8]
[bt] (3) lib/cpp_deploy_pack(+0xba44) [0x555922ba44]
[bt] (4) lib/cpp_deploy_pack(+0xbd98) [0x555922bd98]
[bt] (5) lib/cpp_deploy_pack(+0x75dc) [0x55592275dc]
[bt] (6) /lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0xe8) [0x7f97bc9e18]
[bt] (7) lib/cpp_deploy_pack(+0xb3e8) [0x555922b3e8]
./run_example.sh: line 26: 1762 Aborted lib/cpp_deploy_pack
Run the cpp deployment with all in normal library…
[08:38:00] cpp_deploy.cc:77: Verify dynamic loading from test_addone_dll.so
[08:38:00] cpp_deploy.cc:69: Finish verification…
[08:38:00] cpp_deploy.cc:81: Verify load function from system lib
terminate called after throwing an instance of ‘tvm::runtime::InternalError’
what(): [08:38:00] cpp_deploy.cc:34: InternalError: Check failed: (f != nullptr) is false:
Stack trace:
0: _ZN3tvm7runtime6deta
1: Verify(tvm::runtime::Module, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)
2: DeploySingleOp()
3: main
4: 0x000000557ec83907
I have no more ideas about RPI4. The codegen workflow should be almost the same on RPI4 and MAC with LLVM. Did you try the target tvm.target.arm_cpu("rasp4b") or tvm.target.arm_cpu("rasp4b64")?