zhaiyi000 commented on issue #9268:
URL: https://github.com/apache/tvm/issues/9268#issuecomment-943346320
@apeskov Thank you very much for your reply. I followed your suggestion and
modified the following code, but I got a new error.
```
clang = xcrun(["-sdk", sdk, "-find", "clang"])
sdk_path = xcrun(["-sdk", sdk, "--show-sdk-path"])
cmd = [clang]
cmd += ["-dynamiclib"]
cmd += ["-arch", arch]
cmd += ["-isysroot", sdk_path]
cmd += ["-target", "arm64-apple-ios13.0"] # any iOS version <15
cmd += ["-o", output]
```
```
(py38) zy@diyideMacBook-Pro ios_rpc_iphone12 % python3 tests/ios_rpc_test.py
--host '114.214.209.9' --port 9090 --mode "standalone"
[21:11:57] /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 83, in test_rpc_module
cost = time_f(a, b).mean
File "/Users/zy/Desktop/tvm/python/tvm/runtime/module.py", line 292, in
evaluator
blob = feval(*args)
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 0x00000001139b4a41
tvm::runtime::RPCWrappedFunc::operator()(tvm::runtime::TVMArgs,
tvm::runtime::TVMRetValue*) const + 1521
[bt] (7) 8 libtvm.dylib 0x00000001139ad47c
tvm::runtime::RPCClientSession::CallFunc(void*, TVMValue const*, int const*,
int, std::__1::function<void (tvm::runtime::TVMArgs)> const&) + 124
[bt] (6) 7 libtvm.dylib 0x00000001139a558d
tvm::runtime::RPCEndpoint::CallFunc(void*, TVMValue const*, int const*, int,
std::__1::function<void (tvm::runtime::TVMArgs)>) + 333
[bt] (5) 6 libtvm.dylib 0x00000001139a3e5e
tvm::runtime::RPCEndpoint::HandleUntilReturnEvent(bool, std::__1::function<void
(tvm::runtime::TVMArgs)>) + 622
[bt] (4) 5 libtvm.dylib 0x00000001139a40fe
tvm::runtime::RPCEndpoint::EventHandler::HandleNextEvent(bool, bool,
std::__1::function<void (tvm::runtime::TVMArgs)>) + 494
[bt] (3) 4 libtvm.dylib 0x00000001139a8172
tvm::runtime::RPCEndpoint::EventHandler::HandleProcessPacket(std::__1::function<void
(tvm::runtime::TVMArgs)>) + 386
[bt] (2) 3 libtvm.dylib 0x00000001139aa105
tvm::runtime::RPCEndpoint::EventHandler::HandleReturn(tvm::runtime::RPCCode,
std::__1::function<void (tvm::runtime::TVMArgs)>) + 213
[bt] (1) 2 libtvm.dylib 0x00000001124f7de9
tvm::runtime::detail::LogFatal::Entry::Finalize() + 89
[bt] (0) 1 libtvm.dylib 0x0000000113943bb8
tvm::runtime::Backtrace() + 24
[bt] (8) 9 libtvm_runtime.dylib 0x0000000104d61858
std::__1::__function::__func<tvm::runtime::WrapPackedFunc(int (*)(TVMValue*,
int*, int, TVMValue*, int*, void*),
tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::$_0,
std::__1::allocator<tvm::runtime::WrapPackedFunc(int (*)(TVMValue*, int*, int,
TVMValue*, int*, void*), tvm::runtime::ObjectPtr<tvm::runtime::Object>
const&)::$_0>, void (tvm::runtime::TVMArgs,
tvm::runtime::TVMRetValue*)>::operator()(tvm::runtime::TVMArgs&&,
tvm::runtime::TVMRetValue*&&) + 72
[bt] (7) 8 libtvm_runtime.dylib 0x0000000104d62cf8
std::__1::__function::__alloc_func<tvm::runtime::WrapPackedFunc(int
(*)(TVMValue*, int*, int, TVMValue*, int*, void*),
tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::$_0,
std::__1::allocator<tvm::runtime::WrapPackedFunc(int (*)(TVMValue*, int*, int,
TVMValue*, int*, void*), tvm::runtime::ObjectPtr<tvm::runtime::Object>
const&)::$_0>, void (tvm::runtime::TVMArgs,
tvm::runtime::TVMRetValue*)>::operator()(tvm::runtime::TVMArgs&&,
tvm::runtime::TVMRetValue*&&) + 72
[bt] (6) 7 libtvm_runtime.dylib 0x0000000104d62d74 void
std::__1::__invoke_void_return_wrapper<void,
true>::__call<tvm::runtime::WrapPackedFunc(int (*)(TVMValue*, int*, int,
TVMValue*, int*, void*), tvm::runtime::ObjectPtr<tvm::runtime::Object>
const&)::$_0&, tvm::runtime::TVMArgs,
tvm::runtime::TVMRetValue*>(tvm::runtime::WrapPackedFunc(int (*)(TVMValue*,
int*, int, TVMValue*, int*, void*),
tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::$_0&,
tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&) + 72
[bt] (5) 6 libtvm_runtime.dylib 0x0000000104d62e04
decltype(std::__1::forward<tvm::runtime::WrapPackedFunc(int (*)(TVMValue*,
int*, int, TVMValue*, int*, void*),
tvm::runtime::ObjectPtr<tvm::runtime::Object>
const&)::$_0&>(fp)(std::__1::forward<tvm::runtime::TVMArgs>(fp0),
std::__1::forward<tvm::runtime::TVMRetValue*>(fp0)))
std::__1::__invoke<tvm::runtime::WrapPackedFunc(int (*)(TVMValue*, int*, int,
TVMValue*, int*, void*), tvm::runtime::ObjectPtr<tvm::runtime::Object>
const&)::$_0&, tvm::runtime::TVMArgs,
tvm::runtime::TVMRetValue*>(tvm::runtime::WrapPackedFunc(int (*)(TVMValue*,
int*, int, TVMValue*, int*, void*),
tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::$_0&,
tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&) + 96
[bt] (4) 5 libtvm_runtime.dylib 0x0000000104d62fc8
tvm::runtime::WrapPackedFunc(int (*)(TVMValue*, int*, int, TVMValue*, int*,
void*), tvm::runtime::ObjectPtr<tvm::runtime::Object>
const&)::$_0::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
const + 420
[bt] (3) 4 libtvm_runtime.dylib 0x0000000104cd63b0
tvm::runtime::detail::LogFatal::~LogFatal() + 28
[bt] (2) 3 libtvm_runtime.dylib 0x0000000104cdc730
tvm::runtime::detail::LogFatal::~LogFatal() + 40
[bt] (1) 2 libtvm_runtime.dylib 0x0000000104cdc7b8
tvm::runtime::detail::LogFatal::Entry::Finalize() + 112
[bt] (0) 1 libtvm_runtime.dylib 0x0000000104d69740
tvm::runtime::Backtrace() + 28
[bt] (8) 9 libtvm_runtime.dylib 0x000000010502e804
tvm::runtime::MetalModuleNode::GetFunction(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&,
tvm::runtime::ObjectPtr<tvm::runtime::Object> const&) + 124
[bt] (7) 8 libtvm_runtime.dylib 0x000000010502e884 void
tvm::runtime::metal::AutoReleasePoolWrapper::operator<<<tvm::runtime::MetalModuleNode::GetFunction(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&,
tvm::runtime::ObjectPtr<tvm::runtime::Object>
const&)::$_0>(tvm::runtime::MetalModuleNode::GetFunction(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&,
tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::$_0 const&) + 48
[bt] (6) 7 libtvm_runtime.dylib 0x0000000105038b1c
tvm::runtime::MetalModuleNode::GetFunction(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&,
tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::$_0::operator()() const
+ 1116
[bt] (5) 6 libtvm_runtime.dylib 0x0000000105038f9c
tvm::runtime::MetalWrappedFunc::Init(tvm::runtime::MetalModuleNode*,
tvm::runtime::ObjectPtr<tvm::runtime::Object>, std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long,
unsigned long, std::__1::vector<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > > > const&) + 224
[bt] (4) 5 libtvm_runtime.dylib 0x000000010503a948
tvm::runtime::MetalModuleNode::GetPipelineState(unsigned long,
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > const&) + 2628
[bt] (3) 4 libtvm_runtime.dylib 0x0000000104cd63b0
tvm::runtime::detail::LogFatal::~LogFatal() + 28
[bt] (2) 3 libtvm_runtime.dylib 0x0000000104cdc730
tvm::runtime::detail::LogFatal::~LogFatal() + 40
[bt] (1) 2 libtvm_runtime.dylib 0x0000000104cdc7b8
tvm::runtime::detail::LogFatal::Entry::Finalize() + 112
[bt] (0) 1 libtvm_runtime.dylib 0x0000000104d69740
tvm::runtime::Backtrace() + 28
File "/Users/zy/Desktop/tvm/src/runtime/metal/metal_module.mm", line 133
File "/Users/zy/Desktop/tvm/src/runtime/rpc/rpc_endpoint.cc", line 376
RPCError: Error caught from RPC call:
[21:11:58] /Users/zy/Desktop/tvm/src/runtime/library_module.cc:78:
---------------------------------------------------------------
An error occurred during the execution of TVM.
For more information, please see: https://tvm.apache.org/docs/errors.html
---------------------------------------------------------------
Check failed: ret == 0 (-1 vs. 0) : TVMError:
---------------------------------------------------------------
An error occurred during the execution of TVM.
For more information, please see: https://tvm.apache.org/docs/errors.html
---------------------------------------------------------------
Check failed: (state != nil) is false: cannot get state: for function
myadd_kernel0Function myadd_kernel0 is using language version 2.4 which is
incompatible with this OS.
```
I tried the following two methods to compile tvm_runtime, but both got the
above error. My mobile phone is iPhone12 and the system is iOS14.7.1
```
cmake ..\
-DCMAKE_BUILD_TYPE=Debug\
-DCMAKE_SYSTEM_NAME=iOS\
-DCMAKE_SYSTEM_VERSION=14.7\
-DCMAKE_OSX_SYSROOT=iphoneos\
-DCMAKE_OSX_ARCHITECTURES=arm64\
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.7\
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON\
-DUSE_IOS_RPC=ON\
-DUSE_METAL=ON
```
```
cmake ..\
-DCMAKE_BUILD_TYPE=Debug\
-DCMAKE_SYSTEM_NAME=iOS\
-DCMAKE_SYSTEM_VERSION=14.0\
-DCMAKE_OSX_SYSROOT=iphoneos\
-DCMAKE_OSX_ARCHITECTURES=arm64\
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0\
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON\
-DUSE_IOS_RPC=ON\
-DUSE_METAL=ON
```
--
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]