From 27467171da145f14d423a15a91057e020990fdbf Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Sun, 10 Apr 2022 21:37:03 +0200 Subject: [PATCH] - updated to 0.16.0 - updated rdtscp patch --- highway-rdtscp.patch | 52 +++------------------------- highway.spec | 80 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 69 insertions(+), 63 deletions(-) diff --git a/highway-rdtscp.patch b/highway-rdtscp.patch index 3b21f4b..ddb9cab 100644 --- a/highway-rdtscp.patch +++ b/highway-rdtscp.patch @@ -1,53 +1,9 @@ -From 4a57d62e1d87d8c80bbea34fa0e2d27bc8f6b885 Mon Sep 17 00:00:00 2001 -From: Jan Wassenberg -Date: Wed, 1 Sep 2021 02:49:11 -0700 -Subject: [PATCH] skip nanobenchmarks if rdtscp is not supported. Refs - https://github.com/libjxl/libjxl/issues/408, thanks @error256 - -PiperOrigin-RevId: 394187316 ---- - hwy/nanobenchmark.cc | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/hwy/nanobenchmark.cc b/hwy/nanobenchmark.cc -index 8e00cca..91c5713 100644 ---- a/hwy/nanobenchmark.cc -+++ b/hwy/nanobenchmark.cc -@@ -353,6 +353,12 @@ void Cpuid(const uint32_t level, const uint32_t count, - #endif +--- highway-0.16.0/hwy/nanobenchmark.cc.orig 2022-04-09 18:30:28.550190500 +0200 ++++ highway-0.16.0/hwy/nanobenchmark.cc 2022-04-09 18:31:11.596623964 +0200 +@@ -439,6 +439,12 @@ HWY_DLLEXPORT double Now() { } -+bool HasRDTSCP() { -+ uint32_t abcd[4]; -+ Cpuid(0x80000001U, 0, abcd); // Extended feature flags -+ return (abcd[3] & (1u << 27)) != 0; // RDTSCP -+} -+ - std::string BrandString() { - char brand_string[49]; - std::array abcd; -@@ -647,6 +653,15 @@ int Unpredictable1() { return timer::Start() != ~0ULL; } - size_t Measure(const Func func, const uint8_t* arg, const FuncInput* inputs, - const size_t num_inputs, Result* results, const Params& p) { - NANOBENCHMARK_CHECK(num_inputs != 0); -+ -+#if HWY_ARCH_X86 -+ if (!platform::HasRDTSCP()) { -+ fprintf(stderr, "CPU '%s' does not support RDTSCP, skipping benchmark.\n", -+ platform::BrandString().c_str()); -+ return 0; -+ } -+#endif -+ - const InputVec& unique = UniqueInputs(inputs, num_inputs); - - const size_t num_skip = NumSkip(func, arg, unique, p); // never 0 ---- highway-0.14.2/hwy/nanobenchmark.cc.orig 2021-10-06 06:25:11.981599545 +0200 -+++ highway-0.14.2/hwy/nanobenchmark.cc 2021-10-06 21:31:31.524075329 +0200 -@@ -431,6 +431,12 @@ double Now() { - } - - uint64_t TimerResolution() { + HWY_DLLEXPORT uint64_t TimerResolution() { +#if HWY_ARCH_X86 + /* TimerResolution() is used to initialize static variable, used in Measure() function */ + if (!platform::HasRDTSCP()) diff --git a/highway.spec b/highway.spec index dd0ee5c..ead09d0 100644 --- a/highway.spec +++ b/highway.spec @@ -5,14 +5,14 @@ Summary: Efficient and performance-portable SIMD Summary(pl.UTF-8): Wydajne i przenośne operacje SIMD Name: highway -Version: 0.14.2 -Release: 2 +Version: 0.16.0 +Release: 1 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: 4821b1064a35baa24ea36994c0d58c41 -# https://github.com/google/highway/commit/4a57d62e1d87d8c80bbea34fa0e2d27bc8f6b885.patch +# Source0-md5: 2d95ad96b3fda6cf7d918e801e89516e +# related to https://github.com/google/highway/commit/4a57d62e1d87d8c80bbea34fa0e2d27bc8f6b885.patch Patch0: %{name}-rdtscp.patch URL: https://github.com/google/highway BuildRequires: cmake >= 3.10 @@ -22,9 +22,6 @@ BuildRequires: rpm-build >= 4.6 BuildRequires: rpmbuild(macros) >= 1.605 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) -# only static libraries included -%define _enable_debug_packages 0 - %description Highway is a C++ library for SIMD (Single Instruction, Multiple Data), i.e. applying the same operation to multiple 'lanes' using a single @@ -36,15 +33,42 @@ Multiple Data), czyli wykonywania tej samej operacji na wielu "pasach" przy użyciu pojedynczej instrukcji procesora. %package devel -Summary: Development files for Highway library -Summary(pl.UTF-8): Pliki programistyczne biblioteki Highway +Summary: Header files for Highway library +Summary(pl.UTF-8): Pliki nagłówkowe biblioteki Highway Group: Development/Libraries +Requires: %{name} = %{version}-%{release} %description devel -Development files for Highway library. +Header files for Highway library. %description devel -l pl.UTF-8 -Pliki programistyczne biblioteki Highway. +Pliki nagłówkowe biblioteki Highway. + +%package test +Summary: Highway test helper library +Summary(pl.UTF-8): Biblioteka pomocnicza testów z użyciem biblioteki Highway +Group: Libraries +Requires: %{name} = %{version}-%{release} + +%description test +Highway test helper library. + +%description test -l pl.UTF-8 +Biblioteka pomocnicza testów z użyciem biblioteki Highway. + +%package test-devel +Summary: Header files for Highway test library +Summary(pl.UTF-8): Pliki nagłówkowe biblioteki Highway test +Group: Development/Libraries +Requires: %{name}-devel = %{version}-%{release} +Requires: %{name}-test = %{version}-%{release} +Requires: gtest-devel + +%description test-devel +Header files for Highway test library. + +%description test-devel -l pl.UTF-8 +Pliki nagłówkowe biblioteki Highway test. %package apidocs Summary: API documentation for Highway library @@ -81,14 +105,40 @@ rm -rf $RPM_BUILD_ROOT %clean rm -rf $RPM_BUILD_ROOT -%files devel +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%post test -p /sbin/ldconfig +%postun test -p /sbin/ldconfig + +%files %defattr(644,root,root,755) %doc README.md -%{_libdir}/libhwy.a -%{_libdir}/libhwy_contrib.a -%{_includedir}/hwy +%attr(755,root,root) %{_libdir}/libhwy.so.*.*.* +%attr(755,root,root) %ghost %{_libdir}/libhwy.so.0 +%attr(755,root,root) %{_libdir}/libhwy_contrib.so.*.*.* +%attr(755,root,root) %ghost %{_libdir}/libhwy_contrib.so.0 + +%files devel +%defattr(644,root,root,755) +%attr(755,root,root) %{_libdir}/libhwy.so +%attr(755,root,root) %{_libdir}/libhwy_contrib.so +%dir %{_includedir}/hwy +%{_includedir}/hwy/contrib +%{_includedir}/hwy/ops +%{_includedir}/hwy/*.h %{_pkgconfigdir}/libhwy.pc %{_pkgconfigdir}/libhwy-contrib.pc + +%files test +%defattr(644,root,root,755) +%attr(755,root,root) %{_libdir}/libhwy_test.so.*.*.* +%attr(755,root,root) %ghost %{_libdir}/libhwy_test.so.0 + +%files test-devel +%defattr(644,root,root,755) +%attr(755,root,root) %{_libdir}/libhwy_test.so +%{_includedir}/hwy/tests %{_pkgconfigdir}/libhwy-test.pc %if %{with apidocs} -- 2.44.0