Android rpc with OpenCL Failed

Hello, I followed this page to install Android TVM RPC. The apk can be build well when I disable OpenCL. However, I get the following error if enabling OpenCL

[arm64-v8a] Compile++ : tvm4j_runtime_packed <= org_apache_tvm_native_c_api.cc [arm64-v8a] SharedLibrary : libtvm4j_runtime_packed.so /home/ycdfwzy/repo/tvm/pull-from-android-device/libOpenCL.so: error adding symbols: File in wrong format clang++: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [/home/ycdfwzy/Android/Sdk/ndk/21.4.7075529/build/core/build-binary.mk:725: /home/ycdfwzy/repo/tvm/apps/android_rpc/app/src/main/obj/local/arm64-v8a/libtvm4j_runtime_packed.so] Error 1 make: Leaving directory ‘/home/ycdfwzy/repo/tvm/apps/android_rpc/app/src/main/jni’

I use TVM 0.7.0 and the Google Pixel 3. I’m sure libOpenCL.so is pulled from Pixel 3.

I see that you are building for arm64-v8a. Maybe you have pulled your lib from /vendor/lib/ instead of /vendor/lib64/ ?

Thanks for your reply.

I have repulled libOpenCL.so from /vendor/lib64/. It passed the compilation and I could see the device if I ran

python3 -m tvm.exec.query_rpc_tracker --host=0.0.0.0 --port=9190

However, the test script outputs nothing. It seems that it can’t establish the connection

^CTraceback (most recent call last): File “tests/android_rpc_test2.py”, line 129, in test_rpc_module() File “tests/android_rpc_test2.py”, line 57, in test_rpc_module remote = tracker.request(key, priority=0, session_timeout=60) File “/home/ycdfwzy/repo/tvm/python/tvm/rpc/client.py”, line 394, in request return connect(url, port, matchkey, session_timeout) File “/home/ycdfwzy/repo/tvm/python/tvm/rpc/client.py”, line 501, in connect sess = _ffi_api.Connect(url, port, key, *session_constructor_args) File “/home/ycdfwzy/repo/tvm/python/tvm/_ffi/_ctypes/packed_func.py”, line 233, in call ctypes.byref(ret_tcode), KeyboardInterrupt

It could pass the test if I disabled OpenCL when compiling the RPC app.

Did you manage to find a solution for that?

Which problem with OpenCL and android rpc do you have? I checked on the latest master and everything works fine for me. Maybe I could help you.

Thanks! I managed to fix this problem.

I met the same problem with you on my pixel 3 XL, have you fixed the problem?