Fix avx512 build error from clang#553
Merged
Merged
Conversation
cyb70289
commented
Sep 8, 2021
| uint64_t mask_low1 = _mm512_cmp_epu32_mask(batch<uint32_t, A>(self.data) & batch<uint32_t, A>(0x0000FF00), batch<uint32_t, A>(other.data) & batch<uint32_t, A>(0x0000FF00), Cmp); | ||
| uint64_t mask_high0 = _mm512_cmp_epu32_mask(batch<uint32_t, A>(self.data) & batch<uint32_t, A>(0x00FF0000), batch<uint32_t, A>(other.data) & batch<uint32_t, A>(0x00FF0000), Cmp); | ||
| uint64_t mask_high1 = _mm512_cmp_epu32_mask(batch<uint32_t, A>(self.data) & batch<uint32_t, A>(0xFF000000), batch<uint32_t, A>(other.data) & batch<uint32_t, A>(0xFF000000), Cmp); | ||
| uint64_t mask_low0 = _mm512_cmp_epu32_mask((batch<uint32_t, A>(self.data) & batch<uint32_t, A>(0x000000FF)), (batch<uint32_t, A>(other.data) & batch<uint32_t, A>(0x000000FF)), Cmp); |
Contributor
Author
There was a problem hiding this comment.
_mm512_cmp_xxx_mask are macros in clang. The , between template augments confuses the compiler.
Adding parentheses fixes the issue.
cyb70289
commented
Sep 8, 2021
Comment on lines
131
to
136
| #if defined(__clang__) && __clang_major__ >= 6 | ||
| #define XSIMD_WITH_AVX512F 1 | ||
| #else | ||
| // AVX512 instructions are supported starting with gcc 6 | ||
| // see https://www.gnu.org/software/gcc/gcc-6/changes.html | ||
| #if defined(__GNUC__) && __GNUC__ < 6 |
Contributor
Author
There was a problem hiding this comment.
clang also defines __GNUC__, but looks it's fixed to 4, even for latest clang-12 [1]. So avx512 is always disabled when build xsimd with clang.
Add explicit clang checking to fix the issue.
[1] https://godbolt.org/z/n6cEexPfn
Contributor
Author
pitrou
reviewed
Sep 8, 2021
I'm building apache arrow with latest xsimd and met with many errors when using clang and enabling avx512. This patch fixes the issues.
Contributor
|
Do we know why CI didn't catch this on master? |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm building apache arrow with latest xsimd and met with many errors
when using clang and enabling avx512. This patch fixes the issues.