llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.42k stars 12.15k forks source link

Build failure with -march=native on Intel Core i5 13600KF (error in backend: ZMM registers are not supported without EVEX512) #91076

Closed kostadinsh closed 6 months ago

kostadinsh commented 7 months ago

LLVM fails to build when using -march=native on an Intel Core i5 13600KF, reproducible both on master at https://github.com/llvm/llvm-project/commit/cb015b9ec9446b3a1303980c095fa442d5e46fbf and version 18.1.5

FAILED: lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o 
/usr/lib/llvm/19/bin/clang -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm_build-abi_x86_64.amd64/lib/Support/BLAKE3 -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm/lib/Support/BLAKE3 -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm_build-abi_x86_64.amd64/include -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm/include  -DNDEBUG -march=native -O2 -pipe -fPIC -mavx512vl -MD -MT lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o -MF lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o.d -o lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o -c /mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S
clang -cc1as: fatal error: error in backend: ZMM registers are not supported without EVEX512

Output from `echo | clang -E - -march=native -###

clang version 19.0.0gitcb015b9e
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/19/bin
Configuration file: /etc/clang/x86_64-pc-linux-gnu-clang.cfg
 (in-process)
 "/usr/lib/llvm/19/bin/clang-19" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-E" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "alderlake" "-target-feature" "+prfchw" "-target-feature" "-cldemote" "-target-feature" "+avx" "-target-feature" "+aes" "-target-feature" "+sahf" "-target-feature" "+pclmul" "-target-feature" "-xop" "-target-feature" "+crc32" "-target-feature" "+xsaves" "-target-feature" "-avx512fp16" "-target-feature" "-usermsr" "-target-feature" "-sm4" "-target-feature" "-egpr" "-target-feature" "+sse4.1" "-target-feature" "-avx512ifma" "-target-feature" "+xsave" "-target-feature" "+sse4.2" "-target-feature" "-avx512pf" "-target-feature" "-tsxldtrk" "-target-feature" "+ptwrite" "-target-feature" "+widekl" "-target-feature" "-sm3" "-target-feature" "+invpcid" "-target-feature" "+64bit" "-target-feature" "+xsavec" "-target-feature" "-avx10.1-512" "-target-feature" "-avx512vpopcntdq" "-target-feature" "+cmov" "-target-feature" "-avx512vp2intersect" "-target-feature" "-avx512cd" "-target-feature" "+movbe" "-target-feature" "-avxvnniint8" "-target-feature" "-avx512er" "-target-feature" "-ccmp" "-target-feature" "-amx-int8" "-target-feature" "+kl" "-target-feature" "-avx10.1-256" "-target-feature" "-evex512" "-target-feature" "+avxvnni" "-target-feature" "-rtm" "-target-feature" "+adx" "-target-feature" "+avx2" "-target-feature" "+hreset" "-target-feature" "+movdiri" "-target-feature" "+serialize" "-target-feature" "-sha512" "-target-feature" "+vpclmulqdq" "-target-feature" "-avx512vl" "-target-feature" "-uintr" "-target-feature" "-cf" "-target-feature" "+clflushopt" "-target-feature" "-raoint" "-target-feature" "-cmpccxadd" "-target-feature" "+bmi" "-target-feature" "-amx-tile" "-target-feature" "+sse" "-target-feature" "+gfni" "-target-feature" "-avxvnniint16" "-target-feature" "-amx-fp16" "-target-feature" "-ndd" "-target-feature" "+xsaveopt" "-target-feature" "+rdrnd" "-target-feature" "-avx512f" "-target-feature" "-amx-bf16" "-target-feature" "-avx512bf16" "-target-feature" "-avx512vnni" "-target-feature" "-push2pop2" "-target-feature" "+cx8" "-target-feature" "-avx512bw" "-target-feature" "+sse3" "-target-feature" "+pku" "-target-feature" "+fsgsbase" "-target-feature" "-clzero" "-target-feature" "-mwaitx" "-target-feature" "-lwp" "-target-feature" "+lzcnt" "-target-feature" "+sha" "-target-feature" "+movdir64b" "-target-feature" "-ppx" "-target-feature" "-wbnoinvd" "-target-feature" "-enqcmd" "-target-feature" "-prefetchwt1" "-target-feature" "-avxneconvert" "-target-feature" "-tbm" "-target-feature" "-pconfig" "-target-feature" "-amx-complex" "-target-feature" "+ssse3" "-target-feature" "+cx16" "-target-feature" "+bmi2" "-target-feature" "+fma" "-target-feature" "+popcnt" "-target-feature" "-avxifma" "-target-feature" "+f16c" "-target-feature" "-avx512bitalg" "-target-feature" "-rdpru" "-target-feature" "+clwb" "-target-feature" "+mmx" "-target-feature" "+sse2" "-target-feature" "+rdseed" "-target-feature" "-avx512vbmi2" "-target-feature" "-prefetchi" "-target-feature" "+rdpid" "-target-feature" "-fma4" "-target-feature" "-avx512vbmi" "-target-feature" "+shstk" "-target-feature" "+vaes" "-target-feature" "+waitpkg" "-target-feature" "-sgx" "-target-feature" "+fxsr" "-target-feature" "-avx512dq" "-target-feature" "-sse4a" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/kostadin" "-fcoverage-compilation-dir=/home/kostadin" "-resource-dir" "/usr/lib/llvm/19/bin/../../../../lib/clang/19" "-include" "/usr/include/gentoo/fortify.h" "-include" "/usr/include/gentoo/maybe-stddefs.h" "-internal-isystem" "/usr/lib/llvm/19/bin/../../../../lib/clang/19/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-ferror-limit" "19" "-stack-protector" "2" "-fstack-clash-protection" "-fcf-protection=none" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fcolor-diagnostics" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "-" "-x" "c" "-"

complete build log from portage

RKSimon commented 7 months ago

CC @phoebewang

llvmbot commented 7 months ago

@llvm/issue-subscribers-backend-x86

Author: Kostadin (kostadinsh)

LLVM fails to build when using `-march=native` on an Intel Core i5 13600KF, reproducible both on master at https://github.com/llvm/llvm-project/commit/cb015b9ec9446b3a1303980c095fa442d5e46fbf and version 18.1.5 ``` FAILED: lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o /usr/lib/llvm/19/bin/clang -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm_build-abi_x86_64.amd64/lib/Support/BLAKE3 -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm/lib/Support/BLAKE3 -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm_build-abi_x86_64.amd64/include -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm/include -DNDEBUG -march=native -O2 -pipe -fPIC -mavx512vl -MD -MT lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o -MF lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o.d -o lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o -c /mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S clang -cc1as: fatal error: error in backend: ZMM registers are not supported without EVEX512 ``` Output from `echo | clang -E - -march=native -### ``` clang version 19.0.0gitcb015b9e Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm/19/bin Configuration file: /etc/clang/x86_64-pc-linux-gnu-clang.cfg (in-process) "/usr/lib/llvm/19/bin/clang-19" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-E" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "alderlake" "-target-feature" "+prfchw" "-target-feature" "-cldemote" "-target-feature" "+avx" "-target-feature" "+aes" "-target-feature" "+sahf" "-target-feature" "+pclmul" "-target-feature" "-xop" "-target-feature" "+crc32" "-target-feature" "+xsaves" "-target-feature" "-avx512fp16" "-target-feature" "-usermsr" "-target-feature" "-sm4" "-target-feature" "-egpr" "-target-feature" "+sse4.1" "-target-feature" "-avx512ifma" "-target-feature" "+xsave" "-target-feature" "+sse4.2" "-target-feature" "-avx512pf" "-target-feature" "-tsxldtrk" "-target-feature" "+ptwrite" "-target-feature" "+widekl" "-target-feature" "-sm3" "-target-feature" "+invpcid" "-target-feature" "+64bit" "-target-feature" "+xsavec" "-target-feature" "-avx10.1-512" "-target-feature" "-avx512vpopcntdq" "-target-feature" "+cmov" "-target-feature" "-avx512vp2intersect" "-target-feature" "-avx512cd" "-target-feature" "+movbe" "-target-feature" "-avxvnniint8" "-target-feature" "-avx512er" "-target-feature" "-ccmp" "-target-feature" "-amx-int8" "-target-feature" "+kl" "-target-feature" "-avx10.1-256" "-target-feature" "-evex512" "-target-feature" "+avxvnni" "-target-feature" "-rtm" "-target-feature" "+adx" "-target-feature" "+avx2" "-target-feature" "+hreset" "-target-feature" "+movdiri" "-target-feature" "+serialize" "-target-feature" "-sha512" "-target-feature" "+vpclmulqdq" "-target-feature" "-avx512vl" "-target-feature" "-uintr" "-target-feature" "-cf" "-target-feature" "+clflushopt" "-target-feature" "-raoint" "-target-feature" "-cmpccxadd" "-target-feature" "+bmi" "-target-feature" "-amx-tile" "-target-feature" "+sse" "-target-feature" "+gfni" "-target-feature" "-avxvnniint16" "-target-feature" "-amx-fp16" "-target-feature" "-ndd" "-target-feature" "+xsaveopt" "-target-feature" "+rdrnd" "-target-feature" "-avx512f" "-target-feature" "-amx-bf16" "-target-feature" "-avx512bf16" "-target-feature" "-avx512vnni" "-target-feature" "-push2pop2" "-target-feature" "+cx8" "-target-feature" "-avx512bw" "-target-feature" "+sse3" "-target-feature" "+pku" "-target-feature" "+fsgsbase" "-target-feature" "-clzero" "-target-feature" "-mwaitx" "-target-feature" "-lwp" "-target-feature" "+lzcnt" "-target-feature" "+sha" "-target-feature" "+movdir64b" "-target-feature" "-ppx" "-target-feature" "-wbnoinvd" "-target-feature" "-enqcmd" "-target-feature" "-prefetchwt1" "-target-feature" "-avxneconvert" "-target-feature" "-tbm" "-target-feature" "-pconfig" "-target-feature" "-amx-complex" "-target-feature" "+ssse3" "-target-feature" "+cx16" "-target-feature" "+bmi2" "-target-feature" "+fma" "-target-feature" "+popcnt" "-target-feature" "-avxifma" "-target-feature" "+f16c" "-target-feature" "-avx512bitalg" "-target-feature" "-rdpru" "-target-feature" "+clwb" "-target-feature" "+mmx" "-target-feature" "+sse2" "-target-feature" "+rdseed" "-target-feature" "-avx512vbmi2" "-target-feature" "-prefetchi" "-target-feature" "+rdpid" "-target-feature" "-fma4" "-target-feature" "-avx512vbmi" "-target-feature" "+shstk" "-target-feature" "+vaes" "-target-feature" "+waitpkg" "-target-feature" "-sgx" "-target-feature" "+fxsr" "-target-feature" "-avx512dq" "-target-feature" "-sse4a" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/kostadin" "-fcoverage-compilation-dir=/home/kostadin" "-resource-dir" "/usr/lib/llvm/19/bin/../../../../lib/clang/19" "-include" "/usr/include/gentoo/fortify.h" "-include" "/usr/include/gentoo/maybe-stddefs.h" "-internal-isystem" "/usr/lib/llvm/19/bin/../../../../lib/clang/19/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-ferror-limit" "19" "-stack-protector" "2" "-fstack-clash-protection" "-fcf-protection=none" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fcolor-diagnostics" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "-" "-x" "c" "-" ``` [complete build log from portage](https://github.com/llvm/llvm-project/files/15210489/build.log)
phoebewang commented 7 months ago

I think the error is expected. Using -march=native on 13600KF will turn off all avx512 features as well as evex512. The problem here is the command adding an extra -mavx512vl, so the frontend interprets it as -mavx512vl -mno-evex512. With this combination, compiler is reasonable to error when compiling 512-bit instructions.

I think it doesn't make sense to compile -march=native with extra features. In this case, you can either remove -mavx512vl or add extra -mevex512 together.

kostadinsh commented 7 months ago

the -mavx512vl flag wasn't added by me tho. It was added by the build system somehow.

Kawanaao commented 7 months ago

Same for me, i have no idea why clang trying to compile avx512 file, but in fact - clang is trying to use -mavx512vl specifically for blake3_avx512_x86-64_unix.S.o

phoebewang commented 7 months ago

I'm not familar with cmake settings. Maybe file another issue to cmake?

sergeev917 commented 6 months ago

@phoebewang Let me describe the situation when such problems appear. First, we have some libraries/applications use runtime cpu dispatching -- essentially building some code with different architecture flags and then selecting between implementations in runtime by querying cpuid. Build systems for such projects are intentionally configured to inject additional flags during the build -- flags like -mavx512xxx for avx512-version of implementation. Second, we have the project consumers who build the project from source and use -march=native. In particular, Gentoo Linux allows its users to build system packages from sources in such manner.

I think it doesn't make sense to compile -march=native with extra features.

Well, it might as well be when we have a single party, but in this case there are two parties and intentions of both of them are somewhat reasonable.

Then we have a question regarding consistency. -march=sandybridge -mavx512f -mavx512vl does not have a lot of sense either, but it will enable avx512 and evex512 nonetheless. -march=native -mavx512f -mavx512vl for processors before avx512/avx10 will effectively use -mavx512f -mavx512vl -mno-evex512 which in turn enables __AVX512F__, __AVX512VL__, __EVEX256__ -- essentially meaning avx10-256 and that is a bad take on the situation:

$ clang++ -march=native -mavx512f -mavx512vl   -dM -E -v - </dev/null 2>&1 | grep 'AVX512\|EVEX'
#define __AVX512F__ 1
#define __AVX512VL__ 1
#define __EVEX256__ 1

It appears to me that it would be better either to explicitly disallow usage of -march=native together with additional arch options like -mavx512f (we will not silently end up with avx10-256 instead of expected avx512) or to avoid assuming -mno-evex512 when processing -march=native similarly to how -march=sandybridge works (which also does not have evex512 feature, but -mno-evex512 is not assumed in this case). Personally, I would prefer the second option as it is both more consistent and fixes the above-mentioned usecase.

llvmbot commented 6 months ago

@llvm/issue-subscribers-clang-driver

Author: Kostadin (kostadinsh)

LLVM fails to build when using `-march=native` on an Intel Core i5 13600KF, reproducible both on master at https://github.com/llvm/llvm-project/commit/cb015b9ec9446b3a1303980c095fa442d5e46fbf and version 18.1.5 ``` FAILED: lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o /usr/lib/llvm/19/bin/clang -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm_build-abi_x86_64.amd64/lib/Support/BLAKE3 -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm/lib/Support/BLAKE3 -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm_build-abi_x86_64.amd64/include -I/mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm/include -DNDEBUG -march=native -O2 -pipe -fPIC -mavx512vl -MD -MT lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o -MF lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o.d -o lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o -c /mnt/portage/portage/sys-devel/llvm-19.0.0.9999/work/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S clang -cc1as: fatal error: error in backend: ZMM registers are not supported without EVEX512 ``` Output from `echo | clang -E - -march=native -### ``` clang version 19.0.0gitcb015b9e Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm/19/bin Configuration file: /etc/clang/x86_64-pc-linux-gnu-clang.cfg (in-process) "/usr/lib/llvm/19/bin/clang-19" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-E" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "alderlake" "-target-feature" "+prfchw" "-target-feature" "-cldemote" "-target-feature" "+avx" "-target-feature" "+aes" "-target-feature" "+sahf" "-target-feature" "+pclmul" "-target-feature" "-xop" "-target-feature" "+crc32" "-target-feature" "+xsaves" "-target-feature" "-avx512fp16" "-target-feature" "-usermsr" "-target-feature" "-sm4" "-target-feature" "-egpr" "-target-feature" "+sse4.1" "-target-feature" "-avx512ifma" "-target-feature" "+xsave" "-target-feature" "+sse4.2" "-target-feature" "-avx512pf" "-target-feature" "-tsxldtrk" "-target-feature" "+ptwrite" "-target-feature" "+widekl" "-target-feature" "-sm3" "-target-feature" "+invpcid" "-target-feature" "+64bit" "-target-feature" "+xsavec" "-target-feature" "-avx10.1-512" "-target-feature" "-avx512vpopcntdq" "-target-feature" "+cmov" "-target-feature" "-avx512vp2intersect" "-target-feature" "-avx512cd" "-target-feature" "+movbe" "-target-feature" "-avxvnniint8" "-target-feature" "-avx512er" "-target-feature" "-ccmp" "-target-feature" "-amx-int8" "-target-feature" "+kl" "-target-feature" "-avx10.1-256" "-target-feature" "-evex512" "-target-feature" "+avxvnni" "-target-feature" "-rtm" "-target-feature" "+adx" "-target-feature" "+avx2" "-target-feature" "+hreset" "-target-feature" "+movdiri" "-target-feature" "+serialize" "-target-feature" "-sha512" "-target-feature" "+vpclmulqdq" "-target-feature" "-avx512vl" "-target-feature" "-uintr" "-target-feature" "-cf" "-target-feature" "+clflushopt" "-target-feature" "-raoint" "-target-feature" "-cmpccxadd" "-target-feature" "+bmi" "-target-feature" "-amx-tile" "-target-feature" "+sse" "-target-feature" "+gfni" "-target-feature" "-avxvnniint16" "-target-feature" "-amx-fp16" "-target-feature" "-ndd" "-target-feature" "+xsaveopt" "-target-feature" "+rdrnd" "-target-feature" "-avx512f" "-target-feature" "-amx-bf16" "-target-feature" "-avx512bf16" "-target-feature" "-avx512vnni" "-target-feature" "-push2pop2" "-target-feature" "+cx8" "-target-feature" "-avx512bw" "-target-feature" "+sse3" "-target-feature" "+pku" "-target-feature" "+fsgsbase" "-target-feature" "-clzero" "-target-feature" "-mwaitx" "-target-feature" "-lwp" "-target-feature" "+lzcnt" "-target-feature" "+sha" "-target-feature" "+movdir64b" "-target-feature" "-ppx" "-target-feature" "-wbnoinvd" "-target-feature" "-enqcmd" "-target-feature" "-prefetchwt1" "-target-feature" "-avxneconvert" "-target-feature" "-tbm" "-target-feature" "-pconfig" "-target-feature" "-amx-complex" "-target-feature" "+ssse3" "-target-feature" "+cx16" "-target-feature" "+bmi2" "-target-feature" "+fma" "-target-feature" "+popcnt" "-target-feature" "-avxifma" "-target-feature" "+f16c" "-target-feature" "-avx512bitalg" "-target-feature" "-rdpru" "-target-feature" "+clwb" "-target-feature" "+mmx" "-target-feature" "+sse2" "-target-feature" "+rdseed" "-target-feature" "-avx512vbmi2" "-target-feature" "-prefetchi" "-target-feature" "+rdpid" "-target-feature" "-fma4" "-target-feature" "-avx512vbmi" "-target-feature" "+shstk" "-target-feature" "+vaes" "-target-feature" "+waitpkg" "-target-feature" "-sgx" "-target-feature" "+fxsr" "-target-feature" "-avx512dq" "-target-feature" "-sse4a" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/kostadin" "-fcoverage-compilation-dir=/home/kostadin" "-resource-dir" "/usr/lib/llvm/19/bin/../../../../lib/clang/19" "-include" "/usr/include/gentoo/fortify.h" "-include" "/usr/include/gentoo/maybe-stddefs.h" "-internal-isystem" "/usr/lib/llvm/19/bin/../../../../lib/clang/19/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-ferror-limit" "19" "-stack-protector" "2" "-fstack-clash-protection" "-fcf-protection=none" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fcolor-diagnostics" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "-" "-x" "c" "-" ``` [complete build log from portage](https://github.com/llvm/llvm-project/files/15210489/build.log)
phoebewang commented 6 months ago

Then we have a question regarding consistency. -march=sandybridge -mavx512f -mavx512vl does not have a lot of sense either, but it will enable avx512 and evex512 nonetheless. -march=native -mavx512f -mavx512vl for processors before avx512/avx10 will effectively use -mavx512f -mavx512vl -mno-evex512 which in turn enables __AVX512F__, __AVX512VL__, __EVEX256__ -- essentially meaning avx10-256 and that is a bad take on the situation:

Makes sense to me. Created https://github.com/llvm/llvm-project/pull/91694 for this, PTAL, thanks!

RandomDSdevel commented 6 months ago

     I also hit this issue and submitted a bug report for it to Gentoo's Bugzilla instance; that's https://bugs.gentoo.org/931656.