https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/ Issue: dev-libs/ntl-11.4.4 fails to compile. Discovered on: amd64 (internal ref: tinderbox) NOTE: If you think this is a GCC-11 related issue, please block bug 732706.
Created attachment 742491 [details] build.log build log and emerge --info
Possible context of error(s): ../include/NTL/FFT_impl.h:12:2: error: #error "NTL_ENABLE_AVX_FFT: not supported on this platform"
ci has reproduced this issue with version 11.4.4-r1 - Updating summary.
This one looks fun. NTL determines that you don't have AVX2 support: *** Checking for feature: AVX2 [no] But that check consists of, #if (!defined(__GNUC__) || !defined(__x86_64__) || !defined(__AVX2__)) #error "AVX2 not supported" #endif #if (NTL_BITS_PER_LONG != 64 || NTL_BITS_PER_INT != 32 || NTL_DOUBLE_PRECISION != 53) #error "AVX2 not supported" // sanity check -- code that uses this feature also relies on this #endif #ifndef NTL_HAVE_ALIGNED_ARRAY #error "AVX2 not supported" #endif and to me it looks like all the sub-checks are satisfied. From the build log again, bits per long = 64 bits per int = 32 double precision = 53 *** Checking for feature: ALIGNED_ARRAY [yes] So I guess it must be defined(__GNUC__) or defined(__x86_64__) that is causing the problem? Can you check?
Or I guess your CPU flags could be wrong (no avx2?)...
ci has reproduced this issue with version 11.5.1 - Updating summary.
ci has reproduced this issue with version 11.5.1-r1 - Updating summary.
I wonder if avx2 should just be disabled anytime x86 is used?
Created attachment 863321 [details] build.log
(In reply to Joonas Niilola from comment #8) > I wonder if avx2 should just be disabled anytime x86 is used? On your machine I can at least explain why *** Checking for feature: AVX2 [no] It's because your longs are 32-bits and the implementation relies on them being 64-bit. I suppose that does justify disabling the AVX FFT on x86, because I don't know how to check it easily in the ebuild.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac9bae7a4256bb2ac15232d4d9a5a5f9a72430f9 commit ac9bae7a4256bb2ac15232d4d9a5a5f9a72430f9 Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2023-06-05 12:49:51 +0000 Commit: Michael Orlitzky <mjo@gentoo.org> CommitDate: 2023-06-05 12:50:25 +0000 dev-libs/ntl: new revision to fix the x86 build (and drop static-libs). Bug: https://bugs.gentoo.org/815775 Signed-off-by: Michael Orlitzky <mjo@gentoo.org> .../{ntl-11.5.1-r2.ebuild => ntl-11.5.1-r3.ebuild} | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-)
juippis, please retry with the -r3 of NTL. If that builds, we can add it to the stabilization list.
(In reply to Michael Orlitzky from comment #12) > juippis, please retry with the -r3 of NTL. If that builds, we can add it to > the stabilization list. Yes, can confirm it works on ~x86 container! >>> Emerging (1 of 1) dev-libs/ntl-11.5.1-r3::gentoo >>> Installing (1 of 1) dev-libs/ntl-11.5.1-r3::gentoo
Thank! The new stabilization request is bug #907964.
I have bad news. ntl-11.5.1-r3 fails for me with exactly the message in the title of this bug. ntl-11.5.1-r1 works for me. For reference, here are my cpu flags */* CPU_FLAGS_X86: aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3
(In reply to François Bissey from comment #15) > I have bad news. ntl-11.5.1-r3 fails for me with exactly the message in the > title of this bug. ntl-11.5.1-r1 works for me. > For reference, here are my cpu flags > */* CPU_FLAGS_X86: aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand > sse sse2 sse3 sse4_1 sse4_2 ssse3 On x86 or some other arch? The same underlying issue could affect (say amd64 if you have values other than bits per long = 64 bits per int = 32 double precision = 53 In that case I might have to disable the AVX FFT completely, and try to get the mess sorted out upstream. )
I am on amd64.
Can you post your build log? It should (I hope) reveal why NTL doesn't want to use your avx2.
Created attachment 863757 [details] ntl-11.5.1-r3 failed build log The detection and configuration part is different for 11.5.1-r1 *** GOOD NEWS: compatible machine. summary of machine characteristics: bits per long = 64 bits per int = 32 bits per size_t = 64 arith right shift = yes double precision = 53 long double precision = 64 NBITS (maximum) = 50 WNBITS (maximum) = 62 double rounding detected = no FMA detected = no big pointers = no mv mach_desc.h ../include/NTL/mach_desc.h make[1]: Leaving directory '/home/portage/dev-libs/ntl-11.5.1-r3/work/ntl-11.5.1/src' make setup2 make[1]: Entering directory '/home/portage/dev-libs/ntl-11.5.1-r3/work/ntl-11.5.1/src' echo "*** CheckFeatures log ***" > CheckFeatures.log sh MakeGetTime "x86_64-pc-linux-gnu-g++ -I../include -I. -O2 -pipe -Wl,-O1 -Wl,--as-needed" "-lm" does anybody really know what time it is? using GetTime1.cpp sh MakeGetPID "x86_64-pc-linux-gnu-g++ -I../include -I. -O2 -pipe -Wl,-O1 -Wl,--as-needed" "-lm" who am I? using GetPID1.cpp sh MakeCheckFeatures "ALIGNED_ARRAY BUILTIN_CLZL LL_TYPE SSSE3 AVX PCLMUL AVX2 FMA AVX512F COPY_TRAITS1 COPY_TRAITS2 CHRONO_TIME MACOS_TIME POSIX_TIME AES_NI KMA" "x86_64-pc-linux-gnu-g++ -I../include -I. -O2 -pipe -Wl,-O1 -Wl,--as-needed" "-lm" *** Checking for feature: ALIGNED_ARRAY [yes] *** Checking for feature: BUILTIN_CLZL [yes] *** Checking for feature: LL_TYPE [yes] *** Checking for feature: SSSE3 [no] *** Checking for feature: AVX [no] *** Checking for feature: PCLMUL [no] *** Checking for feature: AVX2 [no] *** Checking for feature: FMA [no] *** Checking for feature: AVX512F [no] *** Checking for feature: COPY_TRAITS1 [yes] *** Checking for feature: COPY_TRAITS2 [yes] *** Checking for feature: CHRONO_TIME [yes] *** Checking for feature: MACOS_TIME [no] *** Checking for feature: POSIX_TIME [yes] *** Checking for feature: AES_NI [no] *** Checking for feature: KMA [no] FMA detection fails in 11.5.1-r3 and feature check fails for SSSE3, AVX, PCLMUL, AVX2, FMA and AES_NI when they are detected and checked properly in 11.5.1-r1.
Darn copied a bit of the wrong log, this is the bit from 11.5.1-r1 that is relevant *** GOOD NEWS: compatible machine. summary of machine characteristics: bits per long = 64 bits per int = 32 bits per size_t = 64 arith right shift = yes double precision = 53 long double precision = 64 NBITS (maximum) = 50 WNBITS (maximum) = 62 double rounding detected = no FMA detected = yes big pointers = no mv mach_desc.h ../include/NTL/mach_desc.h make[1]: Leaving directory '/home/portage/dev-libs/ntl-11.5.1-r1/work/ntl-11.5.1/src' make setup2 make[1]: Entering directory '/home/portage/dev-libs/ntl-11.5.1-r1/work/ntl-11.5.1/src' echo "*** CheckFeatures log ***" > CheckFeatures.log sh MakeGetTime "x86_64-pc-linux-gnu-g++ -I../include -I. -O2 -pipe -march=native -Wl,-O1 -Wl,--as-needed" "-lm" does anybody really know what time it is? using GetTime1.cpp sh MakeGetPID "x86_64-pc-linux-gnu-g++ -I../include -I. -O2 -pipe -march=native -Wl,-O1 -Wl,--as-needed" "-lm" who am I? using GetPID1.cpp sh MakeCheckFeatures "ALIGNED_ARRAY BUILTIN_CLZL LL_TYPE SSSE3 AVX PCLMUL AVX2 FMA AVX512F COPY_TRAITS1 COPY_TRAITS2 CHRONO_TIME MACOS_TIME POSIX_TIME AES_NI KMA" "x86_64-pc-linux-gnu-g++ -I../include -I. -O2 -pipe -march=native -Wl,-O1 -Wl,--as-needed" "-lm" *** Checking for feature: ALIGNED_ARRAY [yes] *** Checking for feature: BUILTIN_CLZL [yes] *** Checking for feature: LL_TYPE [yes] *** Checking for feature: SSSE3 [yes] *** Checking for feature: AVX [yes] *** Checking for feature: PCLMUL [yes] *** Checking for feature: AVX2 [yes] *** Checking for feature: FMA [yes] *** Checking for feature: AVX512F [no] *** Checking for feature: COPY_TRAITS1 [yes] *** Checking for feature: COPY_TRAITS2 [yes] *** Checking for feature: CHRONO_TIME [yes] *** Checking for feature: MACOS_TIME [no] *** Checking for feature: POSIX_TIME [yes] *** Checking for feature: AES_NI [yes] *** Checking for feature: KMA [no]
I think the only difference between the two builds is "-march=native" in your CXXFLAGS. Do the AVX, FMA, etc. tests work if you add "-march=native" back manually in -r3?
I'm just now noticing that doc/config.txt says of the AVX FFT, "this is experimental at moment, and may lead to worse performance." So I think I'll turn it off regardless. But it would still be nice to know if a bunch of NTL's checks fail without -march=native.
I can confirm, manually adding -march=native to my CFLAGS and CXXFLAGS fix all the issues of detection and compilation. The testsuite pass and install goes OK.
I opened a GH issue about the CPU feature detection. In the meantime, I'll put back NATIVE=on, which adds -march=native when it's missing. I'll also disable the AVX FFT which should hopefully hide all of those build failures.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ed8c182abf1232c57446017da57b24c4351a34c commit 9ed8c182abf1232c57446017da57b24c4351a34c Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2023-06-14 06:26:26 +0000 Commit: Michael Orlitzky <mjo@gentoo.org> CommitDate: 2023-06-14 11:14:31 +0000 dev-libs/ntl: another AVX FFT build fix, this time on amd64. Even on amd64, detection of the CPU features needed for AVX FFT can fail. In particular, it can fail when -march=native is absent from CXXFLAGS. Since the upstream documentation calls the AVX FFT experimental, we disable it entirely. We also bring back NATIVE=on, which should somewhat hide the CXXFLAGS issue until it can be addressed upstream. Closes: https://bugs.gentoo.org/815775 Signed-off-by: Michael Orlitzky <mjo@gentoo.org> dev-libs/ntl/ntl-11.5.1-r4.ebuild | 91 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+)