Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.15.9
-
None
-
Gentoo Linux on VirtualBox with -march=native
-
-
178c123a6 (dev), bfea141e5 (6.5), 5633df6ff (tqtc/lts-6.2), c2a2aac02 (tqtc/lts-5.15)
Description
I was unable to get issue QTBUG-105740 reopened, so I'm making a new one. Here's the comment I made:
A friend of mine also ran into this issue on Gentoo in VirtualBox. This happened because they used -march=native, and the CPUID in VirtualBox claims AVX2 support but not FMA or F16C support (see attached cpuid.txt).
I was able to reproduce this outside of VirtualBox by simply adding -mavx2 -mno-fma to CFLAGS/CXXFLAGS when building Qt, and then using setting the environment variable QT_NO_CPU_FEATURE='fma' at runtime. Basically any graphical Qt app will hit this, I used qt5ct.
The problem is that in qInitDrawhelperFunctions, the SSE2 fallback for qt_memfill32 is disabled when AVX2 is available at compile-time, but the AVX2 version is only enabled if `qCpuHasFeature(ArchHaswell)`, which requires AVX2 but also FMA, F16C, and other features to be either enabled at compile-time or to be set in cpuid at runtime. When using -march=native inside of VirtualBox, FMA and F16C are neither compiled in nor detected at runtime, so the AVX2 version is not used, and with no fallback it stays at its initial value of NULL.
I think the simple fix is to make the SSE2 fallback available even if AVX2 is enabled at compile-time - remove `#ifndef __AVX2__`.
Attachments
Issue Links
- is duplicated by
-
QTBUG-119279 Use of qCpuHasFeature(ArchHaswell) in AVX2-specific code causes crashes when running under VirtualBox.
- Closed
For Gerrit Dashboard: QTBUG-113315 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
475380,5 | Match deadcode elimination with cpu feature check | dev | qt/qtbase | Status: MERGED | +2 | 0 |
475895,2 | Match deadcode elimination with cpu feature check | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
475897,3 | Match deadcode elimination with cpu feature check | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
475898,3 | Match deadcode elimination with cpu feature check | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |