ndk-samples icon indicating copy to clipboard operation
ndk-samples copied to clipboard

how to compiler sve in Android system

Open xxxxxxLD opened this issue 2 years ago • 1 comments

In linux system,I try to use Android.mk in Android compiler system 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
  • HOST_2ND_ARCH=x86
  • HOST_OS=linux

And here are the steps I build: source build/envsetup.sh lunch, I choose a platform described as above; mm, build the modules in the SVE instrinsics directory,and the Android.mk is in the same deirctory;

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 thaterror in backend:don't know how to legalize this scalable vector size. How to solve this problem?

xxxxxxLD avatar Jul 23 '22 01:07 xxxxxxLD

you might direct the question to https://github.com/android/ndk/issues?

ggfan avatar Aug 05 '22 19:08 ggfan

The NDK at the time did not support SVE. r27 should (idr about r26).

https://github.com/android/ndk-samples/issues/1011 for adding a sample.

DanAlbert avatar May 03 '24 22:05 DanAlbert