Bug 264394 - Several ports can't build with CPUTYPE?=skylake-avx512 or CPUTYPE?=tigerlake - eat 1 CPU core forever
Summary: Several ports can't build with CPUTYPE?=skylake-avx512 or CPUTYPE?=tigerlake ...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.1-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-01 13:06 UTC by Vladimir Druzenko
Modified: 2022-06-12 02:32 UTC (History)
8 users (show)

See Also:
dim: mfc-stable13+
dim: mfc-stable12+


Attachments
mesa-dri patch for tigerlake (1.12 KB, patch)
2022-06-01 13:13 UTC, Lorenzo Salvadore
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Druzenko freebsd_committer freebsd_triage 2022-06-01 13:06:06 UTC
On 13.1 amd64 can't build 3 ports with CPUTYPE?=skylake-avx512: devel/boost-libs graphics/mesa-dri x11-toolkits/qt5-gui.
One of cc or c++ eat 100% of 1 core forever (tested for 10+ hours) and eat RAM too.
But all build fine with CPUTYPE?=skylake

------------------------------------------------------------------
Additional information.
------------------------------------------------------------------

During build of devel/boost-libs this process:
43050  1  R    2:40,54 c++ -c -x c++ -fvisibility-inlines-hidden -fPIC -m64 -pthread -O3 -Wall -fvisibility=hidden -Wno-inline -msse -msse2 -msse3 -mssse3 -msse4.1 -pipe -march=skylake-avx512 -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -DLIBICONV_PLUG -std=gnu++17 -pipe -march=skylake-avx512 -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1 -DBOOST_ATOMIC_SOURCE -DNDEBUG -I. -Ilibs/atomic/src -o bin.v2/libs/atomic/build/clang-linux-13/release/pch-off/threading-multi/visibility-hidden/find_address_sse41.o libs/atomic/src/find_address_sse41.cpp

After manual kill start another process:
44233  1  R    3:48,53 c++ -c -x c++ -fvisibility-inlines-hidden -m64 -pthread -O3 -Wall -fvisibility=hidden -Wno-inline -msse -msse2 -msse3 -mssse3 -msse4.1 -pipe -march=skylake-avx512 -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -DLIBICONV_PLUG -std=gnu++17 -pipe -march=skylake-avx512 -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_SOURCE -DBOOST_ATOMIC_STATIC_LINK=1 -DNDEBUG -I. -Ilibs/atomic/src -o bin.v2/libs/atomic/build/clang-linux-13/release/link-static/pch-off/threading-multi/visibility-hidden/find_address_sse41.o libs/atomic/src/find_address_sse41.cpp
------------------------------------------------------------------

graphics/mesa-dri:
78657  3  R    3:07,58 cc -Isrc/gallium/drivers/llvmpipe/libllvmpipe.a.p -Isrc/gallium/drivers/llvmpipe -I../src/gallium/drivers/llvmpipe -I../src/gallium/include -Isrc/gallium/auxiliary -I../src/gallium/auxiliary -Iinclude -I../include -Isrc -I../src -Isrc/compiler/nir -I../src/compiler/nir -Isrc/util -I../src/util -fvisibility=hidden -fno-color-diagnostics -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -O3 -ffunction-sections -fdata-sections -DPACKAGE_VERSION="21.3.8" -DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues" -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_X11_PLATFORM -DHAVE_XCB_PLATFORM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DHAVE_DRM_PLATFORM -DETIME=ETIMEDOUT -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE___BUILTIN_TYPES_COMPATIBLE_P -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_UINT128 -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DUSE_X86_64_ASM -DHAS_SCHED_H -DHAS_SCHED_GETAFFINITY -DHAVE_SYS_SYSCTL_H -DHAVE_XLOCALE_H -DHAVE_DLFCN_H -DHAVE_SYS_SHM_H -DHAVE_CET_H -DHAVE_PTHREAD_NP_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_FLOCK -DHAVE_STRTOK_R -DHAVE_GETRANDOM -DHAVE_QSORT_R -DHAVE_QSORT_S -DHAVE_POSIX_MEMALIGN -DHAVE_DIRENT_D_TYPE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_ZSTD -DHAVE_COMPRESSION -DHAVE_PTHREAD -DHAVE_LIBDRM -DLLVM_AVAILABLE -DMESA_LLVM_VERSION_STRING="13.0.1" -DL
------------------------------------------------------------------

x11-toolkits/qt5-gui:
83813  1  R    4:01,88 c++ -c -O2 -pipe -march=skylake-avx512 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -O3 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -Wextra -Wdate-time -Winconsistent-missing-override -pthread -fPIC -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_ACCESSIBILITY -DQT_DBUS -DQT_FONTCONFIG -DQT_FREETYPE -DQT_GLIB -DQT_IMAGEFORMAT_PNG -DQT_OPENGL -DQT_SHAPE -DQT_XCB -DQT_XKB -DQT_XKBCOMMON -DQT_XRENDER -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DMD4C_USE_UTF8 -DENABLE_PIXMAN_DRAWHELPERS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_GUI_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB -msse4.1 -I. -I../3rdparty/md4c -I../3rdparty/VulkanMemoryAllocator -I../../include -I../../include/QtGui -I../../include/QtGui/5.15.2 -I../../include/QtGui/5.15.2/QtGui -I.tracegen -I/usr/local/include -I/usr/local/include/qt5/QtCore/5.15.2 -I/usr/local/include/qt5/QtCore/5.15.2/QtCore -I/usr/local/include/qt5 -I/usr/local/include/qt5/QtCore -I.moc -I/usr/local/include/libpng16 -I/usr/local/include -I/usr/local/lib/qt5/mkspecs/freebsd-clang painting/qdrawhelper_sse4.cpp -o .obj/qdrawhelper_sse4.o
Comment 1 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-06-01 13:13:31 UTC
Created attachment 234375 [details]
mesa-dri patch for tigerlake

I have the same issue with CPUTYPE?=tigerlake.

For graphics/mesa-dri I was able to find a workaround by using the patch that I add as attachment.
Comment 2 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-06-01 13:17:10 UTC
I add the maintainers of the affected ports to CC: they might be able to help.
Comment 3 Max Brazhnikov freebsd_committer freebsd_triage 2022-06-01 13:59:18 UTC
Looks like a problem with clang rather than with these ports. See also bug 261341
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-06-01 21:46:47 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=592e876a422960a78938caa714f2263ff38eb87b

commit 592e876a422960a78938caa714f2263ff38eb87b
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-06-01 21:43:18 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-06-01 21:45:59 +0000

    Apply llvm fix for possible hangs with CPUTYPE=skylake-avx512

    Merge commit e8305c0b8f49 from llvm git (by Simon Pilgrim)

        [X86] combineX86ShuffleChain - don't fold to truncate(concat(V1,V2)) if it was already a PACK op

        Fixes #55050

    PR:             264394
    Reported by:    VVD <vvd@unislabs.com>
    MFC after:      3 days

 contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2022-06-02 13:46:26 UTC
(In reply to commit-hook from comment #4)
Added this patch to devel/llvm13, rebuild it with CPUTYPE?=skylake-avx512, tried to build graphics/mesa-dri with CPUTYPE?=skylake-avx512 - nothing changed…
Found hung process, then:
ls -l /proc/32857/file
/proc/32857/file -> /usr/bin/cc

At least part of the graphics/mesa-dri build with llvm from base. Do it require llvm from ports?
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2022-06-02 19:39:04 UTC
(In reply to VVD from comment #5)
The mesa-dri port depends on devel/llvm13 for the /usr/local/llvm13/lib/libLLVM-13.so dynamic library, and not for the compiler binary (clang13).

The actual compilations in the port are still done using the base compiler, and you can see that it is `/proc/32857/file -> /usr/bin/cc` which hangs.

E.g. it is the base compiler which needs to be recompiled.

That said, maybe brooks can pull the patch into the devel/llvm13 port. I think the problem was introduced somewhere after llvm 13.0.0, and was only solved after 14.0.4.
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2022-06-02 21:41:08 UTC
(In reply to Dimitry Andric from comment #6)
> E.g. it is the base compiler which needs to be recompiled.
Yes.

Will we see "Errata Notices" with this patch for releng/13.x?
Comment 8 Dimitry Andric freebsd_committer freebsd_triage 2022-06-02 22:11:30 UTC
(In reply to VVD from comment #7)
I'm not sure if this is serious enough for an Erratum, as you can relatively easily work around it by setting CPUTYPE to something else.

But if there is enough demand, then sure, why not. (The process is relatively arcane though, with forms to be filled in, etc. I'd rather do something else :)
Comment 9 commit-hook freebsd_committer freebsd_triage 2022-06-04 11:45:07 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=76886853f03395abb680824bcc74e98f83bd477a

commit 76886853f03395abb680824bcc74e98f83bd477a
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-06-01 21:43:18 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-06-04 11:43:43 +0000

    Apply llvm fix for possible hangs with CPUTYPE=skylake-avx512

    Merge commit e8305c0b8f49 from llvm git (by Simon Pilgrim)

        [X86] combineX86ShuffleChain - don't fold to truncate(concat(V1,V2)) if it was already a PACK op

        Fixes #55050

    PR:             264394
    Reported by:    VVD <vvd@unislabs.com>
    MFC after:      3 days

    (cherry picked from commit 592e876a422960a78938caa714f2263ff38eb87b)

 contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Comment 10 commit-hook freebsd_committer freebsd_triage 2022-06-04 11:45:10 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e5896578b22271be25f18996033a176fc6cdfe19

commit e5896578b22271be25f18996033a176fc6cdfe19
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-06-01 21:43:18 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-06-04 11:44:33 +0000

    Apply llvm fix for possible hangs with CPUTYPE=skylake-avx512

    Merge commit e8305c0b8f49 from llvm git (by Simon Pilgrim)

        [X86] combineX86ShuffleChain - don't fold to truncate(concat(V1,V2)) if it was already a PACK op

        Fixes #55050

    PR:             264394
    Reported by:    VVD <vvd@unislabs.com>
    MFC after:      3 days

    (cherry picked from commit 592e876a422960a78938caa714f2263ff38eb87b)

 contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Comment 11 Vladimir Druzenko freebsd_committer freebsd_triage 2022-06-04 14:56:38 UTC
Can anybody commit this patch to ports (devel/llvm*) too?
Affected 13 and 14 only?
Comment 12 Kubilay Kocak freebsd_committer freebsd_triage 2022-06-12 02:32:20 UTC
(In reply to VVD from comment #11)

Please create a separate issue for devel/llvm* ports, with this issue in its "Depends On" field, thanks

^Triage: Assign to committer that resolved, thanks Dim!