xtensor-stack / xsimd

C++ wrappers for SIMD intrinsics and parallelized, optimized mathematical functions (SSE, AVX, AVX512, NEON, SVE))
https://xsimd.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.19k stars 254 forks source link

Compilation errors when enabling XTENSOR_USE_XSIMD during cross compile for Tizen #768

Closed smozhaykin closed 2 years ago

smozhaykin commented 2 years ago

Hello, I'm trying to enable xsimd optimizations for Tizen, but compilation fails.

I'm using xtensor 0.24.2, xtl 0.7.4, xsimd 8.1.0.

When XTENSOR_USE_XSIMD is not specified compilation completes successfully (please, ignore linking error, it's not relevant to this issue):

sergey@ubuntu-vm:~$ echo "#include \"xtensor.hpp\"" | /home/sergey/tizen-studio/tools/arm-linux-gnueabi-gcc-9.2/bin/arm-linux-gnueabi-g++ -x c++ --sysroot=/home/sergey/tizen-studio/platforms/tizen-6.0/wearable/rootstraps/wearable-6.0-device.core -I/opt/xsimd-8.1.0/include/ -I/opt/xtensor-0.24.2/include -I/opt/xtl-0.7.4/include -mfpu=neon-vfpv4 -
/home/sergey/tizen-studio/tools/arm-linux-gnueabi-gcc-9.2/bin/../lib/gcc/arm-tizen-linux-gnueabi/9.2.0/../../../../arm-tizen-linux-gnueabi/bin/ld: /home/sergey/tizen-studio/platforms/tizen-6.0/wearable/rootstraps/wearable-6.0-device.core/usr/lib/crt1.o: in function `_start':
/home/abuild/rpmbuild/BUILD/glibc-2.30/csu/../sysdeps/arm/start.S:119: undefined reference to `main'
collect2: error: ld returned 1 exit status

But with XTENSOR_USE_XSIMD option there are multiple errors:

sergey@ubuntu-vm:~$ echo "#include \"xtensor.hpp\"" | /home/sergey/tizen-studio/tools/arm-linux-gnueabi-gcc-9.2/bin/arm-linux-gnueabi-g++ -x c++ --sysroot=/home/sergey/tizen-studio/platforms/tizen-6.0/wearable/rootstraps/wearable-6.0-device.core -I/opt/xsimd-8.1.0/include/ -I/opt/xtensor-0.24.2/include -I/opt/xtl-0.7.4/include -mfpu=neon-vfpv4 -DXTENSOR_USE_XSIMD -

/opt/xsimd-8.1.0/include/xsimd/types/xsimd_batch.hpp:662:38: error: no matching function for call to ‘div<xsimd::neon>(xsimd::batch<double, xsimd::neon>&, const xsimd::batch<double, xsimd::neon>&, xsimd::neon)’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/././generic/xsimd_generic_arithmetic.hpp:47:37: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
/opt/xsimd-8.1.0/include/xsimd/types/xsimd_batch.hpp:656:38: error: no matching function for call to ‘mul<xsimd::neon>(xsimd::batch<double, xsimd::neon>&, const xsimd::batch<double, xsimd::neon>&, xsimd::neon)’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/./xsimd_generic_fwd.hpp:31:37: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/./xsimd_neon.hpp:715:71: error: no type named ‘type’ in ‘struct std::enable_if<false, int>’
/opt/xsimd-8.1.0/include/xsimd/types/xsimd_batch.hpp:634:29: error: no matching function for call to ‘lt<xsimd::neon>(const xsimd::batch<double, xsimd::neon>&, const xsimd::batch<double, xsimd::neon>&, xsimd::neon)’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/./xsimd_neon.hpp:841:71: error: no type named ‘type’ in ‘struct std::enable_if<false, int>’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/./xsimd_neon.hpp:852:77: error: no type named ‘type’ in ‘struct std::enable_if<false, int>’
/opt/xsimd-8.1.0/include/xsimd/types/xsimd_batch.hpp:416:69: error: no matching function for call to ‘xsimd::types::simd_register<double, xsimd::neon>::simd_register(xsimd::batch<float, xsimd::neon>)’
/opt/xsimd-8.1.0/include/xsimd/types/xsimd_api.hpp:1512:33: error: no matching function for call to ‘select<xsimd::neon>(const xsimd::batch_bool<double, xsimd::neon>&, const xsimd::batch<double, xsimd::neon>&, const xsimd::batch<double, xsimd::neon>&, xsimd::neon)’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/./xsimd_neon.hpp:1503:69: error: no type named ‘type’ in ‘struct std::enable_if<false, int>’
/opt/xsimd-8.1.0/include/xsimd/types/xsimd_batch.hpp:644:38: error: no matching function for call to ‘add<xsimd::neon>(xsimd::batch<double, xsimd::neon>&, const xsimd::batch<double, xsimd::neon>&, xsimd::neon)’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/./xsimd_neon.hpp:641:69: error: no type named ‘type’ in ‘struct std::enable_if<false, int>’
/opt/xsimd-8.1.0/include/xsimd/types/xsimd_api.hpp:59:30: error: no matching function for call to ‘abs<xsimd::neon>(const xsimd::batch<double, xsimd::neon>&, xsimd::neon)’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/./xsimd_generic_fwd.hpp:23:37: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/./xsimd_neon.hpp:1227:71: error: no type named ‘type’ in ‘struct std::enable_if<false, int>’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/././generic/xsimd_generic_math.hpp:68:51: error: static assertion failed: compatible sizes
/opt/xsimd-8.1.0/include/xsimd/types/../arch/././generic/xsimd_generic_math.hpp:72:37: error: no matching function for call to ‘begin(double [0])’
/home/sergey/tizen-studio/tools/arm-linux-gnueabi-gcc-9.2/arm-tizen-linux-gnueabi/include/c++/9.2.0/bits/range_access.h:48:50: error: request for member ‘begin’ in ‘__cont’, which is of non-class type ‘double [0]’
/home/sergey/tizen-studio/tools/arm-linux-gnueabi-gcc-9.2/arm-tizen-linux-gnueabi/include/c++/9.2.0/bits/range_access.h:58:56: error: request for member ‘begin’ in ‘__cont’, which is of non-class type ‘const double [0]’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/././generic/xsimd_generic_math.hpp:72:58: error: no matching function for call to ‘end(double [0])’
/home/sergey/tizen-studio/tools/arm-linux-gnueabi-gcc-9.2/arm-tizen-linux-gnueabi/include/c++/9.2.0/bits/range_access.h:68:48: error: request for member ‘end’ in ‘__cont’, which is of non-class type ‘double [0]’
/home/sergey/tizen-studio/tools/arm-linux-gnueabi-gcc-9.2/arm-tizen-linux-gnueabi/include/c++/9.2.0/bits/range_access.h:78:54: error: request for member ‘end’ in ‘__cont’, which is of non-class type ‘const double [0]’
/opt/xsimd-8.1.0/include/xsimd/types/../arch/././generic/xsimd_generic_math.hpp:68:51: error: static assertion failed: compatible sizes

g++ version:

sergey@ubuntu-vm:~$ /home/sergey/tizen-studio/tools/arm-linux-gnueabi-gcc-9.2/bin/arm-linux-gnueabi-g++ --version
arm-linux-gnueabi-g++ (Tizen/GNU GCC 9.2.0 2020.02) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

sergey@ubuntu-vm:~$ /home/sergey/tizen-studio/tools/arm-linux-gnueabi-gcc-9.2/bin/arm-linux-gnueabi-g++ -dumpmachine
arm-tizen-linux-gnueabi

Attaching both logs.

xtensor.log xtensor_use_xsimd.log

serge-sans-paille commented 2 years ago

There's no support for double in neon arch. I guess we could make the error more explicit.

smozhaykin commented 2 years ago

@serge-sans-paille thanks for clarification. But I'm just trying enable any possible optimizations for xtensor. Is there any other set of compiler flags I should use for it?

g++ supports the following arguments:

When compiling without any other flags I'm getting another set of errors: error_log.txt