simde: Test build failed on Mac OS M1
Hey, I am building the test project with my Mac m1 machine, and used the following command to build the test source file:
cmake -S . -B build
cmake --build build
but it failed with a lot of incompatible pointer types assigning errors
such as:
/simde/arm/neon/ld1_x4.h:51:24: error: incompatible pointer types assigning to 'const __fp16 *' from 'const simde_float16 *' (aka 'const _Float16 *')
return vld1_f16_x4(ptr);
^~~
/simde/arm/neon/ld1q_x2.h:52:25: error: incompatible pointer types assigning to 'const __fp16 *' from 'const simde_float16 *' (aka 'const _Float16 *')
return vld1q_f16_x2(ptr);
^~~
simde/arm/neon/ld3_dup.h:250:26: error: incompatible pointer types assigning to 'const __fp16 *' from 'const simde_float16 *' (aka 'const _Float16 *')
return vld3q_dup_f16(ptr);
^~~
...
Maybe I should add some flags when run the cmake command, but I did not find any useful information in the CMakeLists.txt file.
Could anyone provide some help?
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Reactions: 2
- Comments: 20 (5 by maintainers)
Commits related to this issue
- arm neon: disable some FCVTZS/FCVTMS/FCVTPS/FCVTNS family intrinsics while we figure out the situation in https://github.com/simd-everywhere/simde/issues/1099 vcvth_s16_f16 vcvtah_s16_f16 vcvth_n_s... — committed to mr-c/simde by mr-c 3 months ago
- arm neon: disable some FCVTZS/FCVTMS/FCVTPS/FCVTNS family intrinsics while we figure out the situation in https://github.com/simd-everywhere/simde/issues/1099 vcvth_s16_f16 vcvtah_s16_f16 vcvth_n_s... — committed to mr-c/simde by mr-c 3 months ago
- arm neon: disable some FCVTZS/FCVTMS/FCVTPS/FCVTNS family intrinsics while we figure out the situation in https://github.com/simd-everywhere/simde/issues/1099 vcvth_s16_f16 vcvtah_s16_f16 vcvth_n_s... — committed to mr-c/simde by mr-c 3 months ago
- arm neon: disable some FCVTZS/FCVTMS/FCVTPS/FCVTNS family intrinsics while we figure out the situation in https://github.com/simd-everywhere/simde/issues/1099 vcvth_s16_f16 vcvtah_s16_f16 vcvth_n_s... — committed to mr-c/simde by mr-c 3 months ago
- arm neon: disable some FCVTZS/FCVTMS/FCVTPS/FCVTNS family intrinsics while we figure out the situation in https://github.com/simd-everywhere/simde/issues/1099 vcvth_s16_f16 vcvtah_s16_f16 vcvth_n_s... — committed to mr-c/simde by mr-c 3 months ago
- arm neon: disable some FCVTZS/FCVTMS/FCVTPS/FCVTNS family intrinsics while we figure out the situation in https://github.com/simd-everywhere/simde/issues/1099 vcvth_s16_f16 vcvtah_s16_f16 vcvth_n_s... — committed to mr-c/simde by mr-c 3 months ago
- arm neon: disable some FCVTZS/FCVTMS/FCVTPS/FCVTNS family intrinsics while we figure out the situation in https://github.com/simd-everywhere/simde/issues/1099 vcvth_s16_f16 vcvtah_s16_f16 vcvth_n_s... — committed to simd-everywhere/simde by mr-c 3 months ago
- arm neon: disable some FCVTZS/FCVTMS/FCVTPS/FCVTNS family intrinsics while we figure out the situation in https://github.com/simd-everywhere/simde/issues/1099 vcvth_s16_f16 vcvtah_s16_f16 vcvth_n_s... — committed to simd-everywhere/simde-no-tests by mr-c 3 months ago
We should try testing with the latest qemu. It isn’t impossible that Apple Silicon / apple clang are wrong, but it seems more likely that qemu is in error.
@yyctw can you
masterbranch of SIMDe using the latest qemu with a CPU profile and compilation options that matches the capability of a M1 chip?@yyctw I applied the commit patch and rebuilt the test, but the test errors still remain:
But the error log differed from the previous, may be it can help:
I’m not sure whether there are some bugs in Compiler or Apple chips.
Build failures were fixed in https://github.com/simd-everywhere/simde/pull/1148 ; I’ll make a new issue to re-implement the FCVTZS/FCVTMS/FCVTPS/FCVTNS family intrinsics that I had to disable
@yyctw Running with a newer qemu version, I am able to reproduce errors:
I think this issue has some weird points:
cvt_n.c, I tested it on the Mac server and encountered the same error as @SakuragiHnmch. However, @mr-c didn’t get assertions in the last four functions (vcvth_n_f16_{s/u}{32/64}) and also received different assertions in the first four functions. This implies that the behavior ofaarch64 arm8.2-aandarm64might differ.My clang version
Assertions of
arm64Assertions of
aarch64 arm8.2-acvtp: +infinity,cvtm: -infinity) and the number of shift bits (cvt_n). However, when I testedvcvtah_s16_f16with test case A, I encountered the assertion31776 == -32768. It seems that the results are not saturated toINT16_MINbut rather the integer overflow occurs.test case A of
vcvtah_s16_f16Assertion
The process of integer overflow
vcvtah_u16_f16), not just in bothvcvth_s16_f16andvcvtah_s16_f16.Considering the mentioned points, I believe there’s a higher likelihood of bugs existing in ARM chips rather than bugs in the documentation or QEMU.
Thanks for reading and any recommendations are welcome!
@yyctw It did’t work to add the flag
-march=nativeor-mcpu=apple-m1.I used following command to set up meson
and then run:
Before running the above command, I also add
-mcpu=apple-m1in the filesimde/test/meson.build.(I am not sure if the flag-march=nativein meson.build file takes the same effect as it in the commad above)But the test failed again.
@yyctw The definition of
vcvth_n_s32_f16is the same as you showed above:And the clang is a built-in compiler of Xcode:
Is that apple’s built-in clang (from XCode) or another source? The output from when you ran
meson setupwould be helpful here.Are you compiling the latest code from this repository, or a particular release of SIMDe?
Lets try out using
__fp16directly from the SIMDe side by adding-DSIMDE_FLOAT16_API=4to the CFLAGS & CXXFLAGS.https://github.com/simd-everywhere/simde/blob/f132275f85ab1c1cb1e890538ee552c11ca09c38/simde/simde-f16.h#L60-L62
If that works, I can use the information from
meson setupto fix the configuration in SIMDehttps://github.com/simd-everywhere/simde/blob/f132275f85ab1c1cb1e890538ee552c11ca09c38/simde/simde-f16.h#L64-L82