With latest version of ebuilds (and eclesses) I try to build system with "-O2" flag and get bootratap error for compiler. Reproducible: Always Steps to Reproduce: 1. Set COMMON_FLAGS="-O3 -pipe -march=native" into /etc/portage/make.conf 2. Run command "emerge -avO sys-devel/gcc" Actual Results: Botstrap stage failed. Expected Results: Bootstrap stage ok.
"emerge --info" output - into "URL" field of bug information.
Created attachment 872353 [details] temp directory with build artifacts (log, etc)
(In reply to Andrei Liavonchykau from comment #1) > "emerge --info" output - into "URL" field of bug information. emerge --info output needs to be a comment on this bug
Created attachment 872356 [details] "emerge --info" output
(In reply to Andrei Liavonchykau from comment #2) > Created attachment 872353 [details] > temp directory with build artifacts (log, etc) Please include the tarball it mentions at the end of build.log: > [31;01m*[0m Please include /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/gcc-build-logs.tar.xz in your bug report. I might need you to upload some of the differing files as well but we can do that in a minute.
Created attachment 872357 [details] build logs
(In reply to Sam James from comment #5) > (In reply to Andrei Liavonchykau from comment #2) > > Created attachment 872353 [details] > > temp directory with build artifacts (log, etc) > > Please include the tarball it mentions at the end of build.log: > > [31;01m*[0m Please include /var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/gcc-build-logs.tar.xz in your bug report. > > I might need you to upload some of the differing files as well but we can do > that in a minute. Done. P.S.: I’m having trouble thinking at night, I’m still trying to fix a complex dependency of 5 packages...
Could you find *both* versions of the following (I've picked a subset of the list of differing files in the log): gcc/crtfastmath.o differs gcc/32/crtprec80.o differs gcc/32/crtprec64.o differs x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/atomicity.o differs x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/tinfo2.o differs x86_64-pc-linux-gnu/32/libgcc/eqhf2.o differs x86_64-pc-linux-gnu/32/libgcc/trunchfbf2.o differs x86_64-pc-linux-gnu/32/libgcc/truncsfbf2.o differs x86_64-pc-linux-gnu/libgcc/eqtf2_s.o differs x86_64-pc-linux-gnu/libgcc/eqhf2_s.o differs x86_64-pc-linux-gnu/libgcc/floatuntibf_s.o differs x86_64-pc-linux-gnu/libgcc/floattihf_s.o differs in a tarball where you put the old variants in old/, and the newer ones in new/? (All the old versions of e.g. crtfastmath.o should be under one diff. directory for stage2, then a newer version in another dir for stage3) We should really add some helper to the eclass to do this
Ugh, limitation to posting the link... Pls, remove spaces ;) All "work/build" directory: https : // drive.google.com /file/d/1zm-5TK3-ciz0i_1c2jNtkZtif_TnM9sT/view?usp=sharing
Could you try attach it here as a tarball?
(In reply to Sam James from comment #10) > Could you try attach it here as a tarball? nevermind, I see it's too big.
Okay, this looks familiar, actually. ``` $ diffoscope ./stage2-x86_64-pc-linux-gnu/32/libgcc/eqhf2.o ./stage3-x86_64-pc-linux-gnu/32/libgcc/eqhf2.o ``` [...] │ - [ 33] GNU C17 13.2.1 20230826 -march=alderlake -mmmx -mpopcnt -msse -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno-avx512vbmi2 -mgfni -mvpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mmovdir64b -mmovdiri -mno-mwaitx -mpconfig -mpku -mno-prefetchwt1 -mprfchw -mptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mserialize -mno-sgx -msha -mshstk -mno-tbm -mno-tsxldtrk -mvaes -mwaitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mhreset -mno-kl -mno-widekl -mavxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex --param=l1-cache-size=48 --param=l1-cache-line-size=64 --param=l2-cache-size=24576 -mtune=alderlake -m32 -mlong-double-80 -msse2 -g -g -g -O2 -O3 -O2 -O2 -O3 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection -fpic -fvisibility=hidden │ - [ 578] _Float16 │ - [ 581] _FP_UNPACK_RAW_1_flo │ - [ 596] long long unsigned int │ - [ 5ad] sign │ - [ 5b2] _fcw │ + [ 33] _Float16 │ + [ 3c] _FP_UNPACK_RAW_1_flo │ + [ 51] long long unsigned int │ + [ 68] sign │ + [ 6d] _fcw │ + [ 72] GNU C17 13.2.1 20230826 -march=alderlake -mmmx -mpopcnt -msse -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno-avx512vbmi2 -mgfni -mvpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mmovdir64b -mmovdiri -mno-mwaitx -mpconfig -mpku -mno-prefetchwt1 -mprfchw -mptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mserialize -mno-sgx -msha -mshstk -mno-tbm -mno-tsxldtrk -mvaes -mwaitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mhreset -mno-kl -mno-widekl -mavxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=24576 -mtune=alderlake -m32 -mlong-double-80 -msse2 -g -g -g -O2 -O3 -O2 -O2 -O3 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection -fpic -fvisibility=hidden [...] ``` $ wdiff /tmp/a /tmp/b <d> DW_AT_producer : (strp) (offset: [-0x33):-] {+0x72):+} GNU C17 13.2.1 20230826 -march=alderlake -mmmx -mpopcnt -msse -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno-avx512vbmi2 -mgfni -mvpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mmovdir64b -mmovdiri -mno-mwaitx -mpconfig -mpku -mno-prefetchwt1 -mprfchw -mptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mserialize -mno-sgx -msha -mshstk -mno-tbm -mno-tsxldtrk -mvaes -mwaitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mhreset -mno-kl -mno-widekl -mavxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex [---param=l1-cache-size=48-] {+--param=l1-cache-size=32+} --param=l1-cache-line-size=64 --param=l2-cache-size=24576 -mtune=alderlake -m32 -mlong-double-80 -msse2 -g -g -g -O2 -O3 -O2 -O2 -O3 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection -fpic -fvisibility=hidden We have two differences: * the offset (let's ignore that) * l1 cache size: [---param=l1-cache-size=48-] {+--param=l1-cache-size=32+}
In bug 904426, we had both the same cache size problem but specifically involving alderlake too.
(In reply to Sam James from comment #13) > In bug 904426, we had both the same cache size problem but specifically > involving alderlake too. Hm, thanks for information - this is work for me - change "-march=native" to "-march=alderlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=24576" (from output of command 'resolve-march-native').
Alder Lake and Raptor Lake CPUs employ a hybrid architecture with two different cores (named P- and E-cores). They differ in performance and power consumption, and most importantly here cache sizes. The datasheets for Alder Lake [1] and Raptor Lake [2] list the cache sizes as: > L1 Data cache (DCU) - 48KB (P-core) - 32KB (E-Core) > L1 Instruction cache (IFU) - 32KB (P-Core) - 64KB (E-Core) > MLC - Mid Level Cache - 1.25MB (P-Core) - 2MB (shared by 4 E-Cores) Looking at the observed differences in `--param=l1-cache-size` it seems reasonable to assume that `-march=native` resolution ran once on a P-core and once on a E-core. This needs to be fixed upstream. Stop-gap solutions include: - using resolve-march-native - disable e-cores - changing cpu affinity, pinning -march=native resolution the same core type in all stages. [1] https://edc.intel.com/content/www/us/en/design/ipla/software-development-platforms/client/platforms/alder-lake-desktop/12th-generation-intel-core-processors-datasheet-volume-1-of-2/ia-cores-level-1-and-level-2-caches/ [2] https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/003/ia-cores-level-1-and-level-2-caches/
Microcode version and lack of updates might effect the outcome as well. Early Alder Lake CPUs reported different CPUIDs for P- and E-Cores. There might be changes to the scheduling between different cores (see Intel Thread Director). At the moment it looks like stage 3 is started on the "cooler" E-cores (see L1 Data Cache size going from 48 KB to 32 KB).
Created attachment 872522 [details] Result from resolv-march-native, running 20k over a loop Discusing on -chat about it, we ran a loop of the resolv-march-native command on an alder lake box, and it returned the l1-cache-size=32 instead of 48, 41 times (in a loop of 20000).
Filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111768 upstream.
ht Flow: same cause https://www.mono-project.com/news/2016/09/12/arm64-icache/
Hi, Sam. On my case, this is Raptor Lake arch. Into GCC bugzilla, you fill only a Alder Lake arch.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4fa415cae875ccdade883e8e144d48f9834b91d2 commit 4fa415cae875ccdade883e8e144d48f9834b91d2 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-11-26 23:15:00 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-11-26 23:18:02 +0000 sys-devel/gcc: add 14.0.0_pre20231126 Closes: https://bugs.gentoo.org/915389 Closes: https://bugs.gentoo.org/918090 Closes: https://bugs.gentoo.org/918115 Signed-off-by: Sam James <sam@gentoo.org> sys-devel/gcc/Manifest | 1 + sys-devel/gcc/gcc-14.0.0_pre20231126.ebuild | 64 +++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+)
Sorry, I didn't mean to close this (tagged wrong bug). (In reply to Andrei Liavonchykau from comment #20) > Hi, Sam. > On my case, this is Raptor Lake arch. Into GCC bugzilla, you fill only a > Alder Lake arch. Thanks, this is fine though, it's about the general principle of hybrid CPUs.
Hi, Sam. I sync portage, try to build sys-devel/gcc-14.0.0_pre20231126 with "-march=native" option and get same error
Created attachment 875829 [details] Build logs
$ diffoscope stage2-x86_64-pc-linux-gnu/libgcc/_gcov_fork.o stage3-x86_64-pc-linux-gnu/libgcc/_gcov_fork.o [...] │ - [ 35] GNU C17 14.0.0 20231126 (experimental) -march=alderlake -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno-avx512vbmi2 -mgfni -mvpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mmovdir64b -mmovdiri -mno-mwaitx -mpconfig -mpku -mno-prefetchwt1 -mprfchw -mptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mserialize -mno-sgx -msha -mshstk -mno-tbm -mno-tsxldtrk -mvaes -mwaitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mhreset -mno-kl -mno-widekl -mavxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex -mno-avxvnniint16 -mno-sm3 -mno-sha512 -mno-sm4 -mno-apxf -musermsr --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=24576 -mtune=alderlake -mlong-double-80 -g -g -g -O2 -O3 -O2 -O2 -O3 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection -fpic │ - [ 5b4] __data │ - [ 5bb] pid_t │ - [ 5c1] __pthread_mutex_s │ - [ 5d3] __owner │ - [ 5db] __kind │ - [ 5e2] pthread_mutex_t │ - [ 5f2] __lock │ - [ 5f9] __size │ - [ 600] unsigned char │ - [ 60e] __gcov_fork │ - [ 61a] long unsigned int │ + [ 35] __data │ + [ 3c] pid_t │ + [ 42] __pthread_mutex_s │ + [ 54] __owner │ + [ 5c] __kind │ + [ 63] pthread_mutex_t │ + [ 73] __lock │ + [ 7a] __size │ + [ 81] unsigned char │ + [ 8f] __gcov_fork │ + [ 9b] long unsigned int │ + [ ad] GNU C17 14.0.0 20231126 (experimental) -march=alderlake -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno-avx512vbmi2 -mgfni -mvpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mmovdir64b -mmovdiri -mno-mwaitx -mpconfig -mpku -mno-prefetchwt1 -mprfchw -mptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mserialize -mno-sgx -msha -mshstk -mno-tbm -mno-tsxldtrk -mvaes -mwaitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mhreset -mno-kl -mno-widekl -mavxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex -mno-avxvnniint16 -mno-sm3 -mno-sha512 -mno-sm4 -mno-apxf -musermsr --param=l1-cache-size=48 --param=l1-cache-line-size=64 --param=l2-cache-size=24576 -mtune=alderlake -mlong-double-80 -g -g -g -O2 -O3 -O2 -O2 -O3 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection -fpic [...]
Sorry, to be clear, I accidentally tagged this bug with a typo for another issue and it's definitely not fixed. Just pretend that didn't happen - sorry for the noise!
Could someone with a hybrid CPU show me: * cat /proc/cpuinfo * lscpu -p Thanks
Created attachment 888275 [details] lscpu -p
Created attachment 888276 [details] cat /proc/cpuinfo
(In reply to Sam James from comment #27) > Could someone with a hybrid CPU show me: > * cat /proc/cpuinfo > * lscpu -p > > Thanks Hey, Sam, please check if this is it.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4fba38fc35fe2966574dd6bfd68ee82cd354976c commit 4fba38fc35fe2966574dd6bfd68ee82cd354976c Author: Sam James <sam@gentoo.org> AuthorDate: 2024-03-23 14:16:38 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-03-23 14:48:47 +0000 toolchain.eclass: add workaround for hybrid CPUs Hybrid/big.little/PE CPUs may report an inconsistent cache size across cores which can cause GCC's bootstrapping to fail its self-comparison. When CBUILD is amd64 or x86 and -march=native is in CFLAGS, iterate over all cores and record l1-cache-size. If any differ, use the first one we found. Bug: https://gcc.gnu.org/PR111768 Closes: https://bugs.gentoo.org/904426 Closes: https://bugs.gentoo.org/908523 Closes: https://bugs.gentoo.org/915389 Signed-off-by: Sam James <sam@gentoo.org> eclass/toolchain.eclass | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Thank you everyone for helping.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f64da62e50ad607de3a95b6a1d0d2ed8ba8bd268 commit f64da62e50ad607de3a95b6a1d0d2ed8ba8bd268 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-03-24 14:05:00 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-03-24 14:05:31 +0000 toolchain.eclass: improve hybrid check Thanks to stikonas for debugging on IRC. Bug: https://bugs.gentoo.org/904426 Bug: https://bugs.gentoo.org/908523 Bug: https://bugs.gentoo.org/915389 Signed-off-by: Sam James <sam@gentoo.org> eclass/toolchain.eclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Hi, Sam. I try to build a GCC with this WA, but it's still failing. On "build.log" I see a additional flags: > >>> Configuring source in /var/tmp/portage/sys-devel/gcc-13.2.1_p20240210/work/gcc-13-20240210 ... > * CFLAGS="-pipe -march=native -O3 --param=l1-cache-size=32" > * CXXFLAGS="-pipe -march=native -O3 --param=l1-cache-size=32" # diffoscope ./stage2-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/atomicity.o ./stage3-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/atomicity.o [....] │ - <d> DW_AT_producer : (strp) (offset: 0x8b): GNU C++17 13.2.1 20240210 -march=alderlake -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno-avx512vbmi2 -mgfni -mvpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mmovdir64b -mmovdiri -mno-mwaitx -mpconfig -mno-pku -mno-prefetchwt1 -mprfchw -mptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mserialize -mno-sgx -msha -mno-tbm -mno-tsxldtrk -mvaes -mwaitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mhreset -mno-kl -mno-widekl -mavxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex --param=l1-cache-size=48 --param=l1-cache-line-size=64 --param=l2-cache-size=24576 -mtune=alderlake -mshstk -g -O2 -O3 -fno-implicit-templates -ffunction-sections -fdata-sections -frandom-seed=atomicity.lo -fcf-protection=full -fPIC --param=l1-cache-size=32 │ + <d> DW_AT_producer : (strp) (offset: 0x64): GNU C++17 13.2.1 20240210 -march=alderlake -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno-avx512vbmi2 -mgfni -mvpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mmovdir64b -mmovdiri -mno-mwaitx -mpconfig -mno-pku -mno-prefetchwt1 -mprfchw -mptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mserialize -mno-sgx -msha -mno-tbm -mno-tsxldtrk -mvaes -mwaitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mhreset -mno-kl -mno-widekl -mavxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=24576 -mtune=alderlake -mshstk -g -O2 -O3 -fno-implicit-templates -ffunction-sections -fdata-sections -frandom-seed=atomicity.lo -fcf-protection=full -fPIC --param=l1-cache-size=32 [....] │ - [ 8b] GNU C++17 13.2.1 20240210 -march=alderlake -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno-avx512vbmi2 -mgfni -mvpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mmovdir64b -mmovdiri -mno-mwaitx -mpconfig -mno-pku -mno-prefetchwt1 -mprfchw -mptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mserialize -mno-sgx -msha -mno-tbm -mno-tsxldtrk -mvaes -mwaitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mhreset -mno-kl -mno-widekl -mavxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex --param=l1-cache-size=48 --param=l1-cache-line-size=64 --param=l2-cache-size=24576 -mtune=alderlake -mshstk -g -O2 -O3 -fno-implicit-templates -ffunction-sections -fdata-sections -frandom-seed=atomicity.lo -fcf-protection=full -fPIC --param=l1-cache-size=32 │ + [ 64] GNU C++17 13.2.1 20240210 -march=alderlake -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno-avx512vbmi2 -mgfni -mvpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mmovdir64b -mmovdiri -mno-mwaitx -mpconfig -mno-pku -mno-prefetchwt1 -mprfchw -mptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mserialize -mno-sgx -msha -mno-tbm -mno-tsxldtrk -mvaes -mwaitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mhreset -mno-kl -mno-widekl -mavxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=24576 -mtune=alderlake -mshstk -g -O2 -O3 -fno-implicit-templates -ffunction-sections -fdata-sections -frandom-seed=atomicity.lo -fcf-protection=full -fPIC --param=l1-cache-size=32
Is there any chance you'd mind hopping onto IRC, either #gentoo or #gentoo-toolchain so we can debug it together? It's OK if not.
I'm already on #gentoo-toolchain, https://web.libera.chat/#gentoo-toolchain
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e897f91e8e81b8168e7045db2f6d8dd9ebdb9ddf commit e897f91e8e81b8168e7045db2f6d8dd9ebdb9ddf Author: Sam James <sam@gentoo.org> AuthorDate: 2024-03-24 17:19:46 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-03-24 17:47:08 +0000 toolchain.eclass: abort if hybrid CPU detected w/ -march=native Unfortunately, the previous approach can't work. --param doesn't fully wipe out the previous value added by -march=native, so we still get a failed comparison. Users hitting this should install app-misc/resolve-march-native, run resolve-march-native, and use that in their *FLAGS instead of -march=native - at least for sys-devel/gcc via package.env, if not in make.conf. Therefore, our only real option is to just abort when we detect a problematic situation and tell users what to do. The only other idea I had was to try taskset in src_compile which feels super brittle and not sure it'd even work at all. Thanks to Andrei for testing and debugging with us on IRC & the bug. Bug: https://bugs.gentoo.org/904426 Bug: https://bugs.gentoo.org/908523 Bug: https://bugs.gentoo.org/915389 Bug: https://bugs.gentoo.org/927688 Thanks-to: Andrei Liavonchykau <andreil499@gmail.com> Signed-off-by: Sam James <sam@gentoo.org> eclass/toolchain.eclass | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
If "resolve-march-native" reports different "l1-cache-size" values from run to run, should I continue with the bigger value (48) or the smaller value (32)? # resolve-march-native -march=alderlake -mabm -mno-cldemote -mno-kl -mno-pconfig -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=12288 # resolve-march-native -march=alderlake -mabm -mno-cldemote -mno-kl -mno-pconfig -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=12288 # cat /proc/cpuinfo | grep name | head -n1 model name : 13th Gen Intel(R) Core(TM) i7-1355U
(In reply to Steffen Weber from comment #38) > If "resolve-march-native" reports different "l1-cache-size" values from run > to run, should I continue with the bigger value (48) or the smaller value > (32)? > > # resolve-march-native > -march=alderlake -mabm -mno-cldemote -mno-kl -mno-pconfig -mno-sgx > -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 > --param=l2-cache-size=12288 > > # resolve-march-native > -march=alderlake -mabm -mno-cldemote -mno-kl -mno-pconfig -mno-sgx > -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 > --param=l2-cache-size=12288 > > # cat /proc/cpuinfo | grep name | head -n1 > model name : 13th Gen Intel(R) Core(TM) i7-1355U It doesn't matter really if it's just for GCC, but I think the smaller is preferable.
*** Bug 927718 has been marked as a duplicate of this bug. ***
Looks like strip-flags removes most of the flags suggested by `resolve-march-native`, and thus it still fails: >>> Configuring source in /var/tmp/portage/sys-devel/gcc-13.2.1_p20240210/work/gcc-13-20240210 ... * strip-flags: CFLAGS: changed '-O2 -march=native -fomit-frame-pointer -g -ftree-slp-vectorize -falign-functions=32 -g0 -march=alderlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=25600' to '-O2 -march=native -g -g0 -march=alderlake' Since I only appended CFLAGS, I implied that the latter overrides the former march. I may be wrong here. But I think that stripping the flags in the ebuild is the main problem. For the moment, I'm running emerge with `taskset -c 0-15 ...` and it works.
(In reply to Kai Krakow from comment #41) > Looks like strip-flags removes most of the flags suggested by > `resolve-march-native`, and thus it still fails: > > >>> Configuring source in /var/tmp/portage/sys-devel/gcc-13.2.1_p20240210/work/gcc-13-20240210 ... > * strip-flags: CFLAGS: changed '-O2 -march=native -fomit-frame-pointer -g > -ftree-slp-vectorize -falign-functions=32 -g0 -march=alderlake -mabm > -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk > --param=l1-cache-line-size=64 --param=l1-cache-size=32 > --param=l2-cache-size=25600' to '-O2 -march=native -g -g0 -march=alderlake' > You can't keep the -march=native in there - that's why it's a problem. Subsequent --param won't help which is why our earlier workaround failed. We can add more of these to the filter exemption, but it won't actually help.
Yes, you need to remove "-march=native" and use a march variant from script, with all sets of flags.
I've removed the -march=native in favor of what resolve-march-native says and the result after filtering is: * strip-flags: CFLAGS: changed '-march=alderlake -mabm -mno-cldemote -mno-kl -mno-pconfig -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=36864 -O2 -pipe' to '-march=alderlake -O2 -pipe' * strip-flags: CXXFLAGS: changed '-march=alderlake -mabm -mno-cldemote -mno-kl -mno-pconfig -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=36864 -O2 -pipe' to '-march=alderlake -O2 -pipe' * CFLAGS="-march=alderlake -pipe -O2" * CXXFLAGS="-march=alderlake -pipe -O2" * LDFLAGS="-Wl,--as-needed -Wl,--sort-common -Wl,-O2 -fuse-ld=bfd" Isn't it a bad idea to remove the -mno-* flags?
(In reply to David Carlos Manuelda from comment #44) > I've removed the -march=native in favor of what resolve-march-native says > and the result after filtering is: > > * strip-flags: CFLAGS: changed '-march=alderlake -mabm -mno-cldemote > -mno-kl -mno-pconfig -mno-sgx -mno-widekl -mshstk > --param=l1-cache-line-size=64 --param=l1-cache-size=48 > --param=l2-cache-size=36864 -O2 -pipe' to '-march=alderlake -O2 -pipe' > * strip-flags: CXXFLAGS: changed '-march=alderlake -mabm -mno-cldemote > -mno-kl -mno-pconfig -mno-sgx -mno-widekl -mshstk > --param=l1-cache-line-size=64 --param=l1-cache-size=48 > --param=l2-cache-size=36864 -O2 -pipe' to '-march=alderlake -O2 -pipe' > * CFLAGS="-march=alderlake -pipe -O2" > * CXXFLAGS="-march=alderlake -pipe -O2" > * LDFLAGS="-Wl,--as-needed -Wl,--sort-common -Wl,-O2 -fuse-ld=bfd" > > Isn't it a bad idea to remove the -mno-* flags? Ah, ignore this comment, on the compile lines I saw the full flags I set