Can you advise me about TVM_NDK_CC and target settings for arch=ARMv8-A, part=cortex-A53?
I would like to cross-compile TVM-based MXNet model for an android device based on arch=ARMv8-A, part=cortex-A53.
I’ve been stuck in “loading model” for quite long time.
==> Module modelLib = Module.load(libCacheFilePath);
First of all, should I create *.o using this command <-- lib.save(path_o)?
or should I create ***.so using this command <-- lib.export_library(path_so, ndk.create_shared)?
Could you advise on how to set there options - TVM_NDK_CC and target?
I have used several combinations for these.
For TVM_NDK_CC, I tried:
aarch64-linux-android-clang
aarch64-linux-android-gcc
arm-linux-androideabi-clang
arm-linux-androideabi-gcc
I used the following command to create aarch64 toolchains (for aarch64-).
./make-standalone-toolchain.sh --toolchain=aarch64-linux-android-4.9 --platform=android-22 --use-llvm
I used the following command to create arm (32bits) toolchains (for arm-),
./make-standalone-toolchain.sh --platform=android-22 --use-llvm --arch=arm
For target, I tried:
target = ‘llvm -target=armv8a-arm-linux-android -mfloat-abi=soft -mcpu=cortex-a53’
target = ‘llvm -target=armv8a-arm-none-eabi -mfloat-abi=soft -mcpu=cortex-a53’
target = ‘llvm -target=armv7-none-linux-androideabi -mfloat-abi=soft -mcpu=cortex-a53’
target = ‘llvm -target=armv7-none-linux-androideabi -mfloat-abi=soft’
and more…
Yes, I have tried to TVM_NDK_CC=aarch64-linux-android-g++ and llvm -target=arm64-linux-android. However, it returns the same error below.
A/libc: /Volumes/Android/buildbot/src/android/ndk-release-r17/external/libcxx/…/…/external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion “terminating with uncaught exception of type dmlc::Error: [19:31:39] ~/gitRepos/tvm/apps/android_rpc/app/src/main/jni/jni_helper_func.h:182: Do NOT know how to handle return type code -141177368” failed
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 9172 (AsyncTask #1)
I don’t use any external libraries.
This is the config.mk
APP_ABI = all
APP_PLATFORM = android-22
USE_OPENCL = 0
ADD_C_INCLUDES =
ADD_LDLIBS =
When i set APP-ABI = arm64-v8a,
it doesn’t work.
APP_ABI = armeabi-v7a
It works.
Is your android device running a 32-bit or 64-bit OS? That should inform whether you should use v7a or v8a. If you create an arm64 standalone toolchain when your OS/CPU is 32-bit, then that will likely be problematic.
For an example on the export library and module load, see the android_rpc_test.py script.
cross-compiler: arm-linux-androideabi-g++
it is made by using this command.
cd ~/android-ndk-r17b/build/tools/
./make-standalone-toolchain.sh --platform=android-22 --use-llvm --arch=arm --install-dir=****
That is, TVM_NDK_CC=~/arm-linux-toolchain/bin/arm-linux-androideabi-g++
@eqy,
When I executed the following command in my android device,
getprop ro.product.cpu.abi
I got this result
arm64-v8a
In addition, when i executed
cat /proc/cpuinfo
I have
Processor : AArch64 Processor rev 3 (aarch64)
processor : 0
model name : AArch64 Processor rev 3 (aarch64)
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 3
It seems the device running a 64bit OS, doesn’t it?
Thus, well… I don’t know why the above combination works… XD
Unfortunately, my android device (echo dot) doesn’t have a display unlike smartphone.
So i cannot search the info by the way stated in the webpage.
That is why, i used getprop ro.product.cpu.abi, and cat /proc/cpuinfo.
Please let me know if you know any other commands that i can directly get the 32/64bit information.
I could make .so file with the following cross-compiler and target options
cross-compiler: aarch64-linux-android-g++
it is made by using this command.
cd ~/android-ndk-r17b/build/tools/
./make-standalone-toolchain.sh --platform=android-22 --use-llvm --arch=arm64 --install-dir=~/arm64-toolchain
That is, TVM_NDK_CC=~/arm64-toolchain/bin/aarch64-linux-android-g++
target = ‘llvm -target=aarch64-none-linux-android -mfloat-abi=soft -mcpu=cortex-a53’
However, I couldn’t make an android app with APP_ABI = arm64-v8a in config.mk
APP_ABI = all also doesn’t work
Thanks for the direction.
I successfully generated library, param and graph using the cross-compiler (aarch64-linux-android-g++) and target option (target = “llvm -target=arm64-linux-android”).
However, when I use “APP_ABI = arm64-v8a” in config.mk, it returns an error below.
Failure [INSTALL_FAILED_NO_MATCHING_ABIS]
Depend on target hardware and software version need to select APP_ABI version. Latest most hardware 64bit arm, so select right APP_ABI mode to compile your application.