Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’ #1924

Closed
fwz-fpga opened this issue Sep 23, 2021 · 7 comments

Comments

@fwz-fpga
Copy link

I have a device with linux os && armv7.
Recently, I need to cross compile to build xnnpack lib, host is x86_64 cpu. And the toolchain is gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.
With this toolchain, the error is
error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’ vacc0x0123 = vcvtnq_s32_f32(vproduct0x0123);
I find that arm_neon.h in gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi doesn't have this vcvtnq_s32_f32 intrinsic.
This toolchain is for AArch32, is it the problem of toolchain?
I have tried gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabi , it is the same error.

As for complie, I have tried another toolchain gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu this is for aarch64, it works fine.

So what's the problem, aarch32 toolchain not support some xnnpack kernels?

@fwz-fpga
Copy link
Author

Like this, https://github.com/google/XNNPACK/pull/1404/files , modify the cmakelist.txt, remove XNNPACK_NEONDOT_MICROKERNEL_SRCS, it can build success. :(

@Maratyszcza
Copy link
Contributor

In which source file do you get the error?

@fwz-fpga
Copy link
Author

XNNPACK/src/qs8-gemm/gen/1x8c4-minmax-fp32-neondot.c:94:16: error: incompatible types when assigning to type ‘int32x4_t’ from type ‘int’
vacc0x0123 = vcvtnq_s32_f32(vproduct0x0123);

@fwz-fpga
Copy link
Author

toolchain.cmake

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR armv7)
set(TOOLCHAIN_DIR /root/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin)
set(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/arm-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/arm-linux-gnueabi-g++)
add_compile_options(-fstack-protector-all -Wall -mfloat-abi=softfp)

@Maratyszcza
Copy link
Contributor

The compiler lacks the right intrinsic function. XNNPACK includes a polyfill for this intrinsic, but for some reason it doesn't get used:

#if XNN_ARCH_ARM && (defined(__ARM_NEON) || defined(__ARM_NEON__))
#include <arm_neon.h>
// AArch32 GCC targeting ARMv8 NEON, see
// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71233
// - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95399
#if defined(__GNUC__) && !defined(__clang__) && (__ARM_ARCH >= 8)
static XNN_INTRINSIC
int32x4_t vcvtnq_s32_f32(float32x4_t v) {
return vcvtq_s32_f32(vrndnq_f32(v));
}
#endif // AArch32 GCC targeting ARMv8 NEON
#endif // ARM NEON

@fwz-fpga
Copy link
Author

I know the reason, I use this commit 16d79ed

#if XNN_ARCH_ARM && defined(__GNUC__) && !defined(__clang__) && defined(__ARM_NEON__)
#include <arm_neon.h>
static XNN_INTRINSIC
int32x4_t vcvtnq_s32_f32(float32x4_t v) {
return vcvtq_s32_f32(vrndnq_f32(v));
}
#endif // AArch32 GCC
code in(#ifdef AVX512F not compile)
Now master is ok.

@fwz-fpga
Copy link
Author

THX :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants