From f154ed7a2d4176670cc971611b1b32e8d3d18b4b Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Sat, 29 Oct 2022 08:23:11 +0200 Subject: [PATCH 01/19] Update MacOS CI move to 12 following actions runner update deprecation (see https://github.com/actions/runner-images/issues/5583) closes https://github.com/official-stockfish/Stockfish/pull/4212 No functional change --- .github/workflows/stockfish.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/stockfish.yml b/.github/workflows/stockfish.yml index b007ec78..6ff73522 100644 --- a/.github/workflows/stockfish.yml +++ b/.github/workflows/stockfish.yml @@ -62,17 +62,17 @@ jobs: shell: 'bash {0}' } - { - name: "MacOS 10.15 Apple Clang", - os: macos-10.15, + name: "MacOS 12 Apple Clang", + os: macos-12, compiler: clang++, comp: clang, run_64bit_tests: true, shell: 'bash {0}' } - { - name: "MacOS 10.15 GCC 10", - os: macos-10.15, - compiler: g++-10, + name: "MacOS 12 GCC 11", + os: macos-12, + compiler: g++-11, comp: gcc, run_64bit_tests: true, shell: 'bash {0}' From d09653df0d1bfec0af05ab2e8975e0d8e5cccba8 Mon Sep 17 00:00:00 2001 From: kurt22i Date: Sun, 30 Oct 2022 09:02:48 -0400 Subject: [PATCH 02/19] Adjust reduction less at medium depths This patch dampens the reduction increase/decrease from statScore at mid-range depths. Inspired by patterns noticed in this tune: https://tests.stockfishchess.org/tests/view/635188930e5f47a8d0ffe8f5 Passed STC: https://tests.stockfishchess.org/tests/view/63599dfd6b27ef94d9ec04af LLR: 2.95 (-2.94,2.94) <0.00,2.00> Total: 87464 W: 23519 L: 23134 D: 40811 Ptnml(0-2): 319, 9599, 23524, 9958, 332 Passed LTC: https://tests.stockfishchess.org/tests/view/635a73046b27ef94d9ec2313 LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 154792 W: 41746 L: 41214 D: 71832 Ptnml(0-2): 79, 15181, 46349, 15703, 84 closes https://github.com/official-stockfish/Stockfish/pull/4213 Bench 4271738 --- AUTHORS | 2 +- src/search.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 173669d4..432d9b90 100644 --- a/AUTHORS +++ b/AUTHORS @@ -91,7 +91,7 @@ Hongzhi Cheng Ivan Ivec (IIvec) Jacques B. (Timshel) Jan Ondruš (hxim) -Jared Kish (Kurtbusch) +Jared Kish (Kurtbusch, kurt22i) Jarrod Torriero (DU-jdto) Jean Gauthier (OuaisBla) Jean-Francois Romang (jromang) diff --git a/src/search.cpp b/src/search.cpp index 898de875..422d4b43 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1177,7 +1177,7 @@ moves_loop: // When in check, search starts here - 4433; // Decrease/increase reduction for moves with a good/bad history (~30 Elo) - r -= ss->statScore / 13628; + r -= ss->statScore / (13628 + 4000 * (depth > 7 && depth < 19)); // In general we want to cap the LMR depth search at newDepth, but when // reduction is negative, we allow this move a limited search extension From 61a2cb84a60b8a48a0e1d34955d8a4d1acdcf497 Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Sat, 5 Nov 2022 09:14:11 +0100 Subject: [PATCH 03/19] Mark variable as potentially unused fixes CI when compiled with -Werror closes https://github.com/official-stockfish/Stockfish/pull/4221 No functional change --- src/position.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/position.cpp b/src/position.cpp index 62e6e238..5befcaf2 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -129,7 +129,7 @@ void Position::init() { // Prepare the cuckoo tables std::memset(cuckoo, 0, sizeof(cuckoo)); std::memset(cuckooMove, 0, sizeof(cuckooMove)); - int count = 0; + [[maybe_unused]] int count = 0; for (Piece pc : Pieces) for (Square s1 = SQ_A1; s1 <= SQ_H8; ++s1) for (Square s2 = Square(s1 + 1); s2 <= SQ_H8; ++s2) From ad2aa8c06f438de8b8bb7b7c8726430e3f2a5685 Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Mon, 31 Oct 2022 20:36:43 +0100 Subject: [PATCH 04/19] Normalize evaluation Normalizes the internal value as reported by evaluate or search to the UCI centipawn result used in output. This value is derived from the win_rate_model() such that Stockfish outputs an advantage of "100 centipawns" for a position if the engine has a 50% probability to win from this position in selfplay at fishtest LTC time control. The reason to introduce this normalization is that our evaluation is, since NNUE, no longer related to the classical parameter PawnValueEg (=208). This leads to the current evaluation changing quite a bit from release to release, for example, the eval needed to have 50% win probability at fishtest LTC (in cp and internal Value): June 2020 : 113cp (237) June 2021 : 115cp (240) April 2022 : 134cp (279) July 2022 : 167cp (348) With this patch, a 100cp advantage will have a fixed interpretation, i.e. a 50% win chance. To keep this value steady, it will be needed to update the win_rate_model() from time to time, based on fishtest data. This analysis can be performed with a set of scripts currently available at https://github.com/vondele/WLD_model fixes https://github.com/official-stockfish/Stockfish/issues/4155 closes https://github.com/official-stockfish/Stockfish/pull/4216 No functional change --- src/nnue/evaluate_nnue.cpp | 4 ++-- src/uci.cpp | 12 ++++++++---- src/uci.h | 7 +++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/nnue/evaluate_nnue.cpp b/src/nnue/evaluate_nnue.cpp index ba2ed367..4715fed0 100644 --- a/src/nnue/evaluate_nnue.cpp +++ b/src/nnue/evaluate_nnue.cpp @@ -220,7 +220,7 @@ namespace Stockfish::Eval::NNUE { buffer[0] = (v < 0 ? '-' : v > 0 ? '+' : ' '); - int cp = std::abs(100 * v / PawnValueEg); + int cp = std::abs(100 * v / UCI::NormalizeToPawnValue); if (cp >= 10000) { buffer[1] = '0' + cp / 10000; cp %= 10000; @@ -251,7 +251,7 @@ namespace Stockfish::Eval::NNUE { buffer[0] = (v < 0 ? '-' : v > 0 ? '+' : ' '); - double cp = 1.0 * std::abs(int(v)) / PawnValueEg; + double cp = 1.0 * std::abs(int(v)) / UCI::NormalizeToPawnValue; sprintf(&buffer[1], "%6.2f", cp); } diff --git a/src/uci.cpp b/src/uci.cpp index d5e2c2c3..19e2b0cb 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -207,13 +207,17 @@ namespace { // The coefficients of a third-order polynomial fit is based on the fishtest data // for two parameters that need to transform eval to the argument of a logistic // function. - double as[] = { 0.50379905, -4.12755858, 18.95487051, 152.00733652}; - double bs[] = {-1.71790378, 10.71543602, -17.05515898, 41.15680404}; + constexpr double as[] = { 1.04790516, -8.58534089, 39.42615625, 316.17524816}; + constexpr double bs[] = { -3.57324784, 22.28816201, -35.47480551, 85.60617701 }; + + // Enforce that NormalizeToPawnValue corresponds to a 50% win rate at ply 64 + static_assert(UCI::NormalizeToPawnValue == int(as[0] + as[1] + as[2] + as[3])); + double a = (((as[0] * m + as[1]) * m + as[2]) * m) + as[3]; double b = (((bs[0] * m + bs[1]) * m + bs[2]) * m) + bs[3]; // Transform the eval to centipawns with limited range - double x = std::clamp(double(100 * v) / PawnValueEg, -2000.0, 2000.0); + double x = std::clamp(double(v), -4000.0, 4000.0); // Return the win rate in per mille units rounded to the nearest value return int(0.5 + 1000 / (1 + std::exp((a - x) / b))); @@ -312,7 +316,7 @@ string UCI::value(Value v) { stringstream ss; if (abs(v) < VALUE_MATE_IN_MAX_PLY) - ss << "cp " << v * 100 / PawnValueEg; + ss << "cp " << v * 100 / NormalizeToPawnValue; else ss << "mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2; diff --git a/src/uci.h b/src/uci.h index 76a893f9..f5f2c385 100644 --- a/src/uci.h +++ b/src/uci.h @@ -30,6 +30,13 @@ class Position; namespace UCI { +// Normalizes the internal value as reported by evaluate or search +// to the UCI centipawn result used in output. This value is derived from +// the win_rate_model() such that Stockfish outputs an advantage of +// "100 centipawns" for a position if the engine has a 50% probability to win +// from this position in selfplay at fishtest LTC time control. +const int NormalizeToPawnValue = 348; + class Option; /// Define a custom comparator, because the UCI options should be case-insensitive From e048d1182562eb7ce1eae45f626681206da446b8 Mon Sep 17 00:00:00 2001 From: disservin Date: Sun, 6 Nov 2022 16:17:17 +0100 Subject: [PATCH 05/19] Change versioning and save binaries as CI artifacts For development versions of Stockfish, the version will now look like dev-20221107-dca9a0533 indicating a development version, the date of the last commit, and the git SHA of that commit. If git is not available, the fallback is the date of compilation. Releases will continue to be versioned as before. Additionally, this PR extends the CI to create binary artifacts, i.e. pushes to master will automatically build Stockfish and upload the binaries to github. closes https://github.com/official-stockfish/Stockfish/pull/4220 No functional change --- .github/workflows/stockfish.yml | 5 +- .github/workflows/stockfish_binaries.yml | 110 +++++++++++++++++++++++ src/Makefile | 18 +++- src/misc.cpp | 47 ++++++---- 4 files changed, 163 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/stockfish_binaries.yml diff --git a/.github/workflows/stockfish.yml b/.github/workflows/stockfish.yml index 6ff73522..28830133 100644 --- a/.github/workflows/stockfish.yml +++ b/.github/workflows/stockfish.yml @@ -10,6 +10,9 @@ on: - master - tools jobs: + Binaries: + if: github.ref == 'refs/heads/master' + uses: ./.github/workflows/stockfish_binaries.yml Stockfish: name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} @@ -113,7 +116,7 @@ jobs: working-directory: src shell: ${{ matrix.config.shell }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/stockfish_binaries.yml b/.github/workflows/stockfish_binaries.yml new file mode 100644 index 00000000..0b205ded --- /dev/null +++ b/.github/workflows/stockfish_binaries.yml @@ -0,0 +1,110 @@ +name: Stockfish +on: + workflow_call: +jobs: + Stockfish: + name: ${{ matrix.config.name }} ${{ matrix.binaries }} + runs-on: ${{ matrix.config.os }} + env: + COMPILER: ${{ matrix.config.compiler }} + COMP: ${{ matrix.config.comp }} + EXT: ${{ matrix.config.ext }} + OS: ${{ matrix.config.os }} + BINARY: ${{ matrix.binaries }} + strategy: + matrix: + config: + - { + name: "Ubuntu 20.04 GCC", + os: ubuntu-20.04, + compiler: g++, + comp: gcc, + shell: 'bash {0}' + } + - { + name: "MacOS 12 Apple Clang", + os: macos-12, + compiler: clang++, + comp: clang, + shell: 'bash {0}' + } + - { + name: "Windows 2022 Mingw-w64 GCC x86_64", + os: windows-2022, + compiler: g++, + comp: mingw, + msys_sys: 'mingw64', + msys_env: 'x86_64-gcc', + shell: 'msys2 {0}', + ext: .exe + } + binaries: + - x86-64 + - x86-64-modern + - x86-64-avx2 + exclude: + - binaries: x86-64-avx2 + config: {os: macos-12} + defaults: + run: + working-directory: src + shell: ${{ matrix.config.shell }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Download required linux packages + if: runner.os == 'Linux' + run: | + sudo apt update + + - name: Setup msys and install required packages + if: runner.os == 'Windows' + uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.config.msys_sys}} + install: mingw-w64-${{matrix.config.msys_env}} make git expect + + - name: Download the used network from the fishtest framework + run: | + make net + + - name: Check compiler + run: | + export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin + $COMPILER -v + + - name: Test help target + run: | + make help + + # Compile profile guided builds + + - name: Compile ${{ matrix.binaries }} build + run: | + make clean + make -j2 profile-build ARCH=$BINARY COMP=$COMP + strip ./stockfish$EXT + mv ./stockfish$EXT ../stockfish-$OS-$BINARY$EXT + + - name: Remove non src files + run: rm -f *.o .depend *.nnue + + - name: Create tar archive. + run: | + cd .. + mkdir stockfish + cp -r src stockfish/ + cp stockfish-$OS-$BINARY$EXT stockfish/ + cp "Top CPU Contributors.txt" stockfish/ + cp Copying.txt stockfish/ + cp AUTHORS stockfish/ + tar -cvf stockfish-$OS-$BINARY.tar stockfish + + - name: Upload binaries + uses: actions/upload-artifact@v3 + with: + name: stockfish-${{ matrix.config.os }}-${{ matrix.binaries }} + path: | + stockfish-${{ matrix.config.os }}-${{ matrix.binaries }}.tar diff --git a/src/Makefile b/src/Makefile index e481aca5..917bd5c0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -682,6 +682,18 @@ ifeq ($(pext),yes) endif endif +### 3.7.1 Try to include git commit sha for versioning +GIT_SHA = $(shell git rev-parse --short HEAD 2>/dev/null) +ifneq ($(GIT_SHA), ) + CXXFLAGS += -DGIT_SHA=\"$(GIT_SHA)\" +endif + +### 3.7.2 Try to include git commit date for versioning +GIT_DATE = $(shell git show -s --date=format:'%Y%m%d' --format=%cd HEAD 2>/dev/null) +ifneq ($(GIT_DATE), ) + CXXFLAGS += -DGIT_DATE=\"$(GIT_DATE)\" +endif + ### 3.8 Link Time Optimization ### This is a mix of compile and link time options because the lto link phase ### needs access to the optimization flags. @@ -800,7 +812,7 @@ endif .PHONY: help build profile-build strip install clean net objclean profileclean \ config-sanity icc-profile-use icc-profile-make gcc-profile-use gcc-profile-make \ - clang-profile-use clang-profile-make + clang-profile-use clang-profile-make FORCE build: net config-sanity $(MAKE) ARCH=$(ARCH) COMP=$(COMP) all @@ -948,6 +960,10 @@ config-sanity: net $(EXE): $(OBJS) +$(CXX) -o $@ $(OBJS) $(LDFLAGS) +# Force recompilation to ensure version info is up-to-date +misc.o: FORCE +FORCE: + clang-profile-make: $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ EXTRACXXFLAGS='-fprofile-instr-generate ' \ diff --git a/src/misc.cpp b/src/misc.cpp index d19cd840..c7fa0e9a 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -67,9 +67,8 @@ namespace Stockfish { namespace { -/// Version number. If Version is left empty, then compile date in the format -/// DD-MM-YY and show in engine_info. -const string Version = ""; +/// Version number or dev. +const string version = "dev"; /// Our fancy logging facility. The trick here is to replace cin.rdbuf() and /// cout.rdbuf() with two Tie objects that tie cin and cout to a file stream. We @@ -138,23 +137,41 @@ public: } // namespace -/// engine_info() returns the full name of the current Stockfish version. This -/// will be either "Stockfish DD-MM-YY" (where DD-MM-YY is the date when -/// the program was compiled) or "Stockfish ", depending on whether -/// Version is empty. +/// engine_info() returns the full name of the current Stockfish version. +/// For local dev compiles we try to append the commit sha and commit date +/// from git if that fails only the local compilation date is set and "nogit" is specified: +/// Stockfish dev-YYYYMMDD-SHA +/// or +/// Stockfish dev-YYYYMMDD-nogit +/// +/// For releases (non dev builds) we only include the version number: +/// Stockfish version string engine_info(bool to_uci) { + stringstream ss; + ss << "Stockfish " << version << setfill('0'); - const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"); - string month, day, year; - stringstream ss, date(__DATE__); // From compiler, format is "Sep 21 2008" - - ss << "Stockfish " << Version << setfill('0'); - - if (Version.empty()) + if (version == "dev") { + 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" + date >> month >> day >> year; - ss << setw(2) << day << setw(2) << (1 + months.find(month) / 4) << year.substr(2); + ss << year << setw(2) << setfill('0') << (1 + months.find(month) / 4) << setw(2) << setfill('0') << day; + #endif + + ss << "-"; + + #ifdef GIT_SHA + ss << GIT_SHA; + #else + ss << "nogit"; + #endif } ss << (to_uci ? "\nid author ": " by ") From a41390079147aea89cb5222089a45e1958ebec8e Mon Sep 17 00:00:00 2001 From: disservin Date: Thu, 3 Nov 2022 21:53:02 +0100 Subject: [PATCH 06/19] Remove trend Simplify trend away. passed Non-regression STC: https://tests.stockfishchess.org/tests/view/63642a63a90afcecbd1cb887 LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 130000 W: 34683 L: 34567 D: 60750 Ptnml(0-2): 455, 14424, 35135, 14522, 464 passed Non-regression LTC: https://tests.stockfishchess.org/tests/view/636566fda90afcecbd1cded9 LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 81592 W: 21938 L: 21787 D: 37867 Ptnml(0-2): 42, 8035, 24490, 8188, 41 closes https://github.com/official-stockfish/Stockfish/pull/4222 Bench: 4239512 --- src/evaluate.cpp | 3 +-- src/search.cpp | 7 +------ src/thread.h | 1 - 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index d5844593..d18c2c93 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -981,7 +981,7 @@ namespace { // Initialize score by reading the incrementally updated scores included in // the position object (material + piece square tables) and the material // imbalance. Score is computed internally from the white point of view. - Score score = pos.psq_score() + me->imbalance() + pos.this_thread()->trend; + Score score = pos.psq_score() + me->imbalance(); // Probe the pawn hash table pe = Pawns::probe(pos); @@ -1115,7 +1115,6 @@ std::string Eval::trace(Position& pos) { std::memset(scores, 0, sizeof(scores)); // Reset any global variable used in eval - pos.this_thread()->trend = SCORE_ZERO; pos.this_thread()->bestValue = VALUE_ZERO; pos.this_thread()->optimism[WHITE] = VALUE_ZERO; pos.this_thread()->optimism[BLACK] = VALUE_ZERO; diff --git a/src/search.cpp b/src/search.cpp index 422d4b43..77619345 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -309,7 +309,6 @@ void Thread::search() { complexityAverage.set(155, 1); - trend = SCORE_ZERO; optimism[us] = optimism[~us] = VALUE_ZERO; int searchAgainCounter = 0; @@ -356,11 +355,7 @@ void Thread::search() { alpha = std::max(prev - delta,-VALUE_INFINITE); beta = std::min(prev + delta, VALUE_INFINITE); - // Adjust trend and optimism based on root move's previousScore - int tr = 116 * prev / (std::abs(prev) + 89); - trend = (us == WHITE ? make_score(tr, tr / 2) - : -make_score(tr, tr / 2)); - + // Adjust optimism based on root move's previousScore int opt = 118 * prev / (std::abs(prev) + 169); optimism[ us] = Value(opt); optimism[~us] = -optimism[us]; diff --git a/src/thread.h b/src/thread.h index c430a818..5f0b2c3e 100644 --- a/src/thread.h +++ b/src/thread.h @@ -75,7 +75,6 @@ public: ButterflyHistory mainHistory; CapturePieceToHistory captureHistory; ContinuationHistory continuationHistory[2][2]; - Score trend; }; From 6c1df553fa7a94551de7b07515a29098a2f23c16 Mon Sep 17 00:00:00 2001 From: disservin Date: Mon, 7 Nov 2022 18:15:42 +0100 Subject: [PATCH 07/19] speedup CI Github Actions allows us to use up to 20 workers. This way we can launch multiple different checks at the same time and optimize the overall time the CI takes a bit. closes https://github.com/official-stockfish/Stockfish/pull/4223 No functional change --- .github/workflows/stockfish.yml | 344 +------------------ .github/workflows/stockfish_compile_test.yml | 115 +++++++ .github/workflows/stockfish_sanitizers.yml | 77 +++++ .github/workflows/stockfish_test.yml | 284 +++++++++++++++ 4 files changed, 482 insertions(+), 338 deletions(-) create mode 100644 .github/workflows/stockfish_compile_test.yml create mode 100644 .github/workflows/stockfish_sanitizers.yml create mode 100644 .github/workflows/stockfish_test.yml diff --git a/.github/workflows/stockfish.yml b/.github/workflows/stockfish.yml index 28830133..07ecfc07 100644 --- a/.github/workflows/stockfish.yml +++ b/.github/workflows/stockfish.yml @@ -10,344 +10,12 @@ on: - master - tools jobs: + Sanitizers: + uses: ./.github/workflows/stockfish_sanitizers.yml + Tests: + uses: ./.github/workflows/stockfish_test.yml + Compiles: + uses: ./.github/workflows/stockfish_compile_test.yml Binaries: if: github.ref == 'refs/heads/master' uses: ./.github/workflows/stockfish_binaries.yml - Stockfish: - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.os }} - env: - COMPILER: ${{ matrix.config.compiler }} - COMP: ${{ matrix.config.comp }} - CXXFLAGS: "-Werror" - strategy: - matrix: - config: - # set the variable for the required tests: - # run_expensive_tests: true - # run_32bit_tests: true - # run_64bit_tests: true - # run_armv8_tests: true - # run_armv7_tests: true - - { - name: "Ubuntu 20.04 GCC", - os: ubuntu-20.04, - compiler: g++, - comp: gcc, - run_expensive_tests: true, - run_32bit_tests: true, - run_64bit_tests: true, - shell: 'bash {0}' - } - - { - name: "Ubuntu 20.04 Clang", - os: ubuntu-20.04, - compiler: clang++, - comp: clang, - run_32bit_tests: true, - run_64bit_tests: true, - shell: 'bash {0}' - } - - { - name: "Ubuntu 20.04 NDK armv8", - os: ubuntu-20.04, - compiler: aarch64-linux-android21-clang++, - comp: ndk, - run_armv8_tests: false, - shell: 'bash {0}' - } - - { - name: "Ubuntu 20.04 NDK armv7", - os: ubuntu-20.04, - compiler: armv7a-linux-androideabi21-clang++, - comp: ndk, - run_armv7_tests: false, - shell: 'bash {0}' - } - - { - name: "MacOS 12 Apple Clang", - os: macos-12, - compiler: clang++, - comp: clang, - run_64bit_tests: true, - shell: 'bash {0}' - } - - { - name: "MacOS 12 GCC 11", - os: macos-12, - compiler: g++-11, - comp: gcc, - run_64bit_tests: true, - shell: 'bash {0}' - } - - { - name: "Windows 2022 Mingw-w64 GCC x86_64", - os: windows-2022, - compiler: g++, - comp: mingw, - run_64bit_tests: true, - msys_sys: 'mingw64', - msys_env: 'x86_64-gcc', - shell: 'msys2 {0}' - } - - { - name: "Windows 2022 Mingw-w64 GCC i686", - os: windows-2022, - compiler: g++, - comp: mingw, - run_32bit_tests: true, - msys_sys: 'mingw32', - msys_env: 'i686-gcc', - shell: 'msys2 {0}' - } - - { - name: "Windows 2022 Mingw-w64 Clang x86_64", - os: windows-2022, - compiler: clang++, - comp: clang, - run_64bit_tests: true, - msys_sys: 'clang64', - msys_env: 'clang-x86_64-clang', - shell: 'msys2 {0}' - } - - defaults: - run: - working-directory: src - shell: ${{ matrix.config.shell }} - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Download required linux packages - if: runner.os == 'Linux' - run: | - sudo apt update - sudo apt install expect valgrind g++-multilib qemu-user - - - name: Setup msys and install required packages - if: runner.os == 'Windows' - uses: msys2/setup-msys2@v2 - with: - msystem: ${{matrix.config.msys_sys}} - install: mingw-w64-${{matrix.config.msys_env}} make git expect - - - name: Download the used network from the fishtest framework - run: | - make net - - - name: Extract the bench number from the commit history - run: | - git log HEAD | grep "\b[Bb]ench[ :]\+[0-9]\{7\}" | head -n 1 | sed "s/[^0-9]*\([0-9]*\).*/\1/g" > git_sig - [ -s git_sig ] && echo "benchref=$(cat git_sig)" >> $GITHUB_ENV && echo "Reference bench:" $(cat git_sig) || echo "No bench found" - - - name: Check compiler - run: | - export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin - $COMPILER -v - - - name: Test help target - run: | - make help - - # x86-32 tests - - - name: Test debug x86-32 build - if: ${{ matrix.config.run_32bit_tests }} - run: | - export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG" - make clean - make -j2 ARCH=x86-32 optimize=no debug=yes build - ../tests/signature.sh $benchref - - - name: Test x86-32 build - if: ${{ matrix.config.run_32bit_tests }} - run: | - make clean - make -j2 ARCH=x86-32 build - ../tests/signature.sh $benchref - - - name: Test x86-32-sse41-popcnt build - if: ${{ matrix.config.run_32bit_tests }} - run: | - make clean - make -j2 ARCH=x86-32-sse41-popcnt build - ../tests/signature.sh $benchref - - - name: Test x86-32-sse2 build - if: ${{ matrix.config.run_32bit_tests }} - run: | - make clean - make -j2 ARCH=x86-32-sse2 build - ../tests/signature.sh $benchref - - - name: Test general-32 build - if: ${{ matrix.config.run_32bit_tests }} - run: | - make clean - make -j2 ARCH=general-32 build - ../tests/signature.sh $benchref - - # x86-64 tests - - - name: Test debug x86-64-modern build - if: ${{ matrix.config.run_64bit_tests }} - run: | - export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG" - make clean - make -j2 ARCH=x86-64-modern optimize=no debug=yes build - ../tests/signature.sh $benchref - - - name: Test x86-64-modern build - if: ${{ matrix.config.run_64bit_tests }} - run: | - make clean - make -j2 ARCH=x86-64-modern build - ../tests/signature.sh $benchref - - - name: Test x86-64-ssse3 build - if: ${{ matrix.config.run_64bit_tests }} - run: | - make clean - make -j2 ARCH=x86-64-ssse3 build - ../tests/signature.sh $benchref - - - name: Test x86-64-sse3-popcnt build - if: ${{ matrix.config.run_64bit_tests }} - run: | - make clean - make -j2 ARCH=x86-64-sse3-popcnt build - ../tests/signature.sh $benchref - - - name: Test x86-64 build - if: ${{ matrix.config.run_64bit_tests }} - run: | - make clean - make -j2 ARCH=x86-64 build - ../tests/signature.sh $benchref - - - name: Test general-64 build - if: matrix.config.run_64bit_tests - run: | - make clean - make -j2 ARCH=general-64 build - ../tests/signature.sh $benchref - - # x86-64 with newer extensions tests - - - name: Compile x86-64-avx2 build - if: ${{ matrix.config.run_64bit_tests }} - run: | - make clean - make -j2 ARCH=x86-64-avx2 build - - - name: Compile x86-64-bmi2 build - if: ${{ matrix.config.run_64bit_tests }} - run: | - make clean - make -j2 ARCH=x86-64-bmi2 build - - - name: Compile x86-64-avx512 build - if: ${{ matrix.config.run_64bit_tests }} - run: | - make clean - make -j2 ARCH=x86-64-avx512 build - - - name: Compile x86-64-vnni512 build - if: ${{ matrix.config.run_64bit_tests }} - run: | - make clean - make -j2 ARCH=x86-64-vnni512 build - - - name: Compile x86-64-vnni256 build - if: ${{ matrix.config.run_64bit_tests }} - run: | - make clean - make -j2 ARCH=x86-64-vnni256 build - - # armv8 tests - - - name: Test armv8 build - if: ${{ matrix.config.run_armv8_tests }} - run: | - ANDROID_ROOT=/usr/local/lib/android - ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk - SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager - echo "y" | $SDKMANAGER "ndk;21.4.7075529" - ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle - ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK_ROOT - export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH - export LDFLAGS="-static -Wno-unused-command-line-argument" - make clean - make -j2 ARCH=armv8 build - ../tests/signature.sh $benchref - - # armv7 tests - - - name: Test armv7 build - if: ${{ matrix.config.run_armv7_tests }} - run: | - ANDROID_ROOT=/usr/local/lib/android - ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk - SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager - echo "y" | $SDKMANAGER "ndk;21.4.7075529" - ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle - ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK_ROOT - export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH - export LDFLAGS="-static -Wno-unused-command-line-argument" - make clean - make -j2 ARCH=armv7 build - ../tests/signature.sh $benchref - - - name: Test armv7-neon build - if: ${{ matrix.config.run_armv7_tests }} - run: | - ANDROID_ROOT=/usr/local/lib/android - ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk - SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager - echo "y" | $SDKMANAGER "ndk;21.4.7075529" - ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle - ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK_ROOT - export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH - export LDFLAGS="-static -Wno-unused-command-line-argument" - make clean - make -j2 ARCH=armv7-neon build - ../tests/signature.sh $benchref - - # Other tests - - - name: Check perft and search reproducibility - if: ${{ matrix.config.run_64bit_tests }} - run: | - make clean - make -j2 ARCH=x86-64-modern build - ../tests/perft.sh - ../tests/reprosearch.sh - - # Sanitizers - - - name: Run under valgrind - if: ${{ matrix.config.run_expensive_tests }} - run: | - export CXXFLAGS="-O1 -fno-inline" - make clean - make -j2 ARCH=x86-64-modern debug=yes optimize=no build > /dev/null - ../tests/instrumented.sh --valgrind - ../tests/instrumented.sh --valgrind-thread - - - name: Run with UB sanitizer - if: ${{ matrix.config.run_expensive_tests }} - run: | - export CXXFLAGS="-O1 -fno-inline" - make clean - make -j2 ARCH=x86-64-modern sanitize=undefined optimize=no debug=yes build > /dev/null - ../tests/instrumented.sh --sanitizer-undefined - - - name: Run with thread sanitizer - if: ${{ matrix.config.run_expensive_tests }} - run: | - export CXXFLAGS="-O1 -fno-inline" - make clean - make -j2 ARCH=x86-64-modern sanitize=thread optimize=no debug=yes build > /dev/null - ../tests/instrumented.sh --sanitizer-thread diff --git a/.github/workflows/stockfish_compile_test.yml b/.github/workflows/stockfish_compile_test.yml new file mode 100644 index 00000000..63136737 --- /dev/null +++ b/.github/workflows/stockfish_compile_test.yml @@ -0,0 +1,115 @@ +name: Stockfish +on: + workflow_call: +jobs: + Stockfish: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + env: + COMPILER: ${{ matrix.config.compiler }} + COMP: ${{ matrix.config.comp }} + strategy: + matrix: + config: + - { + name: "Ubuntu 20.04 GCC", + os: ubuntu-20.04, + compiler: g++, + comp: gcc, + shell: 'bash {0}' + } + - { + name: "Ubuntu 20.04 Clang", + os: ubuntu-20.04, + compiler: clang++, + comp: clang, + shell: 'bash {0}' + } + - { + name: "MacOS 12 Apple Clang", + os: macos-12, + compiler: clang++, + comp: clang, + shell: 'bash {0}' + } + - { + name: "MacOS 12 GCC 11", + os: macos-12, + compiler: g++-11, + comp: gcc, + shell: 'bash {0}' + } + - { + name: "Windows 2022 Mingw-w64 GCC x86_64", + os: windows-2022, + compiler: g++, + comp: mingw, + msys_sys: 'mingw64', + msys_env: 'x86_64-gcc', + shell: 'msys2 {0}' + } + - { + name: "Windows 2022 Mingw-w64 Clang x86_64", + os: windows-2022, + compiler: clang++, + comp: clang, + msys_sys: 'clang64', + msys_env: 'clang-x86_64-clang', + shell: 'msys2 {0}' + } + + defaults: + run: + working-directory: src + shell: ${{ matrix.config.shell }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup msys and install required packages + if: runner.os == 'Windows' + uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.config.msys_sys}} + install: mingw-w64-${{matrix.config.msys_env}} make git expect + + - name: Download the used network from the fishtest framework + run: | + make net + + - name: Check compiler + run: | + export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin + $COMPILER -v + + - name: Test help target + run: | + make help + + # x86-64 with newer extensions tests + + - name: Compile x86-64-avx2 build + run: | + make clean + make -j2 ARCH=x86-64-avx2 build + + - name: Compile x86-64-bmi2 build + run: | + make clean + make -j2 ARCH=x86-64-bmi2 build + + - name: Compile x86-64-avx512 build + run: | + make clean + make -j2 ARCH=x86-64-avx512 build + + - name: Compile x86-64-vnni512 build + run: | + make clean + make -j2 ARCH=x86-64-vnni512 build + + - name: Compile x86-64-vnni256 build + run: | + make clean + make -j2 ARCH=x86-64-vnni256 build \ No newline at end of file diff --git a/.github/workflows/stockfish_sanitizers.yml b/.github/workflows/stockfish_sanitizers.yml new file mode 100644 index 00000000..61eaf0c9 --- /dev/null +++ b/.github/workflows/stockfish_sanitizers.yml @@ -0,0 +1,77 @@ +name: Stockfish +on: + workflow_call: +jobs: + Stockfish: + name: ${{ matrix.sanitizers.name }} + runs-on: ${{ matrix.config.os }} + env: + COMPILER: ${{ matrix.config.compiler }} + COMP: ${{ matrix.config.comp }} + CXXFLAGS: "-Werror" + strategy: + matrix: + config: + - { + name: "Ubuntu 20.04 GCC", + os: ubuntu-20.04, + compiler: g++, + comp: gcc, + shell: 'bash {0}' + } + sanitizers: + - { + name: Run with thread sanitizer, + make_option: sanitize=thread, + instrumented_option: sanitizer-thread + } + - { + name: Run with UB sanitizer, + make_option: sanitize=undefined, + instrumented_option: sanitizer-undefined + } + - { + name: Run under valgrind, + make_option: "", + instrumented_option: valgrind + } + - { + name: Run under valgrind-thread, + make_option: "", + instrumented_option: valgrind-thread + } + defaults: + run: + working-directory: src + shell: ${{ matrix.config.shell }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Download required linux packages + run: | + sudo apt update + sudo apt install expect valgrind g++-multilib qemu-user + + - name: Download the used network from the fishtest framework + run: | + make net + + - name: Check compiler + run: | + export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin + $COMPILER -v + + - name: Test help target + run: | + make help + + # Sanitizers + + - name: ${{ matrix.sanitizers.name }} + run: | + export CXXFLAGS="-O1 -fno-inline" + make clean + make -j2 ARCH=x86-64-modern ${{ matrix.sanitizers.make_option }} debug=yes optimize=no build > /dev/null + ../tests/instrumented.sh --${{ matrix.sanitizers.instrumented_option }} \ No newline at end of file diff --git a/.github/workflows/stockfish_test.yml b/.github/workflows/stockfish_test.yml new file mode 100644 index 00000000..46b4e26f --- /dev/null +++ b/.github/workflows/stockfish_test.yml @@ -0,0 +1,284 @@ +name: Stockfish +on: + workflow_call: +jobs: + Stockfish: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + env: + COMPILER: ${{ matrix.config.compiler }} + COMP: ${{ matrix.config.comp }} + CXXFLAGS: "-Werror" + strategy: + matrix: + config: + - { + name: "Ubuntu 20.04 GCC", + os: ubuntu-20.04, + compiler: g++, + comp: gcc, + run_32bit_tests: true, + run_64bit_tests: true, + shell: 'bash {0}' + } + - { + name: "Ubuntu 20.04 Clang", + os: ubuntu-20.04, + compiler: clang++, + comp: clang, + run_32bit_tests: true, + run_64bit_tests: true, + shell: 'bash {0}' + } + - { + name: "Ubuntu 20.04 NDK armv8", + os: ubuntu-20.04, + compiler: aarch64-linux-android21-clang++, + comp: ndk, + run_armv8_tests: false, + shell: 'bash {0}' + } + - { + name: "Ubuntu 20.04 NDK armv7", + os: ubuntu-20.04, + compiler: armv7a-linux-androideabi21-clang++, + comp: ndk, + run_armv7_tests: false, + shell: 'bash {0}' + } + - { + name: "MacOS 12 Apple Clang", + os: macos-12, + compiler: clang++, + comp: clang, + run_64bit_tests: true, + shell: 'bash {0}' + } + - { + name: "MacOS 12 GCC 11", + os: macos-12, + compiler: g++-11, + comp: gcc, + run_64bit_tests: true, + shell: 'bash {0}' + } + - { + name: "Windows 2022 Mingw-w64 GCC x86_64", + os: windows-2022, + compiler: g++, + comp: mingw, + run_64bit_tests: true, + msys_sys: 'mingw64', + msys_env: 'x86_64-gcc', + shell: 'msys2 {0}' + } + - { + name: "Windows 2022 Mingw-w64 GCC i686", + os: windows-2022, + compiler: g++, + comp: mingw, + run_32bit_tests: true, + msys_sys: 'mingw32', + msys_env: 'i686-gcc', + shell: 'msys2 {0}' + } + - { + name: "Windows 2022 Mingw-w64 Clang x86_64", + os: windows-2022, + compiler: clang++, + comp: clang, + run_64bit_tests: true, + msys_sys: 'clang64', + msys_env: 'clang-x86_64-clang', + shell: 'msys2 {0}' + } + exclude: + - config: + { + name: "Ubuntu 20.04 NDK armv7" + } + - config: + { + name: "Ubuntu 20.04 NDK armv8" + } + defaults: + run: + working-directory: src + shell: ${{ matrix.config.shell }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Download required linux packages + if: runner.os == 'Linux' + run: | + sudo apt update + sudo apt install expect valgrind g++-multilib qemu-user + + - name: Setup msys and install required packages + if: runner.os == 'Windows' + uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.config.msys_sys}} + install: mingw-w64-${{matrix.config.msys_env}} make git expect + + - name: Download the used network from the fishtest framework + run: | + make net + + - name: Extract the bench number from the commit history + run: | + git log HEAD | grep "\b[Bb]ench[ :]\+[0-9]\{7\}" | head -n 1 | sed "s/[^0-9]*\([0-9]*\).*/\1/g" > git_sig + [ -s git_sig ] && echo "benchref=$(cat git_sig)" >> $GITHUB_ENV && echo "Reference bench:" $(cat git_sig) || echo "No bench found" + + - name: Check compiler + run: | + export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin + $COMPILER -v + + - name: Test help target + run: | + make help + + # x86-32 tests + + - name: Test debug x86-32 build + if: ${{ matrix.config.run_32bit_tests }} + run: | + export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG" + make clean + make -j2 ARCH=x86-32 optimize=no debug=yes build + ../tests/signature.sh $benchref + + - name: Test x86-32 build + if: ${{ matrix.config.run_32bit_tests }} + run: | + make clean + make -j2 ARCH=x86-32 build + ../tests/signature.sh $benchref + + - name: Test x86-32-sse41-popcnt build + if: ${{ matrix.config.run_32bit_tests }} + run: | + make clean + make -j2 ARCH=x86-32-sse41-popcnt build + ../tests/signature.sh $benchref + + - name: Test x86-32-sse2 build + if: ${{ matrix.config.run_32bit_tests }} + run: | + make clean + make -j2 ARCH=x86-32-sse2 build + ../tests/signature.sh $benchref + + - name: Test general-32 build + if: ${{ matrix.config.run_32bit_tests }} + run: | + make clean + make -j2 ARCH=general-32 build + ../tests/signature.sh $benchref + + # x86-64 tests + + - name: Test debug x86-64-modern build + if: ${{ matrix.config.run_64bit_tests }} + run: | + export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG" + make clean + make -j2 ARCH=x86-64-modern optimize=no debug=yes build + ../tests/signature.sh $benchref + + - name: Test x86-64-modern build + if: ${{ matrix.config.run_64bit_tests }} + run: | + make clean + make -j2 ARCH=x86-64-modern build + ../tests/signature.sh $benchref + + - name: Test x86-64-ssse3 build + if: ${{ matrix.config.run_64bit_tests }} + run: | + make clean + make -j2 ARCH=x86-64-ssse3 build + ../tests/signature.sh $benchref + + - name: Test x86-64-sse3-popcnt build + if: ${{ matrix.config.run_64bit_tests }} + run: | + make clean + make -j2 ARCH=x86-64-sse3-popcnt build + ../tests/signature.sh $benchref + + - name: Test x86-64 build + if: ${{ matrix.config.run_64bit_tests }} + run: | + make clean + make -j2 ARCH=x86-64 build + ../tests/signature.sh $benchref + + - name: Test general-64 build + if: matrix.config.run_64bit_tests + run: | + make clean + make -j2 ARCH=general-64 build + ../tests/signature.sh $benchref + + # armv8 tests + + - name: Test armv8 build + if: ${{ matrix.config.run_armv8_tests }} + run: | + ANDROID_ROOT=/usr/local/lib/android + ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk + SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager + echo "y" | $SDKMANAGER "ndk;21.4.7075529" + ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle + ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK_ROOT + export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH + export LDFLAGS="-static -Wno-unused-command-line-argument" + make clean + make -j2 ARCH=armv8 build + ../tests/signature.sh $benchref + + # armv7 tests + + - name: Test armv7 build + if: ${{ matrix.config.run_armv7_tests }} + run: | + ANDROID_ROOT=/usr/local/lib/android + ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk + SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager + echo "y" | $SDKMANAGER "ndk;21.4.7075529" + ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle + ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK_ROOT + export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH + export LDFLAGS="-static -Wno-unused-command-line-argument" + make clean + make -j2 ARCH=armv7 build + ../tests/signature.sh $benchref + + - name: Test armv7-neon build + if: ${{ matrix.config.run_armv7_tests }} + run: | + ANDROID_ROOT=/usr/local/lib/android + ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk + SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager + echo "y" | $SDKMANAGER "ndk;21.4.7075529" + ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle + ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK_ROOT + export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH + export LDFLAGS="-static -Wno-unused-command-line-argument" + make clean + make -j2 ARCH=armv7-neon build + ../tests/signature.sh $benchref + + # Other tests + + - name: Check perft and search reproducibility + if: ${{ matrix.config.run_64bit_tests }} + run: | + make clean + make -j2 ARCH=x86-64-modern build + ../tests/perft.sh + ../tests/reprosearch.sh \ No newline at end of file From 219fa2f0a79381d35d9eb1240781cc598e74f647 Mon Sep 17 00:00:00 2001 From: Michael Chaly Date: Thu, 17 Nov 2022 18:31:59 +0300 Subject: [PATCH 08/19] Do shallower search in case of lmr being not successful enough In case of a move passing LMR but it results being not too far from the current best search result produce a full depth search with reduced depth. Original idea by lonfom169 . Passed STC: https://tests.stockfishchess.org/tests/view/6373409b54d69a2f33913fbd LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 169504 W: 45351 L: 44848 D: 79305 Ptnml(0-2): 598, 18853, 45353, 19344, 604 Passed LTC: https://tests.stockfishchess.org/tests/view/6374c58528e3405283eb8d2d LLR: 2.96 (-2.94,2.94) <0.50,2.50> Total: 51144 W: 13802 L: 13471 D: 23871 Ptnml(0-2): 19, 4928, 15362, 5229, 34 closes https://github.com/official-stockfish/Stockfish/pull/4230 bench 4277005 --- src/search.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/search.cpp b/src/search.cpp index 77619345..5839763d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1184,8 +1184,11 @@ moves_loop: // When in check, search starts here // Do full depth search when reduced LMR search fails high if (value > alpha && d < newDepth) { + // Adjust full depth search based on LMR results - if result + // was good enough search deeper, if it was bad enough search shallower const bool doDeeperSearch = value > (alpha + 64 + 11 * (newDepth - d)); - value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch, !cutNode); + const bool doShallowerSearch = value < bestValue + newDepth; + value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch - doShallowerSearch, !cutNode); int bonus = value > alpha ? stat_bonus(newDepth) : -stat_bonus(newDepth); From 41c6a74d372799c6ed94b842db66f956d080e0b0 Mon Sep 17 00:00:00 2001 From: VoyagerOne Date: Mon, 14 Nov 2022 08:11:27 -0500 Subject: [PATCH 09/19] Simplification away Cutoff Reset STC: LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 150184 W: 39913 L: 39819 D: 70452 Ptnml(0-2): 493, 16796, 40474, 16782, 547 https://tests.stockfishchess.org/tests/view/63723e9e54d69a2f33911d3c LTC: LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 58880 W: 15890 L: 15717 D: 27273 Ptnml(0-2): 35, 5765, 17659, 5954, 27 https://tests.stockfishchess.org/tests/view/6373baf49849fa7a36a65427 closes https://github.com/official-stockfish/Stockfish/pull/4231 Bench: 4035152 --- src/search.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 5839763d..fa87f1c3 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1295,8 +1295,6 @@ moves_loop: // When in check, search starts here } } } - else - ss->cutoffCnt = 0; // If the move is worse than some previously searched move, remember it to update its stats later From d756d97a66cb18de182e018446b9149a5ff8ef18 Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Sat, 19 Nov 2022 10:57:08 +0100 Subject: [PATCH 10/19] Fix a missing conversion This conversion to cp was overlooked. closes https://github.com/official-stockfish/Stockfish/pull/4235 No functional change --- src/evaluate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index d18c2c93..87412b81 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -159,7 +159,7 @@ namespace Trace { Score scores[TERM_NB][COLOR_NB]; - double to_cp(Value v) { return double(v) / PawnValueEg; } + double to_cp(Value v) { return double(v) / UCI::NormalizeToPawnValue; } void add(int idx, Color c, Score s) { scores[idx][c] = s; From 341163116233682bf150d20cddedcb23e6d09431 Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Sat, 19 Nov 2022 13:03:14 +0100 Subject: [PATCH 11/19] Update WDL model for current SF This updates the WDL model based on the LTC statistics (2M games). Relatively small change, note that this also adjusts the NormalizeToPawnValue (now 361), to keep win prob at 50% for 100cp. closes https://github.com/official-stockfish/Stockfish/pull/4236 No functional change. --- src/uci.cpp | 4 ++-- src/uci.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uci.cpp b/src/uci.cpp index 19e2b0cb..5d842d25 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -207,8 +207,8 @@ namespace { // The coefficients of a third-order polynomial fit is based on the fishtest data // for two parameters that need to transform eval to the argument of a logistic // function. - constexpr double as[] = { 1.04790516, -8.58534089, 39.42615625, 316.17524816}; - constexpr double bs[] = { -3.57324784, 22.28816201, -35.47480551, 85.60617701 }; + constexpr double as[] = { -0.58270499, 2.68512549, 15.24638015, 344.49745382}; + constexpr double bs[] = { -2.65734562, 15.96509799, -20.69040836, 73.61029937 }; // Enforce that NormalizeToPawnValue corresponds to a 50% win rate at ply 64 static_assert(UCI::NormalizeToPawnValue == int(as[0] + as[1] + as[2] + as[3])); diff --git a/src/uci.h b/src/uci.h index f5f2c385..7a2ef255 100644 --- a/src/uci.h +++ b/src/uci.h @@ -35,7 +35,7 @@ namespace UCI { // the win_rate_model() such that Stockfish outputs an advantage of // "100 centipawns" for a position if the engine has a 50% probability to win // from this position in selfplay at fishtest LTC time control. -const int NormalizeToPawnValue = 348; +const int NormalizeToPawnValue = 361; class Option; From d8f3209fb4053bec406645e6df0f8a4d71f5a749 Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Sat, 19 Nov 2022 10:18:04 +0100 Subject: [PATCH 12/19] Update Top CPU Contributors list as of 2022-11-19. Thanks! closes https://github.com/official-stockfish/Stockfish/pull/4234 No functional change --- Top CPU Contributors.txt | 225 +++++++++++++++++++++------------------ 1 file changed, 120 insertions(+), 105 deletions(-) diff --git a/Top CPU Contributors.txt b/Top CPU Contributors.txt index 23a5d7f9..30c963d7 100644 --- a/Top CPU Contributors.txt +++ b/Top CPU Contributors.txt @@ -1,245 +1,260 @@ -Contributors to Fishtest with >10,000 CPU hours, as of 2022-07-31. +Contributors to Fishtest with >10,000 CPU hours, as of 2022-11-19. Thank you! Username CPU Hours Games played ------------------------------------------------------------------ -noobpwnftw 33202707 2423743815 -technologov 5064327 270208248 -mlang 2963357 198937430 -dew 1677196 99717674 -grandphish2 1231326 74551309 -okrout 1102747 98977462 -TueRens 925904 57404676 -pemo 911980 35581261 -tvijlbrief 795993 51894442 -JojoM 774270 47311084 +noobpwnftw 36475307 2748033975 +technologov 14570711 760073590 +mlang 3026000 200065824 +dew 1689222 100034318 +grandphish2 1442171 86798057 +okrout 1439985 133471766 +pemo 1405374 44189811 +linrock 1299003 28382783 +TueRens 1163420 71159522 +JojoM 897158 55177114 +tvijlbrief 796125 51897690 mibere 703840 46867607 -linrock 697283 18804969 -gvreuls 564284 36392236 -cw 515739 34775505 -fastgm 500949 30101898 -oz 439015 31794460 -CSU_Dynasty 438017 29369136 +gvreuls 635982 40652394 +oz 590763 41201352 +sebastronomy 581517 23307132 +cw 517915 34865769 +fastgm 504266 30264740 +CSU_Dynasty 479901 31846710 +ctoks 433503 28180725 crunchy 427035 27344275 -ctoks 422671 27812261 -bcross 363335 25108521 -leszek 360149 22674005 -velislav 333325 21444360 +leszek 416883 27493447 +bcross 409982 28062127 +velislav 345954 22232274 Fisherman 327231 21829379 -Dantist 292327 17951982 -mgrabiak 247220 16137378 -nordlandia 226543 14601042 -robal 224740 14314972 -glinscott 217799 13780820 -ncfish1 207751 13909639 -drabel 203884 13922680 -mhoram 200022 12533963 +Dantist 296386 18031762 +mgrabiak 288928 18869896 +rpngn 259965 16281463 +robal 237653 15148350 +ncfish1 231764 15275003 +nordlandia 226923 14624832 +glinscott 208125 13277240 +drabel 204167 13930674 +mhoram 202894 12601997 bking_US 198894 11876016 -rpngn 191764 12236583 +thirdlife 198844 5453268 Thanar 179852 12365359 vdv 175544 9904472 +armo9494 168201 11136452 spams 157128 10319326 -marrco 150300 9402229 +marrco 151599 9551115 sqrt2 147963 9724586 -vdbergh 137480 8958795 +vdbergh 137690 8971569 CoffeeOne 137100 5024116 malala 136182 8002293 +DesolatedDodo 135276 8657464 xoto 133759 9159372 -davar 128645 8367253 -DesolatedDodo 124877 8056482 +davar 129023 8376525 dsmith 122059 7570238 amicic 119661 7938029 Data 113305 8220352 BrunoBanani 112960 7436849 -CypressChess 108321 7759588 +CypressChess 108331 7759788 +skiminki 106518 7062598 MaZePallas 102823 6633619 -skiminki 102168 6778440 sterni1971 100532 5880772 sunu 100167 7040199 +zeryl 99331 6221261 ElbertoOne 99028 7023771 -zeryl 96984 6162287 +DMBK 97572 6950312 +Calis007 96779 5611552 +cuistot 93111 5536500 brabos 92118 6186135 -cuistot 91738 5447070 +Wolfgang 91769 5720158 psk 89957 5984901 -racerschmacer 85712 6119648 +racerschmacer 85805 6122790 +jcAEie 85527 5630616 Vizvezdenec 83761 5344740 -sschnee 83003 4840890 +sschnee 83557 4853690 0x3C33 82614 5271253 -armo9494 82501 5806056 BRAVONE 81239 5054681 +Dubslow 78461 5042980 nssy 76497 5259388 -thirdlife 76478 1544524 -Calis007 76457 4281018 -jromang 75885 5230523 +jromang 76106 5236025 teddybaer 75125 5407666 +yurikvelo 73933 5031096 +tolkki963 73885 4721430 Pking_cda 73776 5293873 -Wolfgang 72750 4538670 -sebastronomy 70784 1329428 +Bobo1239 71675 4860987 solarlight 70517 5028306 dv8silencer 70287 3883992 -Bobo1239 68515 4652287 -yurikvelo 67651 4578970 +Gelma 69304 3980932 manap 66273 4121774 +megaman7de 65419 4120200 +markkulix 65331 4114860 +bigpen0r 64932 4683883 tinker 64333 4268790 qurashee 61208 3429862 +AGI 58325 4258646 robnjr 57262 4053117 -megaman7de 57023 3525850 Freja 56938 3733019 -MaxKlaxxMiner 56279 3410158 +MaxKlaxxMiner 56879 3423958 ttruscott 56010 3680085 rkl 55132 4164467 renouve 53811 3501516 -tolkki963 53294 3354682 -DMBK 52963 3933332 +Spprtr 52736 3410019 finfish 51360 3370515 eva42 51272 3599691 -Spprtr 51139 3299983 -eastorwest 51058 3451555 +eastorwest 51117 3454811 rap 49985 3219146 +unixwizard 49734 2536230 pb00067 49727 3298270 -bigpen0r 47667 3336927 ronaldjerum 47654 3240695 biffhero 46564 3111352 +GPUex 45861 2926502 Fifis 45843 3088497 +oryx 45578 3493978 VoyagerOne 45476 3452465 +Wencey 44943 2654490 speedycpu 43842 3003273 jbwiebe 43305 2805433 Antihistamine 41788 2761312 mhunt 41735 2691355 +olafm 41277 3284344 homyur 39893 2850481 gri 39871 2515779 -oryx 39602 3024830 +MarcusTullius 38303 2251097 +Garf 37741 2999686 +kdave 37424 2557406 SC 37299 2731694 -Garf 37213 2986270 -Dubslow 36714 2409254 csnodgrass 36207 2688994 jmdana 36157 2210661 -markkulix 35994 2226860 strelock 34716 2074055 EthanOConnor 33370 2090311 slakovv 32915 2021889 -gopeto 31078 2033362 +gopeto 31669 2060958 manapbk 30987 1810399 Prcuvu 30377 2170122 anst 30301 2190091 jkiiski 30136 1904470 +spcc 30135 1903728 hyperbolic.tom 29840 2017394 +xwziegtm 29763 2347412 chuckstablers 29659 2093438 Pyafue 29650 1902349 -MarcusTullius 28611 1646671 -spcc 28241 1821198 -belzedar94 27935 1789106 +belzedar94 28846 1811530 OuaisBla 27636 1578800 chriswk 26902 1868317 achambord 26582 1767323 Patrick_G 26276 1801617 yorkman 26193 1992080 +Ulysses 25289 1674274 SFTUser 25182 1675689 nabildanial 24942 1519409 Sharaf_DG 24765 1786697 -rodneyc 24375 1416258 -Ulysses 24017 1626140 +rodneyc 24376 1416402 agg177 23890 1395014 +Ente 23747 1674582 +Karpovbot 23629 1313186 JanErik 23408 1703875 -Ente 23403 1660988 -kdave 23392 1630462 Isidor 23388 1680691 -Norabor 23339 1602636 -cisco2015 22897 1762669 -Wencey 22573 1121406 +Norabor 23371 1603244 +cisco2015 22934 1763773 Zirie 22542 1472937 team-oh 22272 1636708 +Roady 22220 1465606 MazeOfGalious 21978 1629593 -sg4032 21947 1643265 +sg4032 21947 1643353 ianh2105 21725 1632562 xor12 21628 1680365 dex 21612 1467203 nesoneg 21494 1463031 -Roady 21323 1433822 +user213718 21454 1404128 +AndreasKrug 21227 1577833 sphinx 21211 1384728 -user213718 21196 1397710 jjoshua2 21001 1423089 horst.prack 20878 1465656 +jsys14 20729 1221010 0xB00B1ES 20590 1208666 j3corre 20405 941444 Adrian.Schmidt123 20316 1281436 -jcAEie 20221 1504162 +bonsi 20022 1300682 wei 19973 1745989 +dapper 19754 1167758 +Zake9298 19745 1458416 +fishtester 19617 1257388 rstoesser 19569 1293588 eudhan 19274 1283717 -fishtester 19145 1242668 vulcan 18871 1729392 +Jopo12321 18803 1036284 jundery 18445 1115855 -iisiraider 18247 1101015 ville 17883 1384026 +5t0ckf15hTr4in3r 17809 1105858 chris 17698 1487385 +dju 17697 994333 purplefishies 17595 1092533 -dju 17353 978595 -AndreasKrug 17191 1317997 +iisiraider 17275 1049015 DragonLord 17014 1162790 -Jopo12321 16966 944924 -GPUex 16744 1077826 -xwziegtm 16608 1276372 +Karby 16457 1010138 +Goatminola 16278 1145026 IgorLeMasson 16064 1147232 +Gaster319 16056 1109070 +redstone59 15953 1161664 +scuzzi 15757 968735 ako027ako 15671 1173203 -jsys14 15474 917092 Nikolay.IT 15154 1068349 Andrew Grant 15114 895539 -scuzzi 15112 960373 +Naven94 15054 834762 OssumOpossum 14857 1007129 -Karby 14808 867120 +qoo_charly_cai 14490 847865 enedene 14476 905279 -bpfliegel 14298 884523 +szupaw 14252 929130 +bpfliegel 14233 882523 mpx86 14019 759568 jpulman 13982 870599 -Naven94 13879 811552 -Karpovbot 13808 734276 crocogoat 13803 1117422 -joster 13794 950160 Nesa92 13786 1114691 +joster 13710 946160 mbeier 13650 1044928 Hjax 13535 915487 Dark_wizzie 13422 1007152 Rudolphous 13244 883140 Machariel 13010 863104 +infinigon 12991 943216 +pirt 12925 985437 +Skiff84 12923 649994 mabichito 12903 749391 thijsk 12886 722107 AdrianSA 12860 804972 -infinigon 12807 937332 Flopzee 12698 894821 -pirt 12551 965597 fatmurphy 12547 853210 +woutboat 12419 836696 SapphireBrand 12416 969604 +Oakwen 12406 840961 +deflectooor 12386 579392 modolief 12386 896470 Farseer 12249 694108 pgontarz 12151 848794 stocky 11954 699440 mschmidt 11941 803401 -Oakwen 11925 818865 -MooTheCow 11851 772628 -deflectooor 11642 565132 -dbernier 11609 818636 -Skiff84 11604 602786 +MooTheCow 11871 773654 +Jackfish 11867 773550 +dbernier 11705 821780 +whelanh 11557 245188 Maxim 11543 836024 +Nullvalue 11534 731410 +icewulf 11528 650470 +FormazChar 11523 861599 infinity 11470 727027 -FormazChar 11430 856559 -aga 11409 695071 -Jackfish 11403 750526 +aga 11412 695127 torbjo 11395 729145 Thomas A. Anderson 11372 732094 savage84 11358 670860 +ali-al-zhrani 11272 781310 d64 11263 789184 -qoo_charly_cai 11127 671959 +Bourbaki 11108 709144 snicolet 11106 869170 -ali-al-zhrani 11098 768494 -whelanh 11067 235676 +Alb11747 10855 696920 basepi 10637 744851 Cubox 10621 826448 -Alb11747 10558 689794 +Karmatron 10616 674818 michaelrpg 10509 739239 OIVAS7572 10420 995586 -Garruk 10343 704723 +Garruk 10348 704905 dzjp 10343 732529 ols 10259 570669 -lbraesch 10252 647825 -Karmatron 10195 661432 From 85ae65db1dd315ea500f30226781c4c471d30c5d Mon Sep 17 00:00:00 2001 From: VoyagerOne Date: Tue, 22 Nov 2022 20:07:33 +0300 Subject: [PATCH 13/19] Skip full depth search in LMR depending on depth dynamically adjust newDepth, and skip full depth search if newDepth doesn't exceed the previous search depth. This affects the used newDepth for future searches, and influences the stat bonus for the move. Passed STC: https://tests.stockfishchess.org/tests/view/63795500aa34433735bc1cfe LLR: 2.95 (-2.94,2.94) <0.00,2.00> Total: 112776 W: 30082 L: 29663 D: 53031 Ptnml(0-2): 352, 12453, 30423, 12744, 416 Passed LTC: https://tests.stockfishchess.org/tests/view/6379ea39aa34433735bc2f9b LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 83576 W: 22559 L: 22169 D: 38848 Ptnml(0-2): 38, 8011, 25303, 8395, 41 closes https://github.com/official-stockfish/Stockfish/pull/4240 Bench: 4390318 --- src/search.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/search.cpp b/src/search.cpp index fa87f1c3..5cef5c40 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1188,7 +1188,11 @@ moves_loop: // When in check, search starts here // was good enough search deeper, if it was bad enough search shallower const bool doDeeperSearch = value > (alpha + 64 + 11 * (newDepth - d)); const bool doShallowerSearch = value < bestValue + newDepth; - value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch - doShallowerSearch, !cutNode); + + newDepth += doDeeperSearch - doShallowerSearch; + + if (newDepth > d) + value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode); int bonus = value > alpha ? stat_bonus(newDepth) : -stat_bonus(newDepth); From 1370127fcd72b5c6646ff03a4a779b81ad0bcf3d Mon Sep 17 00:00:00 2001 From: peregrineshahin Date: Sun, 13 Nov 2022 11:08:17 +0200 Subject: [PATCH 14/19] Simplify both quiet check evasions' conditions passed Non-regression STC: https://tests.stockfishchess.org/tests/view/6370b647f1b748d4819e0b64 LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 162904 W: 43249 L: 43171 D: 76484 Ptnml(0-2): 491, 17089, 46220, 17155, 497 closes https://github.com/official-stockfish/Stockfish/pull/4228 No functional change --- src/search.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 5cef5c40..e73f68ff 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1552,12 +1552,11 @@ moves_loop: // When in check, search starts here && (*contHist[1])[pos.moved_piece(move)][to_sq(move)] < 0) continue; - // movecount pruning for quiet check evasions + // We prune after 2nd quiet check evasion where being 'in check' is implicitly checked through the counter + // and being a 'quiet' apart from being a tt move is assumed after an increment because captures are pushed ahead. if ( bestValue > VALUE_TB_LOSS_IN_MAX_PLY - && quietCheckEvasions > 1 - && !capture - && ss->inCheck) - continue; + && quietCheckEvasions > 1) + break; quietCheckEvasions += !capture && ss->inCheck; From f5a31b7e576e2e56825fcfdff75c739ed545e852 Mon Sep 17 00:00:00 2001 From: Guenther Demetz Date: Tue, 22 Nov 2022 11:07:18 +0100 Subject: [PATCH 15/19] Correctly output lowerbound/upperbound in threaded searches fixes the lowerbound/upperbound output by taking the alpha,beta bracket into account also if a bestThread is selected that is different from the master thread. Instead of keeping track which bounds where used in the specific search, in this version we simply store the quality (exact, upperbound, lowerbound) of the score along with the actual score as information on rootMove. closes https://github.com/official-stockfish/Stockfish/pull/4239 No functional change --- src/search.cpp | 14 ++++++++------ src/search.h | 2 ++ src/uci.h | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index e73f68ff..b3f60f3d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -244,7 +244,7 @@ void MainThread::search() { // Send again PV info if we have a new best thread if (bestThread != this) - sync_cout << UCI::pv(bestThread->rootPos, bestThread->completedDepth, -VALUE_INFINITE, VALUE_INFINITE) << sync_endl; + sync_cout << UCI::pv(bestThread->rootPos, bestThread->completedDepth) << sync_endl; sync_cout << "bestmove " << UCI::move(bestThread->rootMoves[0].pv[0], rootPos.is_chess960()); @@ -392,7 +392,7 @@ void Thread::search() { && multiPV == 1 && (bestValue <= alpha || bestValue >= beta) && Time.elapsed() > 3000) - sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl; + sync_cout << UCI::pv(rootPos, rootDepth) << sync_endl; // In case of failing low/high increase aspiration window and // re-search, otherwise exit the loop. @@ -423,7 +423,7 @@ void Thread::search() { if ( mainThread && (Threads.stop || pvIdx + 1 == multiPV || Time.elapsed() > 3000)) - sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl; + sync_cout << UCI::pv(rootPos, rootDepth) << sync_endl; } if (!Threads.stop) @@ -1246,6 +1246,8 @@ moves_loop: // When in check, search starts here { rm.score = value; rm.selDepth = thisThread->selDepth; + rm.scoreLowerbound = value >= beta; + rm.scoreUpperbound = value <= alpha; rm.pv.resize(1); assert((ss+1)->pv); @@ -1820,7 +1822,7 @@ void MainThread::check_time() { /// UCI::pv() formats PV information according to the UCI protocol. UCI requires /// that all (if any) unsearched PV lines are sent using a previous search score. -string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { +string UCI::pv(const Position& pos, Depth depth) { std::stringstream ss; TimePoint elapsed = Time.elapsed() + 1; @@ -1858,8 +1860,8 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { if (Options["UCI_ShowWDL"]) ss << UCI::wdl(v, pos.game_ply()); - if (!tb && i == pvIdx) - ss << (v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : ""); + if (i == pvIdx && !tb && updated) // tablebase- and previous-scores are exact + ss << (rootMoves[i].scoreLowerbound ? " lowerbound" : (rootMoves[i].scoreUpperbound ? " upperbound" : "")); ss << " nodes " << nodesSearched << " nps " << nodesSearched * 1000 / elapsed diff --git a/src/search.h b/src/search.h index f264bcae..60f2762a 100644 --- a/src/search.h +++ b/src/search.h @@ -71,6 +71,8 @@ struct RootMove { Value score = -VALUE_INFINITE; Value previousScore = -VALUE_INFINITE; Value averageScore = -VALUE_INFINITE; + bool scoreLowerbound = false; + bool scoreUpperbound = false; int selDepth = 0; int tbRank = 0; Value tbScore; diff --git a/src/uci.h b/src/uci.h index 7a2ef255..3b5a6764 100644 --- a/src/uci.h +++ b/src/uci.h @@ -79,7 +79,7 @@ void loop(int argc, char* argv[]); std::string value(Value v); std::string square(Square s); std::string move(Move m, bool chess960); -std::string pv(const Position& pos, Depth depth, Value alpha, Value beta); +std::string pv(const Position& pos, Depth depth); std::string wdl(Value v, int ply); Move to_move(const Position& pos, std::string& str); From 6a6faac04db26daae6a77b6df6529e22d549531b Mon Sep 17 00:00:00 2001 From: VoyagerOne Date: Sun, 27 Nov 2022 12:00:16 -0500 Subject: [PATCH 16/19] Remove PvNode Parameter for cutoff LMR STC: LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 198520 W: 52673 L: 52632 D: 93215 Ptnml(0-2): 645, 22241, 53499, 22178, 697 https://tests.stockfishchess.org/tests/view/63746e8f9849fa7a36a6698f LTC: LLR: 2.97 (-2.94,2.94) <-1.75,0.25> Total: 253568 W: 67487 L: 67501 D: 118580 Ptnml(0-2): 109, 25222, 76141, 25198, 114 https://tests.stockfishchess.org/tests/view/63839859d2b9c924c4c4feb7 closes https://github.com/official-stockfish/Stockfish/pull/4248 Bench: 3733322 --- src/search.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index b3f60f3d..abb51190 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1156,13 +1156,13 @@ moves_loop: // When in check, search starts here if (singularQuietLMR) r--; - // Dicrease reduction if we move a threatened piece (~1 Elo) + // Decrease reduction if we move a threatened piece (~1 Elo) if ( depth > 9 && (mp.threatenedPieces & from_sq(move))) r--; // Increase reduction if next ply has a lot of fail high - if ((ss+1)->cutoffCnt > 3 && !PvNode) + if ((ss+1)->cutoffCnt > 3) r++; ss->statScore = 2 * thisThread->mainHistory[us][from_to(move)] From c7118fb46dc71d87d3f2c925b24e67184693da4f Mon Sep 17 00:00:00 2001 From: VoyagerOne Date: Thu, 1 Dec 2022 16:31:35 -0500 Subject: [PATCH 17/19] Simply do full sort on captures. STC: LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 42712 W: 11413 L: 11203 D: 20096 Ptnml(0-2): 145, 4661, 11544, 4851, 155 https://tests.stockfishchess.org/tests/view/6384df57d2b9c924c4c53900 LTC: LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 239072 W: 64065 L: 64067 D: 110940 Ptnml(0-2): 106, 23735, 71859, 23727, 109 https://tests.stockfishchess.org/tests/view/63851120d2b9c924c4c541ee closes https://github.com/official-stockfish/Stockfish/pull/4249 Bench: 3467381 --- src/movepick.cpp | 6 +++--- src/movepick.h | 2 +- src/search.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/movepick.cpp b/src/movepick.cpp index 587c6d79..188d6bd8 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -88,8 +88,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist /// MovePicker constructor for ProbCut: we generate captures with SEE greater /// than or equal to the given threshold. -MovePicker::MovePicker(const Position& p, Move ttm, Value th, Depth d, const CapturePieceToHistory* cph) - : pos(p), captureHistory(cph), ttMove(ttm), threshold(th), depth(d) +MovePicker::MovePicker(const Position& p, Move ttm, Value th, const CapturePieceToHistory* cph) + : pos(p), captureHistory(cph), ttMove(ttm), threshold(th) { assert(!pos.checkers()); @@ -191,7 +191,7 @@ top: endMoves = generate(pos, cur); score(); - partial_insertion_sort(cur, endMoves, -3000 * depth); + partial_insertion_sort(cur, endMoves, std::numeric_limits::min()); ++stage; goto top; diff --git a/src/movepick.h b/src/movepick.h index 55fcc644..e4c4a5bf 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -128,7 +128,7 @@ public: const CapturePieceToHistory*, const PieceToHistory**, Square); - MovePicker(const Position&, Move, Value, Depth, const CapturePieceToHistory*); + MovePicker(const Position&, Move, Value, const CapturePieceToHistory*); Move next_move(bool skipQuiets = false); Bitboard threatenedPieces; diff --git a/src/search.cpp b/src/search.cpp index abb51190..c8163d1f 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -855,7 +855,7 @@ namespace { { assert(probCutBeta < VALUE_INFINITE); - MovePicker mp(pos, ttMove, probCutBeta - ss->staticEval, depth - 3, &captureHistory); + MovePicker mp(pos, ttMove, probCutBeta - ss->staticEval, &captureHistory); while ((move = mp.next_move()) != MOVE_NONE) if (move != excludedMove && pos.legal(move)) From d60f5de9670cc84ba7940b5815bc3e128da9423f Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Mon, 28 Nov 2022 20:59:38 +0100 Subject: [PATCH 18/19] Fix bestThread selection If multiple threads have the same best move, pick the thread with the largest contribution to the confidence vote. This thread will later be used to display PV, so this patch is about user-friendliness and/or least surprises, it non-functional for playing strenght. closes https://github.com/official-stockfish/Stockfish/pull/4246 No functional change --- src/thread.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/thread.cpp b/src/thread.cpp index 9ce408e0..b7471f60 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -221,11 +221,14 @@ Thread* ThreadPool::get_best_thread() const { minScore = std::min(minScore, th->rootMoves[0].score); // Vote according to score and depth, and select the best thread - for (Thread* th : *this) - { - votes[th->rootMoves[0].pv[0]] += - (th->rootMoves[0].score - minScore + 14) * int(th->completedDepth); + auto thread_value = [minScore](Thread* th) { + return (th->rootMoves[0].score - minScore + 14) * int(th->completedDepth); + }; + for (Thread* th : *this) + votes[th->rootMoves[0].pv[0]] += thread_value(th); + + for (Thread* th : *this) if (abs(bestThread->rootMoves[0].score) >= VALUE_TB_WIN_IN_MAX_PLY) { // Make sure we pick the shortest mate / TB conversion or stave off mate the longest @@ -236,9 +239,8 @@ Thread* ThreadPool::get_best_thread() const { || ( th->rootMoves[0].score > VALUE_TB_LOSS_IN_MAX_PLY && ( votes[th->rootMoves[0].pv[0]] > votes[bestThread->rootMoves[0].pv[0]] || ( votes[th->rootMoves[0].pv[0]] == votes[bestThread->rootMoves[0].pv[0]] - && th->rootMoves[0].pv.size() > bestThread->rootMoves[0].pv.size())))) + && thread_value(th) > thread_value(bestThread))))) bestThread = th; - } return bestThread; } From 758f9c9350abee36a5865ec701560db8ea62004d Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Sat, 3 Dec 2022 08:50:46 +0100 Subject: [PATCH 19/19] Stockfish 15.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Official release version of Stockfish 15.1 Bench: 3467381 --- Today, we have the pleasure to announce Stockfish 15.1. As usual, downloads will be freely available at stockfishchess.org/download *Elo gain and competition results* With this release, version 5 of the NNUE neural net architecture has been introduced, and the training data has been extended to include Fischer random chess (FRC) positions. As a result, Elo gains are largest for FRC, reaching up to 50 Elo for doubly randomized FRC[1] (DFRC). More importantly, also for standard chess this release progressed and will win two times more game pairs than it loses[2] against Stockfish 15. Stockfish continues to win in a dominating way[3] all chess engine tournaments, including the TCEC Superfinal, Cup, FRC, DFRC, and Swiss as well as the CCC Bullet, Blitz, and Rapid events. *New evaluation* This release also introduces a new convention for the evaluation that is reported by search. An evaluation of +1 is now no longer tied to the value of one pawn, but to the likelihood of winning the game. With a +1 evaluation, Stockfish has now a 50% chance of winning the game against an equally strong opponent. This convention scales down evaluations a bit compared to Stockfish 15 and allows for consistent evaluations in the future. *ChessBase settlement* In this release period, the Stockfish team has successfully enforced its GPL license against ChessBase. This has been an intense process that included filing a lawsuit[4], a court hearing[5], and finally negotiating a settlement[6] that established that ChessBase infringed on the license by not distributing the Stockfish derivatives Fat Fritz 2 and Houdini 6 as free software, and that ensures ChessBase will respect the Free Software principles in the future. This settlement has been covered by major chess sites (see e.g. lichess.org[7] and chess.com[8]), and we are proud that it has been hailed as a ‘historic violation settlement[9]’ by the Software Freedom Conservancy. *Thank you* The Stockfish project builds on a thriving community of enthusiasts (thanks everybody!) that contribute their expertise, time, and resources to build a free and open-source chess engine that is robust, widely available, and very strong. We invite our chess fans to join the fishtest testing framework and programmers to contribute to the project[10]. The Stockfish team [1] https://tests.stockfishchess.org/tests/view/638a6170d2b9c924c4c62cb4 [2] https://tests.stockfishchess.org/tests/view/638a4dd7d2b9c924c4c6297b [3] https://en.wikipedia.org/wiki/Stockfish_(chess)#Competition_results [4] https://stockfishchess.org/blog/2021/our-lawsuit-against-chessbase/ [5] https://stockfishchess.org/blog/2022/public-court-hearing-soon/ [6] https://stockfishchess.org/blog/2022/chessbase-stockfish-agreement/ [7] https://lichess.org/blog/Y3u1mRAAACIApBVn/settlement-reached-in-stockfish-v-chessbase [8] https://www.chess.com/news/view/chessbase-stockfish-reach-settlement [9] https://sfconservancy.org/news/2022/nov/28/sfc-named-trusted-party-in-gpl-case/ [10] https://stockfishchess.org/get-involved/ --- src/misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc.cpp b/src/misc.cpp index c7fa0e9a..2d86969f 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -68,7 +68,7 @@ namespace Stockfish { namespace { /// Version number or dev. -const string version = "dev"; +const string version = "15.1"; /// Our fancy logging facility. The trick here is to replace cin.rdbuf() and /// cout.rdbuf() with two Tie objects that tie cin and cout to a file stream. We