From 96fad748e1db24eae03762c40a632e4e1c8ba507 Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Mon, 21 Aug 2023 22:02:32 +0200 Subject: [PATCH] - float16 patch to fix x86 build with gcc 12+ and sse2 not enabled - no-avx patch to disable test failing on CPU without AVX - release 2 --- highway-float16.patch | 11 +++++++++++ highway-no-avx.patch | 11 +++++++++++ highway.spec | 11 ++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 highway-float16.patch create mode 100644 highway-no-avx.patch diff --git a/highway-float16.patch b/highway-float16.patch new file mode 100644 index 0000000..83a8519 --- /dev/null +++ b/highway-float16.patch @@ -0,0 +1,11 @@ +--- highway-1.0.6/hwy/base.h.orig 2023-08-11 15:54:08.000000000 +0200 ++++ highway-1.0.6/hwy/base.h 2023-08-21 20:19:20.042867861 +0200 +@@ -381,7 +381,7 @@ using float16_t = __fp16; + // which is missing __extendhfsf2. + #elif ( \ + (HWY_ARCH_RVV && defined(__riscv_zvfh) && HWY_COMPILER_CLANG) || \ +- (HWY_ARCH_X86 && ((HWY_COMPILER_CLANG >= 1600 && !HWY_COMPILER_CLANGCL) || \ ++ (HWY_ARCH_X86 && defined(__sse2__) && ((HWY_COMPILER_CLANG >= 1600 && !HWY_COMPILER_CLANGCL) || \ + HWY_COMPILER_GCC_ACTUAL >= 1200))) + using float16_t = _Float16; + // 3) Otherwise emulate diff --git a/highway-no-avx.patch b/highway-no-avx.patch new file mode 100644 index 0000000..583cb56 --- /dev/null +++ b/highway-no-avx.patch @@ -0,0 +1,11 @@ +With gcc 13 AVX is used in static initialization in math_test.cc +--- highway-1.0.6/CMakeLists.txt.orig 2023-08-11 15:54:08.000000000 +0200 ++++ highway-1.0.6/CMakeLists.txt 2023-08-21 21:31:34.886441037 +0200 +@@ -564,7 +564,6 @@ list(APPEND HWY_TEST_FILES + hwy/contrib/image/image_test.cc + # Disabled due to SIGILL in clang7 debug build during gtest discovery phase, + # not reproducible locally. Still tested via bazel build. +- hwy/contrib/math/math_test.cc + hwy/contrib/sort/sort_test.cc + hwy/contrib/sort/bench_sort.cc + hwy/contrib/unroller/unroller_test.cc diff --git a/highway.spec b/highway.spec index d517df7..dd2b2aa 100644 --- a/highway.spec +++ b/highway.spec @@ -1,24 +1,28 @@ # # Conditional build: %bcond_without apidocs # API documentation +%bcond_with sse2 # SSE2 instructions on x86/x32 %bcond_without tests # don't build tests # Summary: Efficient and performance-portable SIMD Summary(pl.UTF-8): Wydajne i przenośne operacje SIMD Name: highway Version: 1.0.6 -Release: 1 +Release: 2 License: Apache v2.0 Group: Libraries #Source0Download: https://github.com/google/highway/releases Source0: https://github.com/google/highway/archive/%{version}/%{name}-%{version}.tar.gz # Source0-md5: 405abf8d94b618befd44b2cb60a90c0e +Patch0: %{name}-float16.patch +Patch1: %{name}-no-avx.patch URL: https://github.com/google/highway BuildRequires: cmake >= 3.10 %{?with_tests:BuildRequires: gtest-devel} BuildRequires: libstdc++-devel >= 6:4.7 BuildRequires: rpm-build >= 4.6 BuildRequires: rpmbuild(macros) >= 1.742 +%{?with_sse2:Requires: cpuinfo(sse2)} BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %description @@ -83,10 +87,15 @@ Dokumentacja API biblioteki Highway. %prep %setup -q +%patch0 -p1 +%patch1 -p1 %build install -d build cd build +%if %{with sse2} +CXXFLAGS="%{rpmcxxflags} -msse2" +%endif %cmake .. \ %{cmake_on_off tests BUILD_TESTING} \ -DCMAKE_INSTALL_INCLUDEDIR=include \ -- 2.44.0