how to support sve in ndk
In linux system,I try to use Android.mk to compile an executable file including SVE intrinsics, which is supported in armv8.2, and the system config as follows:
- TARGET_ARCH=arm64;
- TARGET_ARCH_VARIANT=armv8-2a;
- TARGET_CPU_VARIANT=cortex-a76
- TARGET_2ND_ARCH=arm;
- TARGET_2ND_ARCH_VARIANT=armv8-2a
- TARGET_2ND_CPU_VARIANT=cortex-a55
- HOST_ARCH=x86_64
- HSOT_2ND_ARCH=x86
- HSOT_OS=linux
And the Android.mk is
LOCAL_PATH:= $(call my-dir)
ROOT_DIR := $(LOCAL_PATH)/..
include $(CLEAR_VARS)
LOCAL_MODULE:= SVE_test
LOCAL_SRC_FILES := $(ROOT_DIR)/Project1/main.cpp
LOCAL_CFLAGS := -O3 -ffast-math -DNDK -D_GNU_SOURCE -D__ARM_FEATURE_SVE -D__LITTLE_ENDIAN
LOCAL_CFLAGS += -mfloat-abi=softfp -mfpu=neon -msve-vector-bits=256
LOCAL_LDLIBS += -lc -ldl -lm -lz -llog -fPIE
APP_CPPFLAGS +=-std=c++11
ifeq($(TARGET_ARCH_ABI), arm64-v8a)
LOCAL_ARM_NEON:=true
endif
LOCAL_PROPRIETARY_MODULE := TRUE
include $(BUILD_EXECUTABLE)
But some errors I met, it shows that error in backend:don't know how to legalize this scalable vector size. How to solve this problem?
Hi @xdliangdi
Could you please share the complete error you get and the version of the NDK you're using?
Hi @xdliangdi
Could you please share the complete error you get and the version of the NDK you're using?
The error writes fatal error:error in backend:Don't know how to legalize this scalable vector type. I compiler SVE instrinsics using Android compiler system not NDK, and how to compiler SVE code in Android system?
Hi @xdliangdi
Could you please share the complete error you get and the version of the NDK you're using?
The error writes fatal error:error in backend:Don't know how to legalize this scalable vector type. I compiler SVE instrinsics using Android compiler system not NDK, and how to compiler SVE code in Android system?
Hi @xdliangdi
What version of NDK are you using?
The error shows that your compiler does not support SVE, this could be either because the NDK you use is too old or the TARGET_ARCH_VARIANT is missing sve. For example when I build ACL with sve enabled the scons generates the following -march=armv8.2-a+sve+fp16+dotprod
I build ACL with the following command:
user@host:~/work/acl/ComputeLibrary$ PATH=$PATH:../../toolchains/android-ndk-r23-beta5/toolchains/llvm/prebuilt/linux-x86_64/bin/ scons arch=arm64-v8.2-a-sve neon=1 opencl=0 embed_kernels=1 extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0 os=android Werror=0 toolchain_prefix=aarch64-linux-android29- -j16
Hope this helps.
这是来自QQ邮箱的假期自动回复邮件。 您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。