simde: Problem detecting the lack of _Float16 on Clang-Cl with /arch:SSE (x86)
The following cmake settings for a 32bit build with clang-cl, with only SSE enabled:
-G "Visual Studio 17 2022" -A Win32 -T "ClangCl" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="/arch:SSE"
(Clang 16.0.5 with MSVC-like command-line)
Caused error:
simde-f16.h(94,11): error : _Float16 is not supported
Seems like detection in simde-f16.h is generally sketchy, additionally because detecting clang-cl involves checking for both __clang__ and _MSC_VER at the same time.
I was able to circumvent the issue by detecting _Float16 availablity like this:
// Make sure _Float16 identifier exists in such cases, and if not,
// use the portable alternative provided by SIMDe
// Do this before including any SIMDe headers
#ifdef __is_identifier
#if !__is_identifier(_Float16)
#define SIMDE_FLOAT16_API 1 // SIMDE_FLOAT16_API_PORTABLE == 1
#endif
#endif
I saw a comment, that you’re searching for suggestions on more robust detection of _Float16, so I thought this will be helpful. I could probably do a PR at some point, but I’m quite busy atm.
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Reactions: 1
- Comments: 15 (7 by maintainers)
Commits related to this issue
- fp16: don't use _Float16 on msvc if not supported Closes: https://github.com/simd-everywhere/simde/issues/1069 — committed to simd-everywhere/simde by mr-c 8 months ago
- fp16: don't use _Float16 on ClangCL if not supported Closes: https://github.com/simd-everywhere/simde/issues/1069 — committed to simd-everywhere/simde by mr-c 8 months ago
- fp16: don't use _Float16 on ClangCL if not supported Closes: https://github.com/simd-everywhere/simde/issues/1069 — committed to simd-everywhere/simde by mr-c 8 months ago
- fp16: don't use _Float16 on ClangCL if not supported Closes: https://github.com/simd-everywhere/simde/issues/1069 — committed to simd-everywhere/simde by mr-c 8 months ago
- fp16: don't use _Float16 on ClangCL if not supported Closes: https://github.com/simd-everywhere/simde/issues/1069 — committed to simd-everywhere/simde by mr-c 8 months ago
- fp16: don't use _Float16 on ClangCL if not supported Closes: https://github.com/simd-everywhere/simde/issues/1069 — committed to mr-c/simde by mr-c 8 months ago
- fp16: don't use _Float16 on ClangCL if not supported Closes: https://github.com/simd-everywhere/simde/issues/1069 — committed to simd-everywhere/simde by mr-c 8 months ago
- fp16: don't use _Float16 on ClangCL if not supported Closes: https://github.com/simd-everywhere/simde/issues/1069 — committed to simd-everywhere/simde-no-tests by mr-c 8 months ago
- fp16: don't use _Float16 on ClangCL if not supported Closes: https://github.com/simd-everywhere/simde/issues/1069 — committed to nthu-pllab/pllab-simde by mr-c 8 months ago
- fp16: don't use _Float16 on ClangCL if not supported Closes: https://github.com/simd-everywhere/simde/issues/1069 — committed to nthu-pllab/pllab-simde by mr-c 8 months ago
I can confirm, that c98b76a fixes the problem I had, when applied to 4d55fc25bcfddc0e2f0c744448557a070dd310c9
I will now test the new commit you proposed, regarding SVML, but I think it is fine to close this issue
@Epixu sorry to hear that; let me know if it turns out that https://github.com/simd-everywhere/simde/commit/c98b76a0a6a3708ae56d85b863583d8d77c4ff7b fixes your issue
@mr-c I will check it by the end of the work week