error: use of undeclared identifier 'vmaxq_f16'
error: use of undeclared identifier 'vmaxq_f16'
每当我尝试使用 NEON 16 位浮点内在函数时,我都会收到此错误。
我没有遇到其他数据类型内在函数的任何问题。
是否可以在 Android 上使用 NEON 16 位浮点内在函数?
我的代码:
#include <jni.h>
#include <arm_fp16.h>
#include <arm_neon.h>
void useSIMD_f16() {
float16_t zero = 0;
float16x8_t zero_f16x8 = vld1q_dup_f16(&zero);
float16_t one = 1;
float16x8_t one_f16x8 = vld1q_dup_f16(&one);
float16x8_t max = vmaxq_f16(zero_f16x8, one_f16x8);
}
错误:
Execution failed for task ':app:externalNativeBuildDebug'.
Build command failed.
Error while executing process /home/raed/Android/Sdk/cmake/3.10.2.4988404/bin/ninja with arguments {-C /home/raed/AndroidStudioProjects/SIMD/app/.cxx/cmake/debug/armeabi-v7a native-lib}
ninja: Entering directory `/home/raed/AndroidStudioProjects/SIMD/app/.cxx/cmake/debug/armeabi-v7a'
[1/2] Building CXX object CMakeFiles/native-lib.dir/native-lib.cpp.o
FAILED: CMakeFiles/native-lib.dir/native-lib.cpp.o
/home/raed/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi23 --gcc-toolchain=/home/raed/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/raed/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/native-lib.dir/native-lib.cpp.o -MF CMakeFiles/native-lib.dir/native-lib.cpp.o.d -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /home/raed/AndroidStudioProjects/SIMD/app/src/main/cpp/native-lib.cpp
/home/raed/AndroidStudioProjects/SIMD/app/src/main/cpp/native-lib.cpp:7:30: error: use of undeclared identifier 'vld1q_dup_f16'
float16x8_t zero_f16x8 = vld1q_dup_f16(&zero);
^
/home/raed/AndroidStudioProjects/SIMD/app/src/main/cpp/native-lib.cpp:9:29: error: use of undeclared identifier 'vld1q_dup_f16'
float16x8_t one_f16x8 = vld1q_dup_f16(&one);
^
/home/raed/AndroidStudioProjects/SIMD/app/src/main/cpp/native-lib.cpp:10:23: error: use of undeclared identifier 'vmaxq_f16'
float16x8_t max = vmaxq_f16(zero_f16x8, one_f16x8);
^
3 errors generated.
ninja: build stopped: subcommand failed.
半精度浮点并非在所有 Arm 目标上都可用。检查__ARM_FEATURE_FP16_VECTOR_ARITHMETIC
宏是否定义,判断功能是否可用
Isn't it possible to use NEON 16-bit float intrinsics on Android?
这真的不是 Android 的事情;有些 Android 设备会支持它,有些则不会。这取决于 CPU.
每当我尝试使用 NEON 16 位浮点内在函数时,我都会收到此错误。 我没有遇到其他数据类型内在函数的任何问题。
是否可以在 Android 上使用 NEON 16 位浮点内在函数?
我的代码:
#include <jni.h>
#include <arm_fp16.h>
#include <arm_neon.h>
void useSIMD_f16() {
float16_t zero = 0;
float16x8_t zero_f16x8 = vld1q_dup_f16(&zero);
float16_t one = 1;
float16x8_t one_f16x8 = vld1q_dup_f16(&one);
float16x8_t max = vmaxq_f16(zero_f16x8, one_f16x8);
}
错误:
Execution failed for task ':app:externalNativeBuildDebug'. Build command failed. Error while executing process /home/raed/Android/Sdk/cmake/3.10.2.4988404/bin/ninja with arguments {-C /home/raed/AndroidStudioProjects/SIMD/app/.cxx/cmake/debug/armeabi-v7a native-lib} ninja: Entering directory `/home/raed/AndroidStudioProjects/SIMD/app/.cxx/cmake/debug/armeabi-v7a' [1/2] Building CXX object CMakeFiles/native-lib.dir/native-lib.cpp.o FAILED: CMakeFiles/native-lib.dir/native-lib.cpp.o /home/raed/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi23 --gcc-toolchain=/home/raed/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/raed/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/native-lib.dir/native-lib.cpp.o -MF CMakeFiles/native-lib.dir/native-lib.cpp.o.d -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /home/raed/AndroidStudioProjects/SIMD/app/src/main/cpp/native-lib.cpp /home/raed/AndroidStudioProjects/SIMD/app/src/main/cpp/native-lib.cpp:7:30: error: use of undeclared identifier 'vld1q_dup_f16' float16x8_t zero_f16x8 = vld1q_dup_f16(&zero); ^ /home/raed/AndroidStudioProjects/SIMD/app/src/main/cpp/native-lib.cpp:9:29: error: use of undeclared identifier 'vld1q_dup_f16' float16x8_t one_f16x8 = vld1q_dup_f16(&one); ^ /home/raed/AndroidStudioProjects/SIMD/app/src/main/cpp/native-lib.cpp:10:23: error: use of undeclared identifier 'vmaxq_f16' float16x8_t max = vmaxq_f16(zero_f16x8, one_f16x8); ^ 3 errors generated. ninja: build stopped: subcommand failed.
半精度浮点并非在所有 Arm 目标上都可用。检查__ARM_FEATURE_FP16_VECTOR_ARITHMETIC
宏是否定义,判断功能是否可用
Isn't it possible to use NEON 16-bit float intrinsics on Android?
这真的不是 Android 的事情;有些 Android 设备会支持它,有些则不会。这取决于 CPU.