zhaiyi000 opened a new issue #9268:
URL: https://github.com/apache/tvm/issues/9268


   Environment: MacBook Pro (15-inch, 2017), iPhone 12
   
   I followed this tutorial, 
https://github.com/apache/tvm/tree/main/apps/ios_rpc, but an error was reported 
when the dynamic library was loaded on the iPhone.
   
   
   ```
   (py38) zy@diyideMacBook-Pro ios_rpc % python3 tests/ios_rpc_test.py --host 
'0.0.0.0' --port 9090 --mode "proxy"
   [14:18:44] /Users/zy/Desktop/tvm/src/target/opt/build_metal_off.cc:31: 
Warning: Metal runtime not enabled, return a source module...
   Traceback (most recent call last):
     File "tests/ios_rpc_test.py", line 115, in <module>
       test_rpc_module(args.host, args.port, args.key, args.mode)
     File "tests/ios_rpc_test.py", line 78, in test_rpc_module
       f1 = remote.load_module("dev_lib.dylib")
     File "/Users/zy/Desktop/tvm/python/tvm/rpc/client.py", line 161, in 
load_module
       return _ffi_api.LoadRemoteModule(self._sess, path)
     File "/Users/zy/Desktop/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 
237, in __call__
       raise get_last_ffi_error()
   tvm.error.RPCError: Traceback (most recent call last):
     [bt] (8) 9   libtvm.dylib                        0x000000011a8db511 
tvm::runtime::RPCWrappedFunc::operator()(tvm::runtime::TVMArgs, 
tvm::runtime::TVMRetValue*) const + 1521
     [bt] (7) 8   libtvm.dylib                        0x000000011a8d3f4c 
tvm::runtime::RPCClientSession::CallFunc(void*, TVMValue const*, int const*, 
int, std::__1::function<void (tvm::runtime::TVMArgs)> const&) + 124
     [bt] (6) 7   libtvm.dylib                        0x000000011a8cc05d 
tvm::runtime::RPCEndpoint::CallFunc(void*, TVMValue const*, int const*, int, 
std::__1::function<void (tvm::runtime::TVMArgs)>) + 333
     [bt] (5) 6   libtvm.dylib                        0x000000011a8ca92e 
tvm::runtime::RPCEndpoint::HandleUntilReturnEvent(bool, std::__1::function<void 
(tvm::runtime::TVMArgs)>) + 622
     [bt] (4) 5   libtvm.dylib                        0x000000011a8cabce 
tvm::runtime::RPCEndpoint::EventHandler::HandleNextEvent(bool, bool, 
std::__1::function<void (tvm::runtime::TVMArgs)>) + 494
     [bt] (3) 4   libtvm.dylib                        0x000000011a8cec42 
tvm::runtime::RPCEndpoint::EventHandler::HandleProcessPacket(std::__1::function<void
 (tvm::runtime::TVMArgs)>) + 386
     [bt] (2) 3   libtvm.dylib                        0x000000011a8d0bd5 
tvm::runtime::RPCEndpoint::EventHandler::HandleReturn(tvm::runtime::RPCCode, 
std::__1::function<void (tvm::runtime::TVMArgs)>) + 213
     [bt] (1) 2   libtvm.dylib                        0x00000001194256c9 
tvm::runtime::detail::LogFatal::Entry::Finalize() + 89
     [bt] (0) 1   libtvm.dylib                        0x000000011a86a688 
tvm::runtime::Backtrace() + 24
     [bt] (8) 9   tvmrpc                              0x0000000100678c74 
std::__1::__function::__alloc_func<tvm::runtime::$_2, 
std::__1::allocator<tvm::runtime::$_2>, void (tvm::runtime::TVMArgs, 
tvm::runtime::TVMRetValue*)>::operator()(tvm::runtime::TVMArgs&&, 
tvm::runtime::TVMRetValue*&&) + 72
     [bt] (7) 8   tvmrpc                              0x0000000100678cc8 void 
std::__1::__invoke_void_return_wrapper<void, true>::__call<tvm::runtime::$_2&, 
tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*>(tvm::runtime::$_2&, 
tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&) + 72
     [bt] (6) 7   tvmrpc                              0x0000000100678d58 
decltype(std::__1::forward<tvm::runtime::$_2&>(fp)(std::__1::forward<tvm::runtime::TVMArgs>(fp0),
 std::__1::forward<tvm::runtime::TVMRetValue*>(fp0))) 
std::__1::__invoke<tvm::runtime::$_2&, tvm::runtime::TVMArgs, 
tvm::runtime::TVMRetValue*>(tvm::runtime::$_2&, tvm::runtime::TVMArgs&&, 
tvm::runtime::TVMRetValue*&&) + 96
     [bt] (5) 6   tvmrpc                              0x0000000100678df4 
tvm::runtime::$_2::operator()(tvm::runtime::TVMArgs, 
tvm::runtime::TVMRetValue*) const + 124
     [bt] (4) 5   tvmrpc                              0x0000000100679028 
tvm::runtime::UnsignedDSOLoader::Init(std::__1::basic_string<char, 
std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 312
     [bt] (3) 4   tvmrpc                              0x000000010065cfac 
tvm::runtime::detail::LogFatal::~LogFatal() + 28
     [bt] (2) 3   tvmrpc                              0x000000010065f6d8 
tvm::runtime::detail::LogFatal::~LogFatal() + 64
     [bt] (1) 2   tvmrpc                              0x000000010066d6d4 
tvm::runtime::detail::LogFatalImpl(std::__1::basic_string<char, 
std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, 
std::__1::basic_string<char, std::__1::char_traits<char>, 
std::__1::allocator<char> > const&) + 104
     [bt] (0) 1   libtvm_runtime.dylib                0x0000000100c55740 
tvm::runtime::Backtrace() + 28
     File "/Users/zy/Desktop/tvm/src/runtime/rpc/rpc_endpoint.cc", line 376
   RPCError: Error caught from RPC call:
   [14:18:44] /Users/zy/Desktop/tvm/apps/ios_rpc/tvmrpc/TVMRuntime.mm:98: 
   ---------------------------------------------------------------
   An error occurred during the execution of TVM.
   For more information, please see: https://tvm.apache.org/docs/errors.html
   ---------------------------------------------------------------
     Check failed: (lib_handle_ != nullptr) is false: Failed to load dynamic 
shared library 
/private/var/mobile/Containers/Data/Application/E1CAE739-58A5-4C1B-83A0-69725DB6BC7C/tmp/dev_lib.dylib
 Error happens during dlopen execution. Unimplemented
   ```
   
   
   
   I tried to change arch to `arm64e` in file `tests/ios_rpc_test.py`, but 
still the same error
   ```
   # Change target configuration, this is setting for iphone6s
   arch = "arm64"
   sdk = "iphoneos"
   target = "llvm -mtriple=%s-apple-darwin" % arch
   ```
   
   
   I tried to search this question, but I did not find any relevant discussion. 
If this issue has already been discussed, I am very sorry.


-- 
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]


Reply via email to