debug_all_the_time
debug_all_the_time

Reputation: 574

How to get ARM NEON dot production ("UDOT") instruction support in Android NDK project?

I am building an android NDK project using ARM NEON on one Snapdragon 845 phone.

After reading the post https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/exploring-the-arm-dot-product-instructions, I would like to use UDOT to do the convolution. However, the UDOT instruction is not recognized. I tried the code

static unsigned long long read_id_aa64isar0()
{
 unsigned long long id_aa64isar0;

 __asm ("MRS %x0, ID_AA64ISAR0_EL1 \n" : "=r" (id_aa64isar0) );

return (id_aa64isar0);
}

static bool dot_product_supported()
{
 if (read_id_aa64isar0() & 0x0000100000000000ULL)
     return true;
 else
     return false;
}

to try to confirm dot product support, it reports ERROR Illegal instruction .

My Application.mk file is like

APP_STL := c++_static
NDK_TOOLCHAIN_VERSION := clang
APP_PLATFORM := android-21
APP_ABI := arm64-v8a

And the flags of my Android.mk is like

LOCAL_ARM_NEON  := true
LOCAL_CFLAGS += -march=armv8.2-a -Werror -O3
LOCAL_CFLAGS += -fopenmp
LOCAL_LDFLAGS += -fopenmp

I tried to change -march=armv8-a to -march=armv8.2-a but it reports error error: unknown value 'armv8.2-a' for -march.

The NDK version I used is r14b. Can I know how I can have the support for UDOT? Thank you!

Upvotes: 3

Views: 940

Answers (1)

  1. As far as I know, MRS is a non-user mode only instruction.
  2. NDK r14b is from March 2017, the same year the first bunch of armv8.2-a was launched.
    And thus, I doubt that the compiler supports armv8.2-a.
    You should try r17c or later.

Upvotes: 3

Related Questions