From 3a26c5575bf007e5cf17b04d1603a6e8b38d75d020ac1a85eb53595c5b4d306e Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Mon, 26 Feb 2024 12:18:29 +0000 Subject: [PATCH] - Update to 16.1: * In our testing against its predecessor, Stockfish 16.1 shows a notable improvement in performance, with an Elo gain of up to 27 points and winning over 2 times more game pairs than it loses. * Updated neural network architecture: The neural network architecture has undergone two updates and is currently in its 8th version. * Removal of handcrafted evaluation (HCE): This release marks the removal of the traditional handcrafted evaluation and the transition to a fully neural network-based approach. * Dual NNUE: For the first time, Stockfish includes a secondary neural network, used to quickly evaluate positions that are easily decided. * Use NNUE and UCI_AnalyseMode have been removed as they no longer had any effect. SlowMover has also been removed in favor of Move Overhead. - Use %autosetup macro. Allows to eliminate the usage of deprecated PatchN. OBS-URL: https://build.opensuse.org/package/show/games/stockfish?expand=0&rev=32 --- .gitattributes | 3 +- Stockfish-sf_15.1.tar.gz | 3 - Stockfish-sf_16.1.tar.gz | 3 + date.patch | 31 +++++----- nn-ad9b42354671.nnue | 3 - nn-b1a57edbea57.nnue | 3 + nn-baff1ede1f90.nnue | 3 + stockfish-remove-net.patch | 115 +++++++++++++++++++++---------------- stockfish.changes | 18 ++++++ stockfish.spec | 15 ++--- 10 files changed, 120 insertions(+), 77 deletions(-) delete mode 100644 Stockfish-sf_15.1.tar.gz create mode 100644 Stockfish-sf_16.1.tar.gz delete mode 100644 nn-ad9b42354671.nnue create mode 100644 nn-b1a57edbea57.nnue create mode 100644 nn-baff1ede1f90.nnue diff --git a/.gitattributes b/.gitattributes index d45a817..8a781e3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -22,4 +22,5 @@ *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text ## Specific LFS patterns -nn-ad9b42354671.nnue filter=lfs diff=lfs merge=lfs -text +nn-b1a57edbea57.nnue filter=lfs diff=lfs merge=lfs -text +nn-baff1ede1f90.nnue filter=lfs diff=lfs merge=lfs -text diff --git a/Stockfish-sf_15.1.tar.gz b/Stockfish-sf_15.1.tar.gz deleted file mode 100644 index ccbe52d..0000000 --- a/Stockfish-sf_15.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d4272657905319328294355973faee40a8c28e3eecb0e7b266ed34ff33383b76 -size 193408 diff --git a/Stockfish-sf_16.1.tar.gz b/Stockfish-sf_16.1.tar.gz new file mode 100644 index 0000000..94329d2 --- /dev/null +++ b/Stockfish-sf_16.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5f94793b5d4155310397ba89e9c4266570ef0f24cd47de41a9103556f811b82 +size 176846 diff --git a/date.patch b/date.patch index 0558931..9bb1ca3 100644 --- a/date.patch +++ b/date.patch @@ -1,18 +1,19 @@ -Index: Stockfish-sf_15.1/src/misc.cpp +Index: Stockfish-sf_16.1/src/misc.cpp =================================================================== ---- Stockfish-sf_15.1.orig/src/misc.cpp -+++ Stockfish-sf_15.1/src/misc.cpp -@@ -156,13 +156,6 @@ string engine_info(bool to_uci) { - ss << "-"; - #ifdef GIT_DATE - ss << GIT_DATE; -- #else -- const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"); -- string month, day, year; -- stringstream date(__DATE__); // From compiler, format is "Sep 21 2008" +--- Stockfish-sf_16.1.orig/src/misc.cpp ++++ Stockfish-sf_16.1/src/misc.cpp +@@ -166,14 +166,6 @@ std::string engine_info(bool to_uci) { + ss << "-"; + #ifdef GIT_DATE + ss << stringify(GIT_DATE); +-#else +- constexpr std::string_view months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"); +- std::string month, day, year; +- std::stringstream date(__DATE__); // From compiler, format is "Sep 21 2008" - -- date >> month >> day >> year; -- ss << year << setw(2) << setfill('0') << (1 + months.find(month) / 4) << setw(2) << setfill('0') << day; - #endif +- date >> month >> day >> year; +- ss << year << std::setw(2) << std::setfill('0') << (1 + months.find(month) / 4) +- << std::setw(2) << std::setfill('0') << day; + #endif - ss << "-"; + ss << "-"; diff --git a/nn-ad9b42354671.nnue b/nn-ad9b42354671.nnue deleted file mode 100644 index b199747..0000000 --- a/nn-ad9b42354671.nnue +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ad9b423546714137916bd38978af6fd68d7b8951bef25ff76bf43da72d6cb786 -size 47001499 diff --git a/nn-b1a57edbea57.nnue b/nn-b1a57edbea57.nnue new file mode 100644 index 0000000..0d4d61b --- /dev/null +++ b/nn-b1a57edbea57.nnue @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1a57edbea574ca8b88d6837473845791beb53d885f87f86d5ccdd5659fbf3b2 +size 65429575 diff --git a/nn-baff1ede1f90.nnue b/nn-baff1ede1f90.nnue new file mode 100644 index 0000000..7016d4f --- /dev/null +++ b/nn-baff1ede1f90.nnue @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:baff1ede1f90c1dd1b4f772f1eff29848821801e8186345da7f0eb4121bd6f63 +size 3480122 diff --git a/stockfish-remove-net.patch b/stockfish-remove-net.patch index dcb1367..d2edfc4 100644 --- a/stockfish-remove-net.patch +++ b/stockfish-remove-net.patch @@ -1,23 +1,30 @@ -Index: Stockfish-sf_15.1/src/Makefile +Index: Stockfish-sf_16.1/src/Makefile =================================================================== ---- Stockfish-sf_15.1.orig/src/Makefile -+++ Stockfish-sf_15.1/src/Makefile -@@ -748,7 +748,6 @@ help: - @echo "" +--- Stockfish-sf_16.1.orig/src/Makefile ++++ Stockfish-sf_16.1/src/Makefile +@@ -806,7 +806,6 @@ help: @echo "help > Display architecture details" - @echo "build > Standard build" -- @echo "net > Download the default nnue net" - @echo "profile-build > Faster build (with profile-guided optimization)" + @echo "profile-build > standard build with profile-guided optimization" + @echo "build > skip profile-guided optimization" +- @echo "net > Download the default nnue nets" @echo "strip > Strip executable" @echo "install > Install executable" -@@ -810,14 +809,14 @@ else + @echo "clean > Clean up" +@@ -867,20 +866,20 @@ ifneq ($(SUPPORTED_ARCH), true) endif --.PHONY: help build profile-build strip install clean net objclean profileclean \ -+.PHONY: help build profile-build strip install clean objclean profileclean \ - config-sanity icc-profile-use icc-profile-make gcc-profile-use gcc-profile-make \ - clang-profile-use clang-profile-make FORCE +-.PHONY: help analyze build profile-build strip install clean net \ ++.PHONY: help analyze build profile-build strip install clean \ + objclean profileclean config-sanity \ + icx-profile-use icx-profile-make \ + gcc-profile-use gcc-profile-make \ + clang-profile-use clang-profile-make FORCE \ + format analyze + +-analyze: net config-sanity objclean ++analyze: config-sanity objclean + $(MAKE) -k ARCH=$(ARCH) COMP=$(COMP) $(OBJS) -build: net config-sanity +build: config-sanity @@ -28,53 +35,65 @@ Index: Stockfish-sf_15.1/src/Makefile @echo "" @echo "Step 1/4. Building instrumented executable ..." $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make) -@@ -844,40 +843,6 @@ install: - clean: objclean profileclean - @rm -f .depend *~ core +@@ -922,44 +921,6 @@ profileclean: + @rm -f stockfish.res + @rm -f ./-lstdc++.res --# evaluation network (nnue) --net: -- $(eval nnuenet := $(shell grep EvalFileDefaultName evaluate.h | grep define | sed 's/.*\(nn-[a-z0-9]\{12\}.nnue\).*/\1/')) +-define fetch_network - @echo "Default net: $(nnuenet)" -- $(eval nnuedownloadurl1 := https://tests.stockfishchess.org/api/nn/$(nnuenet)) -- $(eval nnuedownloadurl2 := https://github.com/official-stockfish/networks/raw/master/$(nnuenet)) -- $(eval curl_or_wget := $(shell if hash curl 2>/dev/null; then echo "curl -skL"; elif hash wget 2>/dev/null; then echo "wget -qO-"; fi)) - @if [ "x$(curl_or_wget)" = "x" ]; then \ -- echo "Automatic download failed: neither curl nor wget is installed. Install one of these tools or download the net manually"; exit 1; \ -- fi -- $(eval shasum_command := $(shell if hash shasum 2>/dev/null; then echo "shasum -a 256 "; elif hash sha256sum 2>/dev/null; then echo "sha256sum "; fi)) +- echo "Neither curl nor wget is installed. Install one of these tools unless the net has been downloaded manually"; \ +- fi - @if [ "x$(shasum_command)" = "x" ]; then \ -- echo "shasum / sha256sum not found, skipping net validation"; \ -- fi +- echo "shasum / sha256sum not found, skipping net validation"; \ +- elif test -f "$(nnuenet)"; then \ +- if [ "$(nnuenet)" != "nn-"`$(shasum_command) $(nnuenet) | cut -c1-12`".nnue" ]; then \ +- echo "Removing invalid network"; rm -f $(nnuenet); \ +- fi; \ +- fi; - @for nnuedownloadurl in "$(nnuedownloadurl1)" "$(nnuedownloadurl2)"; do \ -- if test -f "$(nnuenet)"; then \ -- echo "$(nnuenet) available."; \ -- else \ -- if [ "x$(curl_or_wget)" != "x" ]; then \ -- echo "Downloading $${nnuedownloadurl}"; $(curl_or_wget) $${nnuedownloadurl} > $(nnuenet);\ -- fi; \ -- fi; \ -- if [ "x$(shasum_command)" != "x" ]; then \ -- if [ "$(nnuenet)" != "nn-"`$(shasum_command) $(nnuenet) | cut -c1-12`".nnue" ]; then \ -- echo "Removing failed download"; rm -f $(nnuenet); \ -- else \ -- echo "Network validated"; break; \ -- fi; \ -- fi; \ +- if test -f "$(nnuenet)"; then \ +- echo "$(nnuenet) available : OK"; break; \ +- else \ +- if [ "x$(curl_or_wget)" != "x" ]; then \ +- echo "Downloading $${nnuedownloadurl}"; $(curl_or_wget) $${nnuedownloadurl} > $(nnuenet);\ +- else \ +- echo "No net found and download not possible"; exit 1;\ +- fi; \ +- fi; \ +- if [ "x$(shasum_command)" != "x" ]; then \ +- if [ "$(nnuenet)" != "nn-"`$(shasum_command) $(nnuenet) | cut -c1-12`".nnue" ]; then \ +- echo "Removing failed download"; rm -f $(nnuenet); \ +- fi; \ +- fi; \ - done - @if ! test -f "$(nnuenet)"; then \ -- echo "Failed to download $(nnuenet)."; \ -- fi +- echo "Failed to download $(nnuenet)."; \ +- fi; +- @if [ "x$(shasum_command)" != "x" ]; then \ +- if [ "$(nnuenet)" = "nn-"`$(shasum_command) $(nnuenet) | cut -c1-12`".nnue" ]; then \ +- echo "Network validated"; break; \ +- fi; \ +- fi; +-endef - - # clean binaries and objects - objclean: - @rm -f stockfish stockfish.exe *.o ./syzygy/*.o ./nnue/*.o ./nnue/features/*.o -@@ -901,7 +866,7 @@ default: + # set up shell variables for the net stuff + define netvariables + $(eval nnuenet := $(shell grep $(1) evaluate.h | grep define | sed 's/.*\(nn-[a-z0-9]\{12\}.nnue\).*/\1/')) +@@ -989,7 +950,7 @@ default: all: $(EXE) .depend -config-sanity: net -+config-sanity: ++config-sanity: @echo "" @echo "Config:" @echo "debug: '$(debug)'" +@@ -1098,6 +1059,6 @@ icx-profile-use: + .depend: $(SRCS) + -@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@ 2> /dev/null + +-ifeq (, $(filter $(MAKECMDGOALS), help strip install clean net objclean profileclean config-sanity)) ++ifeq (, $(filter $(MAKECMDGOALS), help strip install clean objclean profileclean config-sanity)) + -include .depend + endif diff --git a/stockfish.changes b/stockfish.changes index c5a59f9..04afb6e 100644 --- a/stockfish.changes +++ b/stockfish.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Mon Feb 26 12:09:26 UTC 2024 - Michael Vetter + +- Update to 16.1: + * In our testing against its predecessor, Stockfish 16.1 shows a + notable improvement in performance, with an Elo gain of up to + 27 points and winning over 2 times more game pairs than it loses. + * Updated neural network architecture: The neural network architecture + has undergone two updates and is currently in its 8th version. + * Removal of handcrafted evaluation (HCE): This release marks the + removal of the traditional handcrafted evaluation and the transition + to a fully neural network-based approach. + * Dual NNUE: For the first time, Stockfish includes a secondary neural + network, used to quickly evaluate positions that are easily decided. + * Use NNUE and UCI_AnalyseMode have been removed as they no longer had + any effect. SlowMover has also been removed in favor of Move Overhead. +- Use %autosetup macro. Allows to eliminate the usage of deprecated PatchN. + ------------------------------------------------------------------- Tue Dec 6 15:15:03 UTC 2022 - Michael Vetter diff --git a/stockfish.spec b/stockfish.spec index 3120fc0..90d1d91 100644 --- a/stockfish.spec +++ b/stockfish.spec @@ -1,7 +1,7 @@ # # spec file for package stockfish # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,15 +17,17 @@ # See evaluate.h > EvalFileDefaultName -%define nnuenet nn-ad9b42354671.nnue +%define nnuenetS nn-baff1ede1f90.nnue +%define nnuenetB nn-b1a57edbea57.nnue Name: stockfish -Version: 15.1 +Version: 16.1 Release: 0 Summary: Chess engine License: GPL-3.0-or-later URL: https://stockfishchess.org Source0: https://github.com/official-stockfish/Stockfish/archive/sf_%{version}.tar.gz#/Stockfish-sf_%{version}.tar.gz -Source1: https://tests.stockfishchess.org/api/nn/%{nnuenet} +Source1: https://tests.stockfishchess.org/api/nn/%{nnuenetS} +Source2: https://tests.stockfishchess.org/api/nn/%{nnuenetB} # steal some documentation from ubuntu Source10: %{name}-interface.txt Source11: %{name}.6-20091204230329-yljoyxocuxhxg1ot-76/%{name}.6 @@ -51,10 +53,9 @@ order to be used comfortably. Read the documentation for your GUI of choice for information about how to use Stockfish with your GUI. %prep -%setup -q -n Stockfish-sf_%{version} -%patch0 -p1 -%patch1 -p1 +%autosetup -p1 -n Stockfish-sf_%{version} cp %{SOURCE1} src/ +cp %{SOURCE2} src/ cp -p %{SOURCE10} %{SOURCE11} . dos2unix %{name}-interface.txt