highway icon indicating copy to clipboard operation
highway copied to clipboard

gcc-16 dropped `evex512`, build fails as: cc1plus: error: attribute 'target' argument 'evex512' is unknown

Open trofi opened this issue 7 months ago • 6 comments

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.

trofi avatar May 21 '25 21:05 trofi

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"

trofi avatar May 21 '25 21:05 trofi

The changes in pull request #2563 should fix the issue with compiling Google Highway with GCC 16.

johnplatts avatar May 21 '25 22:05 johnplatts

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

trofi avatar May 22 '25 05:05 trofi

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

johnplatts avatar May 22 '25 14:05 johnplatts

Thanks @johnplatts ! I am restarting the import and will watch this one, though with some delay because I'm out of office until Sat.

jan-wassenberg avatar May 22 '25 15:05 jan-wassenberg

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!

trofi avatar May 22 '25 18:05 trofi

I believe this is now fixed, please reopen if not :)

jan-wassenberg avatar Jul 04 '25 09:07 jan-wassenberg