android / ndk

The Android Native Development Kit
1.99k stars 257 forks source link

how to support sve in ndk #1736

Closed xxxxxxLD closed 2 years ago

xxxxxxLD commented 2 years ago

Description

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 HOST_2ND_ARCH=x86 HOST_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?

Affected versions

Canary

Canary version

No response

Host OS

Linux

Host OS version

Ubuntu18.04.5-LTS

Affected ABIs

arm64-v8a

Build system

ndk-build

Other build system

No response

minSdkVersion

r13

Device API level

No response

DanAlbert commented 2 years ago

minSdkVersion r13

idk what you're trying to say here. The r prefix makes me think you mean you're using NDK r13, but the question is what your minSdkVersion is. I don't see the field for your NDK version at all? I'd love to know how you broke the template so I can fix it.

Neither NDK r13 nor API level 13 have been supported for years. If NDK r13, start by upgrading. There's nothing we can do to fix r13. If that's not it, we need you to provide a repro case like the template asked for.

TARGET_2ND_ARCH=arm; TARGET_2ND_ARCH_VARIANT=armv8-2a TARGET_2ND_CPU_VARIANT=cortex-a55

This is even more confusing, because those are platform Android.mk config variables. This is not the right bug tracker for the platform.

xxxxxxLD commented 2 years ago

Sorry,I compiler SVE intrinsics by using Android compiler system,and the SDK version is A13. And here are the steps I build:

  1. source build/envsetup.sh
  2. lunch, I choose a platform described as above;
  3. mm, build the modules in the SVE instrinsics directory,and the Android.mk is in the same deirctory;
DanAlbert commented 2 years ago

Yeah, that's a platform build. Wrong bug tracker. Follow b.android.com and file a platform bug.