JishinMaster / simd_utils

A header only library implementing common mathematical functions using SIMD intrinsics
BSD 2-Clause "Simplified" License
91 stars 21 forks source link

cannot initialize a parameter of type 'float32x4_t' (vector of 4 'float32_t' values) with an lvalue of type '__m128d' (aka 'float64x2_t') #7

Open XapaJIaMnu opened 1 year ago

XapaJIaMnu commented 1 year ago

I am not quite sure where this error comes from tbh. I'm trying to compile this fork https://github.com/browsermt/marian-dev with the latest simd_utils and I suddenly get this regression. This is running on M1, if that makes any difference.

In file included from /Users/nick/marian-dev/src/common/binary.cpp:6:
In file included from /Users/nick/marian-dev/src/tensors/cpu/integer_common.h:4:
In file included from /Users/nick/marian-dev/src/tensors/tensor_operators.h:20:
In file included from /Users/nick/marian-dev/src/tensors/cpu/add.h:8:
In file included from /Users/nick/marian-dev/src/functional/functional.h:7:
In file included from /Users/nick/marian-dev/src/functional/operators.h:219:
In file included from /Users/nick/marian-dev/src/3rd_party/simd_utils/simd_utils.h:27:
In file included from /Users/nick/marian-dev/src/3rd_party/simd_utils/simd_utils_constants.h:19:
In file included from /Users/nick/marian-dev/src/3rd_party/simd_utils/sse2neon_wrapper.h:11:
/Users/nick/marian-dev/src/3rd_party/simd_utils/sse2neon.h:5537:33: error: cannot initialize a parameter of type 'float32x4_t' (vector of 4 'float32_t' values) with an lvalue of type '__m128d' (aka 'float64x2_t')
    __builtin_nontemporal_store(a, (float32x4_t *) p);
                                ^
1 error generated.
make[2]: *** [src/CMakeFiles/marian.dir/common/binary.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/marian.dir/all] Error 2
make: *** [all] Error 2
XapaJIaMnu commented 1 year ago

It seems to have been fixed by 72a657b72f95620f9b3cb19aa15a92ae59eec91c and then reverted?

JishinMaster commented 1 year ago

Yes, my bad, @jerinphilip did not propose the fix to sse2neon, so pulling the latest version reintroduced the problem. I have manually patched the sse2neon.h.

JoachimSchurig commented 1 year ago

I have created a PR for sse2neon: https://github.com/DLTcollab/sse2neon/pull/614 My proposed fix is to cast to the derived type __m128d instead of one of the underlying types, as those would change depending on the platform. The problem arises once -flax-vector-conversions is set to anything than the clang default. Marian-dev indeed sets -flax-vector-conversion and therefore triggers the issue.

JoachimSchurig commented 1 year ago

@JishinMaster my PR for sse2neon has been accepted. It would be great if you could update sse2neon one more time. Thank you very much!

vrnmthr commented 12 months ago

@JishinMaster I have updated sse2neon to include @JoachimSchurig's fix here https://github.com/JishinMaster/simd_utils/pull/8. please take a look when you get a chance.