gcc-16 dropped `evex512`, build fails as: cc1plus: error: attribute 'target' argument 'evex512' is unknown
gcc-16 master branch dropped support for evex512 as:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=c052a6f4a1c803cb92147ff98fb91cf3511e0856
As a result lhighway build from master started failing as:
libhwy> FAILED: CMakeFiles/hwy.dir/hwy/per_target.cc.o
libhwy> /nix/store/cji1zksf696lkb54n5ccqgxqh7wadk1b-gcc-wrapper-16.0.0.99999999/bin/g++ -DHWY_STATIC_DEFINE -DTOOLCHAIN_MISS_ASM_HWCAP_H -I/build/source -O3 -DNDEBUG -std=c++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wconversion -Wsign-conversion -Wvla -Wnon-virtual-dtor -Wcast-align -fmath-errno -fno-exceptions -Wno-psabi -MD -MT CMakeFiles/hwy.dir/hwy/per_target.cc.o -MF CMakeFiles/hwy.dir/hwy/per_target.cc.o.d -o CMakeFiles/hwy.dir/hwy/per_target.cc.o -c /build/source/hwy/per_target.cc
libhwy> cc1plus: error: attribute 'target' argument 'evex512' is unknown
libhwy> cc1plus: error: attribute 'target' argument 'evex512' is unknown
From what I understand -mevex512 is not assumed when -mavx512.* / -mavx10.* options are used.
The following seems to be enough to make the build and tests succeed on gcc-16:
--- a/hwy/ops/set_macros-inl.h
+++ b/hwy/ops/set_macros-inl.h
@@ -141,7 +141,7 @@
#define HWY_TARGET_STR_AVX2 \
HWY_TARGET_STR_SSE4 ",avx,avx2" HWY_TARGET_STR_BMI2_FMA HWY_TARGET_STR_F16C
-#if HWY_COMPILER_GCC_ACTUAL >= 1400 || HWY_COMPILER_CLANG >= 1800
+#if (HWY_COMPILER_GCC_ACTUAL >= 1400 && HWY_COMPILER_GCC_ACTUAL < 1600) || HWY_COMPILER_CLANG >= 1800
#define HWY_TARGET_STR_AVX3_VL512 ",evex512"
#else
#define HWY_TARGET_STR_AVX3_VL512
I'm not sure why entries below do not need masking:
hwy/ops/set_macros-inl.h: HWY_TARGET_STR_AVX3_SPR_256 ",no-evex512,avx10.2-256"
// ...
hwy/ops/set_macros-inl.h:#define HWY_TARGET_STR_AVX10_2 HWY_TARGET_STR_AVX3_SPR_256 ",no-evex512"
The changes in pull request #2563 should fix the issue with compiling Google Highway with GCC 16.
The changes in pull request #2563 should fix the issue with compiling Google Highway with GCC 16.
Does not fix it for me:
# fetching:
$ git fetch origin pull/2563/head:avx10
$ git checkout avx10
$ git show
commit 20790003c1c208f650b0bf9d7d46c1c63eebe2a8
Merge: 702bd460 c861f4ca
Author: John Platts <[email protected]>
Date: Wed May 21 17:40:32 2025 -0500
Merge branch 'google:master' into hwy_avx10_043025
...
# building:
$ mkdir build
$ cd build
$ cmake ..
$ make
...
[ 1%] Building CXX object CMakeFiles/hwy.dir/hwy/per_target.cc.o
cc1plus: error: attribute 'target' argument 'evex512' is unknown
cc1plus: error: attribute 'target' argument 'evex512' is unknown
cc1plus: error: attribute 'target' argument 'evex512' is unknown
...
The changes in pull request #2563 should fix the issue with compiling Google Highway with GCC 16.
Does not fix it for me:
@trofi and @jan-wassenberg I made an update in pull request #2563 that fixes the issue with GCC 16 or later
Thanks @johnplatts ! I am restarting the import and will watch this one, though with some delay because I'm out of office until Sat.
The changes in pull request #2563 should fix the issue with compiling Google Highway with GCC 16.
Does not fix it for me:
@trofi and @jan-wassenberg I made an update in pull request #2563 that fixes the issue with GCC 16 or later
That one works for me on gcc-16. Thank you!
I believe this is now fixed, please reopen if not :)