FS#79112 - [hyperscan] need to pass C(XX)FLAGS to build to avoid the -march=native
Attached to Project:
Arch Linux
Opened by John (graysky) - Saturday, 15 July 2023, 18:12 GMT
Last edited by Toolybird (Toolybird) - Monday, 17 July 2023, 00:02 GMT
Opened by John (graysky) - Saturday, 15 July 2023, 18:12 GMT
Last edited by Toolybird (Toolybird) - Monday, 17 July 2023, 00:02 GMT
|
Details
Upstream has hardcoded[1] the use of -march=native so which
ever CPU is used to build the package will be passed on to
the package. You can pass the following to force a level of
features/override that behavior.
--- a/PKGBUILD +++ b/PKGBUILD @@ -34,6 +34,8 @@ build() { -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib \ -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_C_FLAGS="-march=x86-64-v2" \ + -DCMAKE_CXX_FLAGS="-march=x86-64-v2" \ -Wno-dev cmake --build build } The plus side is that it should allow for the most supported CPUs. The down side is that AVX and AVX2 processing will not be built in to the package. Do you have an opinion about which to go with? More supported hardware or better theoretical performance? Note that a min of SSSE3 is required for hyperscan. For reference: -march=x86-64-v2: (close to Nehalem) CMPXCHG16B, LAHF-SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3 -march=x86-64-v3: (close to Haswell) AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE Source: https://www.phoronix.com/news/GCC-11-x86-64-Feature-Levels 1. https://github.com/intel/hyperscan/blob/master/doc/dev-reference/getting_started.rst |
This task depends upon
Closed by Toolybird (Toolybird)
Monday, 17 July 2023, 00:02 GMT
Reason for closing: Not a bug
Additional comments about closing: See comments
Monday, 17 July 2023, 00:02 GMT
Reason for closing: Not a bug
Additional comments about closing: See comments
Edit:
With FAT_RUNTIME=OFF does adding the following allow the build to continue?
CFLAGS=${CFLAGS/x86-64/x86-64-v2}
CXXFLAGS=${CXXFLAGS/x86-64/x86-64-v2}
I do not see the native value for my CPU but I do see this several values getting passed including:
-march=x86-64 and -march=core-avx2 which is appearing later and thus overriding the standard value, see attachment = hyperscan-5.4.2-1-x86_64-build.log.1.gz
Condition 2. Addition of -DFAT_RUNTIME=OFF \
Yes, build fails:
-- Building without AVX512VBMI support
CMake Error at cmake/arch.cmake:108 (message):
A minimum of SSSE3 compiler support is required
Call Stack (most recent call first):
CMakeLists.txt:340 (include)
Condition 3. Condition 2 + export CFLAGS=${CFLAGS/x86-64/x86-64-v2} and export CXXFLAGS=${CXXFLAGS/x86-64/x86-64-v2} and --verbose
Yes, build completes. See attachment =
Do you have system without SSE3 to test what the current repo package does when the listed minimal support is not present? I do not have such a system any more (at least working).
If SSE3 support is a hard requirement then it is a question of is such a package allowed.
With FAT_RUNTIME=ON there does not seem to be any benefit to changing the CFLAGS/CXXFLAGS.
[1] https://github.com/intel/hyperscan/blob/v5.4.2/CMakeLists.txt#L1295
[2] https://github.com/intel/hyperscan/blob/v5.4.2/CMakeLists.txt#L1302
[3] https://github.com/intel/hyperscan/blob/v5.4.2/CMakeLists.txt#L1309
$ qemu-system-x86_64 -cpu help
[1] https://qemu.readthedocs.io/en/latest/system/qemu-cpu-models.html#abi-compatibility-levels-for-cpu-models
[1] https://github.com/rspamd/rspamd/blob/3.5/src/libutil/multipattern.c#L74
[2] https://github.com/intel/hyperscan/blob/v5.4.2/src/hs_valid_platform.c#L39