simd_utils icon indicating copy to clipboard operation
simd_utils copied to clipboard

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

Open XapaJIaMnu opened this issue 2 years ago • 5 comments

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 avatar Sep 19 '23 19:09 XapaJIaMnu

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

XapaJIaMnu avatar Sep 19 '23 19:09 XapaJIaMnu

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.

JishinMaster avatar Sep 24 '23 12:09 JishinMaster

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 avatar Oct 04 '23 09:10 JoachimSchurig

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

JoachimSchurig avatar Oct 04 '23 17:10 JoachimSchurig

@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.

vrnmthr avatar Oct 26 '23 21:10 vrnmthr