]> git.sesse.net Git - stockfish/log
stockfish
7 months agoCleanup code after dropping ICC support in favor of ICX
Sebastian Buchwald [Thu, 31 Aug 2023 19:56:34 +0000 (21:56 +0200)]
Cleanup code after dropping ICC support in favor of ICX

The commit removes all uses of ICC's __INTEL_COMPILER macro and other
references to ICC. It also adds ICX info to the compiler command and
fixes two typos in Makefile's help output.

closes https://github.com/official-stockfish/Stockfish/pull/4769

No functional change

7 months agoUpdate default net to nn-1ee1aba5ed4c.nnue
Linmiao Xu [Sat, 9 Sep 2023 14:24:57 +0000 (10:24 -0400)]
Update default net to nn-1ee1aba5ed4c.nnue

Created by retraining the master net on a dataset composed by:
- adding Leela data from T60 jul-dec 2020, T77 nov 2021, T80 jun-jul 2023
- deduplicating and unminimizing parts of the dataset before interleaving

Trained initially with max epoch 800, then increased near the end of training
twice. First to 960, then 1200. After training, post-processing involved:
- greedy permuting L1 weights with https://github.com/official-stockfish/Stockfish/pull/4620
- greedy 2- and 3- cycle permuting with https://github.com/official-stockfish/Stockfish/pull/4640

  python3 easy_train.py \
    --experiment-name 2048-retrain-S6-sk28 \
    --training-dataset /data/S6.binpack \
    --early-fen-skipping 28 \
    --start-from-engine-test-net True \
    --max_epoch 1200 \
    --lr 4.375e-4 \
    --gamma 0.995 \
    --start-lambda 1.0 \
    --end-lambda 0.7 \
    --tui False \
    --seed $RANDOM \
    --gpus 0

In the list of datasets below, periods in the filename represent the sequence of
steps applied to arrive at the particular binpack. For example:

test77-dec2021-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
1. test77 dec2021 data rescored with 16 TB of syzygy tablebases during data conversion
2. filtered with csv_filter_v6_dd.py - v6 filtering and deduplication in one step
3. minimized with the original mar2023 implementation of `minimize_binpack` in
   the tools branch
4. unminimized by removing all positions with score == 32002 (`VALUE_NONE`)

Binpacks were:
- filtered with: https://github.com/linrock/nnue-data
- unminimized with: https://github.com/linrock/Stockfish/tree/tools-unminify
- deduplicated with: https://github.com/linrock/Stockfish/tree/tools-dd

  DATASETS=(
    leela96-filt-v2.min.unminimized.binpack
    dfrc99-16tb7p-eval-filt-v2.min.unminimized.binpack

    # most of the 0dd1cebea57 v6-dd dataset (without test80-jul2022)
    # https://github.com/official-stockfish/Stockfish/pull/4606
    test60-novdec2021-12tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
    test77-dec2021-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
    test78-jantomay2022-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
    test78-juntosep2022-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
    test79-apr2022-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
    test79-may2022-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
    test80-jun2022-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
    test80-aug2022-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
    test80-sep2022-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
    test80-oct2022-16tb7p.filter-v6-dd.min.binpack
    test80-nov2022-16tb7p.filter-v6-dd.min.binpack
    test80-jan2023-3of3-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack
    test80-feb2023-16tb7p.filter-v6-dd.min-mar2023.unminimized.binpack

    # older Leela data, recently converted
    test60-octnovdec2020-2tb7p.min.unminimized.binpack
    test60-julaugsep2020-2tb7p.min.binpack
    test77-nov2021-2tb7p.min.dd.binpack

    # newer Leela data
    test80-mar2023-2tb7p.min.unminimized.binpack
    test80-apr2023-2tb7p.filter-v6-sk16.min.unminimized.binpack
    test80-may2023-2tb7p.min.dd.binpack
    test80-jun2023-2tb7p.min.binpack
    test80-jul2023-2tb7p.binpack
  )
  python3 interleave_binpacks.py ${DATASETS[@]} /data/S6.binpack

Training data can be found at:
https://robotmoon.com/nnue-training-data/

Local elo at 25k nodes per move:
nn-epoch1059 : 2.7 +/- 1.6

Passed STC:
https://tests.stockfishchess.org/tests/view/64fc8d705dab775b5359db42
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 168352 W: 43216 L: 42704 D: 82432
Ptnml(0-2): 599, 19672, 43134, 20160, 611

Passed LTC:
https://tests.stockfishchess.org/tests/view/64fd44a75dab775b5359f065
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 154194 W: 39436 L: 38881 D: 75877
Ptnml(0-2): 78, 16577, 43238, 17120, 84

closes https://github.com/official-stockfish/Stockfish/pull/4782

Bench: 1603079

7 months agoDo more futility pruning in qsearch
Michael Chaly [Mon, 11 Sep 2023 12:37:18 +0000 (15:37 +0300)]
Do more futility pruning in qsearch

This patch introduces a third futility pruning heuristic in qsearch. The idea is
that the static exchange evaluation is much worse than the difference between
futility base and alpha. Thus we can assume that the probability of the move
being good enough to beat alpha is low so it can be pruned.

Passed STC:
https://tests.stockfishchess.org/tests/view/64fc982a5dab775b5359dc83
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 36576 W: 9484 L: 9170 D: 17922
Ptnml(0-2): 121, 4119, 9495, 4431, 122

Passed LTC:
https://tests.stockfishchess.org/tests/view/64fcc7935dab775b5359e1a9
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 135408 W: 34556 L: 34041 D: 66811
Ptnml(0-2): 56, 14462, 38165, 14953, 68

closes https://github.com/official-stockfish/Stockfish/pull/4781

Bench: 1330793

7 months agoSimplify cutnode depth condition
cj5716 [Sun, 10 Sep 2023 00:49:18 +0000 (08:49 +0800)]
Simplify cutnode depth condition

With this patch, the depth condition for the cutnodes reduction is loosened from
tte->depth() >= depth + 3 to just tte->depth() >= depth.

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 101152 W: 25830 L: 25682 D: 49640
Ptnml(0-2): 312, 11788, 26258, 11876, 342
https://tests.stockfishchess.org/tests/view/64fd15635dab775b5359eaa6

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 82542 W: 20980 L: 20824 D: 40738
Ptnml(0-2): 42, 8795, 23440, 8953, 41
https://tests.stockfishchess.org/tests/view/64fda3545dab775b5359fbf1

closes https://github.com/official-stockfish/Stockfish/pull/4780

Bench: 1479029

7 months agoCleanup git checkout actions
Sebastian Buchwald [Sun, 10 Sep 2023 10:15:06 +0000 (12:15 +0200)]
Cleanup git checkout actions

We now fetch only the current commit for jobs that don't need the git
history. For the Prerelease job, we don't checkout the code at all.

closes https://github.com/official-stockfish/Stockfish/pull/4779

No functional change

7 months agoPrevent usage of AVX-512 for the last layer.
Tomasz Sobczyk [Mon, 4 Sep 2023 11:53:30 +0000 (13:53 +0200)]
Prevent usage of AVX-512 for the last layer.

Add more static checks regarding the SIMD width match.

STC: https://tests.stockfishchess.org/tests/view/64f5c568a9bc5a78c669e70e
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 125216 W: 31756 L: 31636 D: 61824
Ptnml(0-2): 327, 13993, 33848, 14113, 327

Fixes a bug introduced in 2f2f45f, where with AVX-512 the weights and input to
the last layer were being read out of bounds. Now AVX-512 is only used for the
layers it can be used for. Additional static assertions have been added to
prevent more errors like this in the future.

closes https://github.com/official-stockfish/Stockfish/pull/4773

No functional change

7 months agoAvoid "using namespace std"
Sebastian Buchwald [Mon, 4 Sep 2023 20:01:20 +0000 (22:01 +0200)]
Avoid "using namespace std"

This is a cleanup PR that prepares the automatic checking of missing or
superfluous #include directives via the include-what-you-use (IWYU) tool
on the CI. Unfortunately, IWYU proposes additional includes for
"namespace std" although we don't need them.

To avoid the problem, the commit removes all "using namespace std"
statements from the code and directly uses the std:: prefix instead.
Alternatively, we could add specific usings (e.g. "using std::string")
foreach used type. Also, a mix of both approaches would be possible.
I decided for the prefix approach because most of the files were already
using the std:: prefixes despite the "using namespace std".

closes https://github.com/official-stockfish/Stockfish/pull/4772

No functional change

7 months agoIntroduce simple_eval() for lazy evaluations
Stéphane Nicolet [Sat, 2 Sep 2023 06:39:16 +0000 (08:39 +0200)]
Introduce simple_eval() for lazy evaluations

This patch implements the pure materialistic evaluation called simple_eval()
to gain a speed-up during Stockfish search.

We use the so-called lazy evaluation trick: replace the accurate but slow
NNUE network evaluation by the super-fast simple_eval() if the position
seems to be already won (high material advantage). To guard against some
of the most obvious blunders introduced by this idea, this patch uses the
following features which will raise the lazy evaluation threshold in some
situations:

- avoid lazy evals on shuffling branches in the search tree
- avoid lazy evals if the position at root already has a material imbalance
- avoid lazy evals if the search value at root is already winning/losing.

Moreover, we add a small random noise to the simple_eval() term. This idea
(stochastic mobility in the minimax tree) was worth about 200 Elo in the pure
simple_eval() player on Lichess.

Overall, the current implementation in this patch evaluates about 2% of the
leaves in the search tree lazily.

--------------------------------------------

STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 60352 W: 15585 L: 15234 D: 29533
Ptnml(0-2): 216, 6906, 15578, 7263, 213
https://tests.stockfishchess.org/tests/view/64f1d9bcbd9967ffae366209

LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 35106 W: 8990 L: 8678 D: 17438
Ptnml(0-2): 14, 3668, 9887, 3960, 24
https://tests.stockfishchess.org/tests/view/64f25204f5b0c54e3f04c0e7

verification run at VLTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 74362 W: 19088 L: 18716 D: 36558
Ptnml(0-2): 6, 7226, 22348, 7592, 9
https://tests.stockfishchess.org/tests/view/64f2ecdbf5b0c54e3f04d3ae

All three tests above were run with adjudication off, we also verified that
there was no regression on matetracker (thanks Disservin!).

----------------------------------------------

closes https://github.com/official-stockfish/Stockfish/pull/4771

Bench: 1393714

7 months agoRename one variable
FauziAkram [Fri, 25 Aug 2023 12:42:44 +0000 (15:42 +0300)]
Rename one variable

To enhance code clarity and prevent potential confusion with the
'r' variable assigned to reduction later in the code, this pull
request renames it to 'reductionScale' when we use the same name
in the reduction() function.

Using distinct variable names for separate functions improves code
readability and maintainability.

closes https://github.com/official-stockfish/Stockfish/pull/4765

No functional change

7 months agoSimplify slider_blocker calculation
pb00067 [Thu, 17 Aug 2023 12:31:05 +0000 (14:31 +0200)]
Simplify slider_blocker calculation

Now that classical evaluation was removed, we can adapt this method
to the needs of set_check_info.

STC:
2.95 (-2.94,2.94) <-1.75,0.25>
Total: 298176 W: 75802 L: 75868 D: 146506
Ptnml(0-2): 908, 33608, 80192, 33402, 978
https://tests.stockfishchess.org/tests/view/64e70b899009777747557b43

closes https://github.com/official-stockfish/Stockfish/pull/4753

no functional change

7 months agoSimplify README
Disservin [Sat, 26 Aug 2023 07:49:04 +0000 (09:49 +0200)]
Simplify README

The UCI protocol is rather technical and has little value in our README. Instead
it should be explained in our wiki. "Contributing" is moved above "Compiling
Stockfish" to make it more prominent.

Also move the CONTRIBUTING.md into the root directory and include it in the
distributed artifacts/releases.

closes https://github.com/official-stockfish/Stockfish/pull/4766

No functional change

7 months agoCleanup includes
Disservin [Wed, 23 Aug 2023 17:36:55 +0000 (19:36 +0200)]
Cleanup includes

Reorder a few includes, include "position.h" where it was previously missing
and apply include-what-you-use suggestions. Also make the order of the includes
consistent, in the following way:

1. Related header (for .cpp files)
2. A blank line
3. C/C++ headers
4. A blank line
5. All other header files

closes https://github.com/official-stockfish/Stockfish/pull/4763
fixes https://github.com/official-stockfish/Stockfish/issues/4707

No functional change

7 months agoOmit two unneeded tests
ttruscott [Fri, 25 Aug 2023 19:47:52 +0000 (15:47 -0400)]
Omit two unneeded tests

These redundant tests were intended as a speed-up, but they do not seem
to provide any speed anymore.

STC: https://tests.stockfishchess.org/tests/view/64e9079c85e3e95030fd8259
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 134688 W: 34338 L: 34226 D: 66124
Ptnml(0-2): 426, 15122, 36124, 15258, 414

closes https://github.com/official-stockfish/Stockfish/pull/4767

No functional change

8 months agoPlay turbulent when defending, simpler when attacking
Stéphane Nicolet [Wed, 23 Aug 2023 05:50:36 +0000 (07:50 +0200)]
Play turbulent when defending, simpler when attacking

This patch decays a little the evaluation (up to a few percent) for
positions which have a large complexity measure (material imbalance,
positional compensations, etc).

This may have nice consequences on the playing style, as it modifies
the search differently for attack and defense, both effects being
desirable:

- to see the effect on positions when Stockfish is defending, let us
suppose for instance that the side to move is Stockfish and the nnue
evaluation on the principal variation is -100 : this patch will decay
positions with an evaluation of -103 (say) to the same level, provided
they have huge material imbalance or huge positional compensation.
In other words, chaotic positions with an evaluation of -103 are now
comparable in our search tree to stable positions with an evaluation
of -100, and chaotic positions with an evaluation of -102 are now
preferred to stable positions with an evaluation of -100.

- the effect on positions when Stockfish is attacking is the opposite.
Let us suppose for instance that the side to move is Stockfish and the
nnue evaluation on the principal variation is +100 : this patch will
decay the evaluation to +97 if the positions on the principal variation
have huge material imbalance or huge positional compensation. In other
words, stable positions with an evaluation of +97 are now comparable
in our search tree to chaotic positions with an evaluation of +100,
and stable positions with an evaluation of +98 are now preferred to
chaotic positions with an evaluation of +100.

So the effect of this small change of evaluation on the playing style
is that Stockfish should now play a little bit more turbulent when
defending, and choose slightly simpler lines when attacking.

passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 268448 W: 68713 L: 68055 D: 131680
Ptnml(0-2): 856, 31514, 68943, 31938, 973
https://tests.stockfishchess.org/tests/view/64e252bb99700912526653ed

passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 141060 W: 36066 L: 35537 D: 69457
Ptnml(0-2): 71, 15179, 39522, 15666, 92
https://tests.stockfishchess.org/tests/view/64e4447a9009777747553725

closes https://github.com/official-stockfish/Stockfish/pull/4762

Bench: 1426295

8 months agoReduce repetitions branches
Shahin M. Shahin [Sat, 19 Aug 2023 22:15:22 +0000 (01:15 +0300)]
Reduce repetitions branches

Increase reduction on retrying a move we just retreated that falls in a repetition:
if current move can be the same move from previous previous turn then we retreated
that move on the previous turn, this patch increases reduction if retrying that move
results in a repetition.

How to continue from there? Maybe we some variants of this idea could bring Elo too
(only testing the destination square, or triangulations, etc.)

Passed STC:
https://tests.stockfishchess.org/tests/view/64e1aede883cbb7cbd9ad976
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 424000 W: 108675 L: 107809 D: 207516
Ptnml(0-2): 1296, 47350, 113896, 48108, 1350

Passed LTC:
https://tests.stockfishchess.org/tests/view/64e32d629970091252666872
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 89682 W: 22976 L: 22569 D: 44137
Ptnml(0-2): 39, 8843, 26675, 9240, 44

closes https://github.com/official-stockfish/Stockfish/pull/4757

bench: 1574347

8 months agoDo more full window searches
cj5716 [Sat, 12 Aug 2023 06:56:23 +0000 (14:56 +0800)]
Do more full window searches

Remove the value < beta condition for doing full window searches.
As an added bonus the condition for full-window search is now much
more similar to other fail-soft engines.

Passed STC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 244608 W: 62286 L: 62294 D: 120028
Ptnml(0-2): 758, 28772, 63214, 28840, 720
https://tests.stockfishchess.org/tests/view/64d72d365b17f7c21c0e6675

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 311460 W: 78909 L: 78985 D: 153566
Ptnml(0-2): 129, 33959, 87656, 33831, 155
https://tests.stockfishchess.org/tests/view/64dca2265b17f7c21c0ee06c

closes https://github.com/official-stockfish/Stockfish/pull/4755

Bench: 1624221

8 months agoSimplify Square Clipped ReLU code.
Gian-Carlo Pascutto [Mon, 14 Aug 2023 15:30:10 +0000 (17:30 +0200)]
Simplify Square Clipped ReLU code.

Squared numbers are never negative, so barring any wraparound there
is no need to clamp to 0. From reading the code, there's no obvious
way to get wraparound, so the entire operation can be simplified
away. Updated original truncated code comments to be sensible.

Verified by running ./stockfish bench 128 1 24 and by the following test:

STC: https://tests.stockfishchess.org/tests/view/64da4db95b17f7c21c0eabe7
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 60224 W: 15425 L: 15236 D: 29563
Ptnml(0-2): 195, 6576, 16382, 6763, 196

closes https://github.com/official-stockfish/Stockfish/pull/4751

No functional change

8 months agoFix some tabs in Makefile
Stéphane Nicolet [Tue, 22 Aug 2023 08:00:03 +0000 (10:00 +0200)]
Fix some tabs in Makefile

Avoid mixing spaces and tabs for indentation in Makefile

closes https://github.com/official-stockfish/Stockfish/pull/4759

No functional change

8 months agoUpdate links to fishtest
Joost VandeVondele [Mon, 21 Aug 2023 20:45:26 +0000 (22:45 +0200)]
Update links to fishtest

Fishtest has moved to https://github.com/official-stockfish/fishtest/

closes https://github.com/official-stockfish/Stockfish/pull/4758

No functional change

8 months agoAllow compilation on Raspi (for ARMv8)
Matthies [Wed, 16 Aug 2023 09:11:27 +0000 (11:11 +0200)]
Allow compilation on Raspi (for ARMv8)

Current master fails to compile for ARMv8 on Raspi cause gcc (version 10.2.1)
does not like to cast between signed and unsigned vector types. This patch
fixes it by using unsigned vector pointer for ARM to avoid implicite cast.

closes https://github.com/official-stockfish/Stockfish/pull/4752

No functional change

8 months agoFix some 'possible loss of data' warnings
Stéphane Nicolet [Tue, 22 Aug 2023 08:39:03 +0000 (10:39 +0200)]
Fix some 'possible loss of data' warnings

Patch by Maxim Masiutin

closes https://github.com/official-stockfish/Stockfish/pull/4440

No functional change

8 months agoAdd -funroll-loops to CXXFLAGS
Disservin [Mon, 14 Aug 2023 11:49:41 +0000 (13:49 +0200)]
Add -funroll-loops to CXXFLAGS

Optimize profiling data accuracy by enabling -funroll-loops during the profile
generation phase, in addition to its default activation by -fprofile-use.
This seems to produce a slightly faster binary, for most compilers.

make -j profile-build ARCH=x86-64-avx2

sf_base =  1392875 +/-   5905 (95%)
sf_test =  1402332 +/-   7303 (95%)
diff    =     9457 +/-   4413 (95%)
speedup = 0.67896% +/- 0.317% (95%)

STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 34784 W: 8970 L: 8665 D: 17149
Ptnml(0-2): 115, 3730, 9405, 4019, 123
https://tests.stockfishchess.org/tests/view/64d944815b17f7c21c0e92e1

closes https://github.com/official-stockfish/Stockfish/pull/4750

No functional change

8 months agoSimplify PvNode Reduction
Muzhen Gaming [Sun, 13 Aug 2023 14:02:17 +0000 (22:02 +0800)]
Simplify PvNode Reduction

Remove the depth condition for PvNode reduction.

Simplification STC:
https://tests.stockfishchess.org/tests/view/64d308fa5b17f7c21c0e0303
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 38976 W: 10106 L: 9889 D: 18981
Ptnml(0-2): 129, 4479, 10040, 4726, 114

Simplification LTC:
https://tests.stockfishchess.org/tests/view/64d457db5b17f7c21c0e236f
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 156402 W: 39727 L: 39645 D: 77030
Ptnml(0-2): 71, 17143, 43696, 17215, 76

closes https://github.com/official-stockfish/Stockfish/pull/4747

Bench: 1493904

8 months agoFix dead link to compression algorithm in tbprobe
SzilBalazs [Sun, 13 Aug 2023 15:52:08 +0000 (17:52 +0200)]
Fix dead link to compression algorithm in tbprobe

closes https://github.com/official-stockfish/Stockfish/pull/4746

No functional change

8 months agoAdd CONTRIBUTING.md
Disservin [Sun, 13 Aug 2023 15:14:38 +0000 (17:14 +0200)]
Add CONTRIBUTING.md

closes https://github.com/official-stockfish/Stockfish/pull/4741

No functional change

8 months agoSimplify material difference in evaluate
mstembera [Wed, 9 Aug 2023 18:48:33 +0000 (11:48 -0700)]
Simplify material difference in evaluate

STC: https://tests.stockfishchess.org/tests/view/64d166235b17f7c21c0ddc15
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 100032 W: 25698 L: 25547 D: 48787
Ptnml(0-2): 308, 11748, 25771, 11863, 326

LTC: https://tests.stockfishchess.org/tests/view/64d28c085b17f7c21c0df775
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 123870 W: 31463 L: 31348 D: 61059
Ptnml(0-2): 63, 13487, 34719, 13604, 62

Besides rebasing I replaced PawnValueMg w/ 126 explicitly to decouple from https://tests.stockfishchess.org/tests/view/64d212de5b17f7c21c0debbb by @peregrineshahin which also passed. #4734

closes https://github.com/official-stockfish/Stockfish/pull/4731

Bench: 1447866

8 months agoSimplify pieceValue to one phase.
Shahin M. Shahin [Mon, 7 Aug 2023 19:27:12 +0000 (22:27 +0300)]
Simplify pieceValue to one phase.

Simplifies the usage of pieceValues to mg values with the exception of pawnValues, After the removal of PSQT.

passed STC:
https://tests.stockfishchess.org/tests/view/64d147845b17f7c21c0dd86c
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 197248 W: 50168 L: 50125 D: 96955
Ptnml(0-2): 651, 23029, 51222, 23070, 652

passed LTC:
https://tests.stockfishchess.org/tests/view/64d212de5b17f7c21c0debbb
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 181170 W: 45949 L: 45893 D: 89328
Ptnml(0-2): 84, 19656, 51052, 19706, 87

closes https://github.com/official-stockfish/Stockfish/pull/4734

Bench: 1494401

8 months agoSimplify SEE pruning for captures
Stéphane Nicolet [Thu, 10 Aug 2023 04:31:48 +0000 (06:31 +0200)]
Simplify SEE pruning for captures

It seems that the current search is smart enough to allow us to remove
(again) the block of code that checks for discovered attacks after the
first pruning condition for captures.

STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 278848 W: 70856 L: 70903 D: 137089
Ptnml(0-2): 960, 32829, 71894, 32780, 961
https://tests.stockfishchess.org/tests/view/64d0af095b17f7c21c0dc440

LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 100704 W: 25564 L: 25425 D: 49715
Ptnml(0-2): 56, 10858, 28381, 11005, 52
https://tests.stockfishchess.org/tests/view/64d293e85b17f7c21c0df844

closes https://github.com/official-stockfish/Stockfish/pull/4736

Bench: 1470572

8 months agoSimplify prior countermove bonus
FauziAkram [Thu, 10 Aug 2023 15:44:58 +0000 (18:44 +0300)]
Simplify prior countermove bonus

Swapping a multiplication operation between two terms with a simple constant

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 60512 W: 15424 L: 15231 D: 29857
Ptnml(0-2): 200, 6985, 15712, 7140, 219
https://tests.stockfishchess.org/tests/view/64d2addf5b17f7c21c0dfae6

Passed LTC:
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 108456 W: 27545 L: 27414 D: 53497
Ptnml(0-2): 63, 11629, 30698, 11790, 48
https://tests.stockfishchess.org/tests/view/64d3ab6e5b17f7c21c0e1188

closes https://github.com/official-stockfish/Stockfish/pull/4738

Bench: 1636213

8 months agoCheck compiler for docker builds in CI
ppigazzini [Fri, 11 Aug 2023 14:57:26 +0000 (16:57 +0200)]
Check compiler for docker builds in CI

closes https://github.com/official-stockfish/Stockfish/pull/4739

No functional change

8 months agoRemove the unused enum ScaleFactor
Gabrik [Fri, 11 Aug 2023 21:54:48 +0000 (23:54 +0200)]
Remove the unused enum ScaleFactor

closes https://github.com/official-stockfish/Stockfish/pull/4740

No functional change

8 months agoDetect repetitions before they happen in qsearch
Shahin M. Shahin [Thu, 10 Aug 2023 07:19:40 +0000 (10:19 +0300)]
Detect repetitions before they happen in qsearch

Passed STC:
https://tests.stockfishchess.org/tests/view/64d495995b17f7c21c0e29ed
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 340288 W: 86664 L: 85910 D: 167714
Ptnml(0-2): 1030, 38855, 89697, 39455, 1107

Passed LTC:
https://tests.stockfishchess.org/tests/view/64d5e1085b17f7c21c0e4ab5
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 193230 W: 49235 L: 48606 D: 95389
Ptnml(0-2): 98, 20432, 54921, 21071, 93

closes https://github.com/official-stockfish/Stockfish/pull/4742

Bench: 1579576

8 months agoSimplify a depth condition
cj5716 [Tue, 8 Aug 2023 09:06:31 +0000 (17:06 +0800)]
Simplify a depth condition

As the negative extension term has sensitive scaling, it would make more sense to allow more negative extension also at lower depth, and not just a region between low and high depth.

Passed STC:
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 124096 W: 31611 L: 31485 D: 61000
Ptnml(0-2): 422, 14437, 32205, 14561, 423
https://tests.stockfishchess.org/tests/view/64d205d75b17f7c21c0dea82

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 387882 W: 97840 L: 97993 D: 192049
Ptnml(0-2): 198, 42004, 109668, 41895, 176
https://tests.stockfishchess.org/tests/view/64d333f85b17f7c21c0e06c6

closes https://github.com/official-stockfish/Stockfish/pull/4743

Bench: 1542357

8 months agoGive extra bonus to main history for moves that caused a fail low. #4744
Michael Chaly [Sun, 13 Aug 2023 08:03:28 +0000 (11:03 +0300)]
Give extra bonus to main history for moves that caused a fail low. #4744

Current master gives this type of bonuses to continuation history, this patch also gives them to main history.

Passed STC:
https://tests.stockfishchess.org/tests/view/64d4802a5b17f7c21c0e27b3
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 480768 W: 122767 L: 121798 D: 236203
Ptnml(0-2): 1563, 56190, 123834, 57309, 1488

Passed LTC:
https://tests.stockfishchess.org/tests/view/64d7e4c05b17f7c21c0e7456
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 32052 W: 8329 L: 8022 D: 15701
Ptnml(0-2): 19, 3335, 9015, 3634, 23

closes https://github.com/official-stockfish/Stockfish/pull/4744

Bench: 1711793

8 months agoUpdate sanitizer CI to ubuntu 22.04
Joost VandeVondele [Sun, 13 Aug 2023 08:59:35 +0000 (10:59 +0200)]
Update sanitizer CI to ubuntu 22.04

might fix the tsan errors

closes https://github.com/official-stockfish/Stockfish/pull/4745

No functional change

8 months agoImprove testing coverage, remove unused code
Joost VandeVondele [Wed, 9 Aug 2023 13:34:53 +0000 (15:34 +0200)]
Improve testing coverage, remove unused code

a) Add further tests to CI to cover most features. This uncovered a potential race
in case setoption was sent between two searches. As the UCI protocol requires
this sent to be went the engine is not searching, setoption now ensures that
this is the case.

b) Remove some unused code

closes https://github.com/official-stockfish/Stockfish/pull/4730

No functional change

8 months agoFix Makefile for incorrect nnue file
Tomasz Sobczyk [Mon, 7 Aug 2023 11:11:09 +0000 (13:11 +0200)]
Fix Makefile for incorrect nnue file

If an incorrect network file is present at the start of the compilation stage, the
Makefile script now correctly removes it before trying to download a clean version.

closes https://github.com/official-stockfish/Stockfish/pull/4726

No functional change

8 months agoRemove all references to Score type
Cody Ho [Sun, 6 Aug 2023 21:21:22 +0000 (14:21 -0700)]
Remove all references to Score type

Score is obsolete with the removal of psqt.

No functional change.

Signed-off-by: Cody Ho <codyho@stanford.edu>
closes https://github.com/official-stockfish/Stockfish/pull/4724

8 months agoAdjust futility pruning base in qsearch
Michael Chaly [Sun, 6 Aug 2023 23:32:38 +0000 (02:32 +0300)]
Adjust futility pruning base in qsearch

Current master used value from transposition table there if it existed,
this patch uses minimum between this tt value and the static eval instead
(this thus is closer to the main search function, which uses the static eval).

Passed STC:
https://tests.stockfishchess.org/tests/view/64cd57285b17f7c21c0d6a8c
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 252544 W: 64671 L: 64039 D: 123834
Ptnml(0-2): 839, 29207, 65575, 29785, 866

Passed LTC:
https://tests.stockfishchess.org/tests/view/64cf6c915b17f7c21c0d9fcb
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 60150 W: 15374 L: 15012 D: 29764
Ptnml(0-2): 24, 6321, 17024, 6681, 25

closes https://github.com/official-stockfish/Stockfish/pull/4725

Bench: 1573024

8 months agoTweak formula for pruning moves losing material
FauziAkram [Sat, 5 Aug 2023 11:21:08 +0000 (14:21 +0300)]
Tweak formula for pruning moves losing material

Simplify the "Prune moves with negative SEE" formula,
by removing one multiplication and subtraction operation.

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 214272 W: 54596 L: 54572 D: 105104
Ptnml(0-2): 741, 25160, 55320, 25164, 751
https://tests.stockfishchess.org/tests/view/64c430d1dc56e1650abbdbf6

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 238380 W: 60600 L: 60601 D: 117179
Ptnml(0-2): 132, 26069, 66791, 26064, 134
https://tests.stockfishchess.org/tests/view/64c81f155b17f7c21c0cee2b

closes https://github.com/official-stockfish/Stockfish/pull/4721

bench: 1655337

8 months agoRemove classical psqt
Linmiao Xu [Mon, 24 Jul 2023 05:22:21 +0000 (01:22 -0400)]
Remove classical psqt

Based on vondele's deletepsqt branch:
https://github.com/vondele/Stockfish/commit/369f5b051

This huge simplification uses a weighted material differences instead of
the positional piece square tables (psqt) in the semi-classical complexity
calculation. Tuned weights using spsa at 45+0.45 with:

int pawnMult = 100;
int knightMult = 325;
int bishopMult = 350;
int rookMult = 500;
int queenMult = 900;
TUNE(SetRange(0, 200), pawnMult);
TUNE(SetRange(0, 650), knightMult);
TUNE(SetRange(0, 700), bishopMult);
TUNE(SetRange(200, 800), rookMult);
TUNE(SetRange(600, 1200), queenMult);

The values obtained via this tuning session were for a model where
the psqt replacement formula was always from the point of view of White,
even if the side to move was Black. We re-used the same values for an
implementation with a psqt replacement from the point of view of the side
to move, testing the result both on our standard book on positions with
a strong White bias, and an alternate book with positions with a strong
Black bias.

We note that with the patch the last use of the venerable "Score" type
disappears in Stockfish codebase (the Score type was used in classical
evaluation to get a tampered eval interpolating values smoothly from the
early midgame stage to the endgame stage). We leave it to another commit
to clean all occurrences of Score in the code and the comments.

-------

Passed non-regression LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 142542 W: 36264 L: 36168 D: 70110
Ptnml(0-2): 76, 15578, 39856, 15696, 65
https://tests.stockfishchess.org/tests/view/64c8cb495b17f7c21c0cf9f8

Passed non-regression LTC (with a book with Black bias):
https://tests.stockfishchess.org/tests/view/64c8f9295b17f7c21c0cfdaf
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 494814 W: 125565 L: 125827 D: 243422
Ptnml(0-2): 244, 53926, 139346, 53630, 261

------

closes https://github.com/official-stockfish/Stockfish/pull/4713

Bench: 1655985

8 months agoImplement AffineTransformSparseInput for armv8
AndrovT [Tue, 1 Aug 2023 12:43:37 +0000 (14:43 +0200)]
Implement AffineTransformSparseInput for armv8

Implements AffineTransformSparseInput layer for the NNUE evaluation
for the armv8 and armv8-dotprod architectures. We measured some nice
speed improvements via 10 runs of our benchmark:

armv8, Cortex-X1                  :   18.5% speed-up
armv8, Cortex-A76                 :   13.2% speed-up
armv8-dotprod, Cortex-X1          :   27.1% speed-up
armv8-dotprod, Cortex-A76         :   12.1% speed-up
armv8, Cortex-A72, Raspberry Pi 4 :    8.2% speed-up (thanks Torom!)

closes https://github.com/official-stockfish/Stockfish/pull/4719

No functional change

8 months agoAdd new CPU archs in CI Tests workflow
ppigazzini [Mon, 31 Jul 2023 11:41:28 +0000 (13:41 +0200)]
Add new CPU archs in CI Tests workflow

Add CPU archs: armv8-dotprod, riscv64 and ppc64le.
The last two archs are built using QEMU multiarch docker container.

References:
https://docs.docker.com/build/building/multi-platform/
https://github.com/docker/setup-buildx-action
https://github.com/docker/setup-qemu-action
https://github.com/tonistiigi/binfmt
https://stackoverflow.com/questions/72444103/what-does-running-the-multiarch-qemu-user-static-does-before-building-a-containe

closes https://github.com/official-stockfish/Stockfish/pull/4718

No functional change

8 months agoIdentify NEON_DOTPROD in compiler_info()
Niklas Fiekas [Sat, 29 Jul 2023 14:34:58 +0000 (14:34 +0000)]
Identify NEON_DOTPROD in compiler_info()

closes https://github.com/official-stockfish/Stockfish/pull/4712

No functional change

8 months agoMalus during move ordering for putting pieces en prise
rn5f107s2 [Wed, 26 Jul 2023 12:31:16 +0000 (14:31 +0200)]
Malus during move ordering for putting pieces en prise

The original idea is the reverse of a previous patch [1] which added bonuses
in our move picker to moves escaping threats. In this patch, in addition to
bonuses for evading threats, we apply penalties to moves moving to threatened
squares.

Further tweaks of that basic idea resulted in this specific version which
further increases the penalty of moves moving to squares threatend depending
on the piece threatening it. So for example a queen moving to a square attacked
by a pawn would receive a larger penalty than a queen moving to square attacked
by a rook.

[1]: https://github.com/official-stockfish/Stockfish/commit/08e0f52b77edb929989c68c49e954b9bc5d7d67e

--------

Passed STC:
https://tests.stockfishchess.org/tests/live_elo/64c11269dc56e1650abb935d
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 95552 W: 24654 L: 24250 D: 46648
Ptnml(0-2): 322, 11098, 24562, 11442, 352

Passed LTC:
https://tests.stockfishchess.org/tests/live_elo/64c2004ddc56e1650abba8b3
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 190230 W: 48806 L: 48178 D: 93246
Ptnml(0-2): 90, 20439, 53453, 21019, 114

-------

closes https://github.com/official-stockfish/Stockfish/pull/4711

Bench: 1350831

8 months agoImprove some comments
Stéphane Nicolet [Fri, 28 Jul 2023 21:38:37 +0000 (23:38 +0200)]
Improve some comments

- clarify the examples for the bench command
- typo  in search.cpp

closes https://github.com/official-stockfish/Stockfish/pull/4710

No functional change

8 months agoRemove unused return type from propagate()
mstembera [Tue, 25 Jul 2023 02:02:49 +0000 (19:02 -0700)]
Remove unused return type from propagate()

Also make two get_weight_index() static methods constexpr, for
consistency with the other static get_hash_value() method right above.
Tested for speed by user Torom (thanks).

closes https://github.com/official-stockfish/Stockfish/pull/4708

No functional change

9 months agoSimplify one multicut extension
FauziAkram [Tue, 25 Jul 2023 10:55:29 +0000 (13:55 +0300)]
Simplify one multicut extension

Simplify away the ttValue <= alpha extension in the multicut block.

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 318336 W: 81307 L: 81398 D: 155631
Ptnml(0-2): 1088, 37291, 82469, 37264, 1056
https://tests.stockfishchess.org/tests/view/64b8589fdc56e1650abad61d

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 89388 W: 22925 L: 22775 D: 43688
Ptnml(0-2): 34, 9635, 25210, 9777, 38
https://tests.stockfishchess.org/tests/view/64bc41d0dc56e1650abb29cb

closes https://github.com/official-stockfish/Stockfish/pull/4709

bench: 1604592

9 months agoRemove Zobrist::noPawns
Stephen Touset [Mon, 24 Jul 2023 22:06:14 +0000 (00:06 +0200)]
Remove Zobrist::noPawns

Zobrist::noPawns is no longer used.

closes https://github.com/official-stockfish/Stockfish/pull/4344

no functional change

9 months agoSimplify TT cutoff
Stefan Geschwentner [Thu, 20 Jul 2023 20:12:15 +0000 (22:12 +0200)]
Simplify TT cutoff

Remove the exact bound condition from TT depth check.

STC:
https://tests.stockfishchess.org/tests/view/64b30b320cdec37b957359e9
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 332928 W: 84895 L: 85003 D: 163030
Ptnml(0-2): 1242, 39200, 85604, 39260, 1158

LTC:
https://tests.stockfishchess.org/tests/view/64b74e2adc56e1650abac0b6
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 92946 W: 23628 L: 23482 D: 45836
Ptnml(0-2): 38, 10033, 26192, 10165, 45

closes https://github.com/official-stockfish/Stockfish/pull/4702

Bench: 1601764

9 months agoSimplify some qsearch conditions
windfishballad [Sun, 23 Jul 2023 00:35:40 +0000 (20:35 -0400)]
Simplify some qsearch conditions

Use the assert which ensures that beta == alpha+1 at PVNodes
to simplify a little bit the conditions further down in the code.

passed STC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 56160 W: 14370 L: 14173 D: 27617
Ptnml(0-2): 210, 6192, 15076, 6395, 207
https://tests.stockfishchess.org/tests/view/64bc769cdc56e1650abb2e26

closes https://tests.stockfishchess.org/tests/view/64bc769cdc56e1650abb2e26

No functional change

9 months agoCheck clock more often
Joost VandeVondele [Sat, 22 Jul 2023 07:41:55 +0000 (09:41 +0200)]
Check clock more often

This patch changes the frequency with which the time is checked, changing
frequency from every 1024 counted nodes to every 512 counted nodes. The
master value was tuned for the old classical eval, the patch takes the
roughly 2x slowdown in nps with SFNNUEv7 into account. This could reduce
a bit the losses on time on fishtest, but they are probably unrelated.

passed STC:
https://tests.stockfishchess.org/tests/view/64bb8ae5dc56e1650abb1b11
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 76576 W: 19677 L: 19501 D: 37398
Ptnml(0-2): 274, 8592, 20396, 8736, 290

closes https://github.com/official-stockfish/Stockfish/pull/4704

No functional change

9 months agoDo more futility pruning for cutNodes that are not in TT
Michael Chaly [Wed, 19 Jul 2023 08:58:02 +0000 (11:58 +0300)]
Do more futility pruning for cutNodes that are not in TT

This is somewhat similar to IIR for cutnodes but instead of reducing
depth for cutnodes that don't have tt move we reduce margin multiplier
in futility pruning for cutnodes that are not in TT.

Passed STC:
https://tests.stockfishchess.org/tests/view/64b244b90cdec37b95734c5b
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 75552 W: 19404 L: 19029 D: 37119
Ptnml(0-2): 233, 8806, 19378, 9071, 288

Passed LTC:
https://tests.stockfishchess.org/tests/view/64b3ae5a0cdec37b95736516
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 104988 W: 27152 L: 26697 D: 51139
Ptnml(0-2): 41, 11259, 29446, 11700, 48

closes https://github.com/official-stockfish/Stockfish/pull/4700

bench 1727577

9 months agoRemove inline assembly
mstembera [Tue, 18 Jul 2023 18:50:34 +0000 (11:50 -0700)]
Remove inline assembly

closes https://github.com/official-stockfish/Stockfish/pull/4698

No functional change

9 months agoUnused code cleanup
Cody Ho [Tue, 18 Jul 2023 20:03:26 +0000 (13:03 -0700)]
Unused code cleanup

closes https://github.com/official-stockfish/Stockfish/pull/4696

No functional change

9 months agoAdd CodeQL workflow
Jorge [Mon, 3 Jul 2023 07:17:24 +0000 (09:17 +0200)]
Add CodeQL workflow

add CI tooling to detect security bugs.

closes https://github.com/official-stockfish/Stockfish/pull/4659

No functional change

9 months agoRemoves a few Bitboards and functions
rn5f107s2 [Mon, 17 Jul 2023 19:41:03 +0000 (21:41 +0200)]
Removes a few Bitboards and functions

No longer used

closes https://github.com/official-stockfish/Stockfish/pull/4695

No functional change

9 months agoremove evalType from bench
Robert Nurnberg @ elitebook [Mon, 17 Jul 2023 16:02:22 +0000 (18:02 +0200)]
remove evalType from bench

no longer used

closes https://github.com/official-stockfish/Stockfish/pull/4694

No functional change

9 months agoSwitch to macos 13 for CI
Joost VandeVondele [Sun, 16 Jul 2023 16:14:38 +0000 (18:14 +0200)]
Switch to macos 13 for CI

allows for building x86-64-avx2 and x86-64-bmi2 binaries for mac

install coreutils
show hardware capabilities as seen by the compilers
move some tests from sse41 to avx2 as platforms support it

closes https://github.com/official-stockfish/Stockfish/pull/4692

No functional change

9 months agoDeprecate the x86-64-modern arch
Joost VandeVondele [Sun, 16 Jul 2023 14:25:03 +0000 (16:25 +0200)]
Deprecate the x86-64-modern arch

Explicitly describe the architecture as deprecated,
it remains available as its current alias x86-64-sse41-popcnt

CPUs that support just this instruction set are now years old,
any few years old Intel or AMD CPU supports x86-64-avx2. However,
naming things 'modern' doesn't age well, so instead use explicit names.

Adjust CI accordingly. Wiki, fishtest, downloader done as well.

closes https://github.com/official-stockfish/Stockfish/pull/4691

No functional change.

9 months agoRemove improvement variable
Michael Chaly [Sun, 16 Jul 2023 08:52:37 +0000 (11:52 +0300)]
Remove improvement variable

No longer used in a meaningful way.
Improve comments.

Closes https://github.com/official-stockfish/Stockfish/pull/4688

No functional change

9 months agoRemove pawnKey from StateInfo
maxim [Thu, 13 Jul 2023 16:09:02 +0000 (19:09 +0300)]
Remove pawnKey from StateInfo

Remove pawnKey since it is not used anymore.

Passed Non-regression STC:
https://tests.stockfishchess.org/tests/view/64b023110cdec37b9573265c
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 334848 W: 85440 L: 85545 D: 163863
Ptnml(0-2): 1134, 38101, 89075, 37964, 1150

closes https://github.com/official-stockfish/Stockfish/pull/4687

No functional change

9 months agoConsolidate to centipawns conversion
Joost VandeVondele [Sat, 15 Jul 2023 11:34:16 +0000 (13:34 +0200)]
Consolidate to centipawns conversion

avoid doing this calculations in multiple places.

closes https://github.com/official-stockfish/Stockfish/pull/4686

No functional change

9 months agoRemove some CI parts not yet working
Joost VandeVondele [Sat, 15 Jul 2023 09:59:27 +0000 (11:59 +0200)]
Remove some CI parts not yet working

downgrading compiler didn't work for windows build. Stick to gcc 13 for now.
Windows x86-32 not a 32bit binary, remove.

closes https://github.com/official-stockfish/Stockfish/pull/4685

No functional change

9 months agoremove large input specialization
AndrovT [Sat, 15 Jul 2023 09:00:18 +0000 (11:00 +0200)]
remove large input specialization

Removes unused large input specialization for dense affine transform. It has been obsolete since #4612 was merged.

closes https://github.com/official-stockfish/Stockfish/pull/4684

No functional change

9 months agoReintroduce nnue eval pawn count multipliers again
Linmiao Xu [Mon, 3 Jul 2023 02:26:52 +0000 (22:26 -0400)]
Reintroduce nnue eval pawn count multipliers again

With separate multipliers for nnue eval and optimism scaling.
This patch used 4 out of 7 params tuned with spsa at 30+0.3
using this tuning config:

Value LazyThreshold1 = Value(3622);
Value LazyThreshold2 = Value(1962);
int psqThresh = 2048;
int nnueNpmBase = 945;
int nnuePcMult = 0;
int optNpmBase = 150;
int optPcMult = 0;
TUNE(SetRange(3322, 3922), LazyThreshold1);
TUNE(SetRange(1662, 2262), LazyThreshold2);
TUNE(SetRange(1748, 2348), psqThresh);
TUNE(SetRange(745, 1145), nnueNpmBase);
TUNE(SetRange(-16, 16), nnuePcMult);
TUNE(SetRange(0, 300), optNpmBase);
TUNE(SetRange(-16, 16), optPcMult);

Passed STC:
https://tests.stockfishchess.org/tests/view/64a5a9b402cd07745c60ed07
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 173632 W: 44417 L: 43903 D: 85312
Ptnml(0-2): 547, 20025, 45068, 20719, 457

Passed LTC:
https://tests.stockfishchess.org/tests/view/64a972a302cd07745c6136af
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 277644 W: 70955 L: 70147 D: 136542
Ptnml(0-2): 193, 29902, 77787, 30784, 156

closes https://github.com/official-stockfish/Stockfish/pull/4681

bench 1556301

9 months agoBuild and test more binaries in CI
Joost VandeVondele [Fri, 14 Jul 2023 15:43:56 +0000 (17:43 +0200)]
Build and test more binaries in CI

use a fixed compiler on Linux and Windows (right now gcc 11).
build avxvnni on Windows (Linux needs updated core utils)
build x86-32 on Linux (Windows needs other mingw)
fix a Makefile issue where a failed PGOBENCH would not stop the build
reuse the WINE_PATH for SDE as we do for QEMU
use WINE_PATH variable also for the signature
verify the bench for each of the binaries
do not build x86-64-avx2 on macos

closes https://github.com/official-stockfish/Stockfish/pull/4682

No functional change

9 months agoUse more expressive names for bonus1 and bonus2
FauziAkram [Fri, 14 Jul 2023 21:51:14 +0000 (00:51 +0300)]
Use more expressive names for bonus1 and bonus2

closes https://github.com/official-stockfish/Stockfish/pull/4683

No functional change

9 months agoGenerate binaries for more advanced architectures
Joost VandeVondele [Wed, 12 Jul 2023 17:34:07 +0000 (19:34 +0200)]
Generate binaries for more advanced architectures

use intel's Software Development Emulator (SDE) in the actions that build the binaries.
This allows for building on Windows and Linux binaries for
- x86-64-avx512
- x86-64-vnni256
- x86-64-vnni512

(x86-64-avxvnni needs more recent gcc in the actions)

also build x86-64-avx2 on macos.

closes https://github.com/official-stockfish/Stockfish/pull/4679

No functional change

9 months agoMore simplifications and cleanup in affine_transform_sparse_input.h
mstembera [Wed, 12 Jul 2023 05:19:48 +0000 (22:19 -0700)]
More simplifications and cleanup in affine_transform_sparse_input.h

closes https://github.com/official-stockfish/Stockfish/pull/4677

No functional change

9 months agoCleanup code after removal of classical evaluation
Sebastian Buchwald [Wed, 12 Jul 2023 17:46:33 +0000 (19:46 +0200)]
Cleanup code after removal of classical evaluation

This includes the following changes:
- Remove declaration of removed global variable
- Adapt string that mentions removed UCI option

closes https://github.com/official-stockfish/Stockfish/pull/4675

No functional change

9 months agoMerge remote-tracking branch 'upstream/master'
Steinar H. Gunderson [Wed, 12 Jul 2023 14:57:01 +0000 (16:57 +0200)]
Merge remote-tracking branch 'upstream/master'

9 months agoRemove classical evaluation
Joost VandeVondele [Thu, 1 Jun 2023 06:09:07 +0000 (08:09 +0200)]
Remove classical evaluation

since the introduction of NNUE (first released with Stockfish 12), we
have maintained the classical evaluation as part of SF in frozen form.
The idea that this code could lead to further inputs to the NN or
search did not materialize. Now, after five releases, this PR removes
the classical evaluation from SF. Even though this evaluation is
probably the best of its class, it has become unimportant for the
engine's strength, and there is little need to maintain this
code (roughly 25% of SF) going forward, or to expend resources on
trying to improve its integration in the NNUE eval.

Indeed, it had still a very limited use in the current SF, namely
for the evaluation of positions that are nearly decided based on
material difference, where the speed of the classical evaluation
outweights its inaccuracies. This impact on strength is small,
roughly 2Elo, and probably decreasing in importance as the TC grows.

Potentially, removal of this code could lead to the development of
techniques to have faster, but less accurate NN evaluation,
for certain positions.

STC
https://tests.stockfishchess.org/tests/view/64a320173ee09aa549c52157
Elo: -2.35 ± 1.1 (95%) LOS: 0.0%
Total: 100000 W: 24916 L: 25592 D: 49492
Ptnml(0-2): 287, 12123, 25841, 11477, 272
nElo: -4.62 ± 2.2 (95%) PairsRatio: 0.95

LTC
https://tests.stockfishchess.org/tests/view/64a320293ee09aa549c5215b
 Elo: -1.74 ± 1.0 (95%) LOS: 0.0%
Total: 100000 W: 25010 L: 25512 D: 49478
Ptnml(0-2): 44, 11069, 28270, 10579, 38
nElo: -3.72 ± 2.2 (95%) PairsRatio: 0.96

VLTC SMP
https://tests.stockfishchess.org/tests/view/64a3207c3ee09aa549c52168
 Elo: -1.70 ± 0.9 (95%) LOS: 0.0%
Total: 100000 W: 25673 L: 26162 D: 48165
Ptnml(0-2): 8, 9455, 31569, 8954, 14
nElo: -3.95 ± 2.2 (95%) PairsRatio: 0.95

closes https://github.com/official-stockfish/Stockfish/pull/4674

Bench: 1444646

9 months agoSimplify PvNode reduction
Muzhen Gaming [Fri, 7 Jul 2023 12:19:31 +0000 (20:19 +0800)]
Simplify PvNode reduction

Simplification STC: https://tests.stockfishchess.org/tests/view/64a415803ee09aa549c539c3
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 37856 W: 9719 L: 9504 D: 18633
Ptnml(0-2): 98, 4277, 9977, 4464, 112

Simplification LTC: https://tests.stockfishchess.org/tests/view/64a5ffe202cd07745c60f360
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 55878 W: 14323 L: 14138 D: 27417
Ptnml(0-2): 21, 5993, 15732, 6166, 27

closes https://github.com/official-stockfish/Stockfish/pull/4673

Bench: 2604965

9 months agoFix CI output
Joost VandeVondele [Thu, 6 Jul 2023 21:29:11 +0000 (23:29 +0200)]
Fix CI output

closes https://github.com/official-stockfish/Stockfish/pull/4669

No functional change

9 months agoUpdate default net to nn-c38c3d8d3920.nnue
Linmiao Xu [Mon, 26 Jun 2023 00:57:50 +0000 (20:57 -0400)]
Update default net to nn-c38c3d8d3920.nnue

This was a later epoch from the same experiment that led to the
previous master net. After training, it was prepared the same way:

1. greedy permuting L1 weights with https://github.com/official-stockfish/Stockfish/pull/4620
2. leb128 compression with https://github.com/glinscott/nnue-pytorch/pull/251
3. greedy 2- and 3- cycle permuting with https://github.com/official-stockfish/Stockfish/pull/4640

Local elo at 25k nodes per move (vs. L1-1536 nn-fdc1d0fe6455.nnue):
nn-epoch739.nnue : 20.2 +/- 1.7

Passed STC:
https://tests.stockfishchess.org/tests/view/64a050b33ee09aa549c4e4c8
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 195552 W: 49977 L: 49430 D: 96145
Ptnml(0-2): 556, 22775, 50607, 23242, 596

Passed LTC:
https://tests.stockfishchess.org/tests/view/64a127bd3ee09aa549c4f60c
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 235452 W: 60327 L: 59609 D: 115516
Ptnml(0-2): 119, 25173, 66426, 25887, 121

closes https://github.com/official-stockfish/Stockfish/pull/4666

bench 2427629

9 months agoAdd armv8-dotprod to CI binaries
Joost VandeVondele [Wed, 5 Jul 2023 18:15:49 +0000 (20:15 +0200)]
Add armv8-dotprod to CI binaries

also generate binaries for more recent Android hardware.

closes https://github.com/official-stockfish/Stockfish/pull/4663

No functional change

9 months agoSimplify away lookup_count.
mstembera [Mon, 3 Jul 2023 19:59:42 +0000 (12:59 -0700)]
Simplify away lookup_count.

https://tests.stockfishchess.org/tests/view/64a3c1a93ee09aa549c53167
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 32832 W: 8497 L: 8280 D: 16055
Ptnml(0-2): 80, 3544, 8967, 3729, 96

closes https://github.com/official-stockfish/Stockfish/pull/4662

No functional change

9 months agoRevise extract bench from git log in CI
Joost VandeVondele [Thu, 6 Jul 2023 16:30:51 +0000 (18:30 +0200)]
Revise extract bench from git log in CI

order commits differently

closes https://github.com/official-stockfish/Stockfish/pull/4668

No functional change

9 months agoRemove leftover braces for if conditional in CI
ppigazzini [Mon, 3 Jul 2023 17:41:13 +0000 (19:41 +0200)]
Remove leftover braces for if conditional in CI

closes https://github.com/official-stockfish/Stockfish/pull/4660

No functional change

9 months agoExtract bench according to wiki instructions
ppigazzini [Fri, 16 Jun 2023 11:01:20 +0000 (13:01 +0200)]
Extract bench according to wiki instructions

- loop through the commits starting from the latest one
- read the bench value from the last match, if any, of the template
  in the commit body text

closes https://github.com/official-stockfish/Stockfish/pull/4627

No functional change

9 months agosimplified gives check castling
rn5f107s2 [Fri, 16 Jun 2023 16:49:31 +0000 (18:49 +0200)]
simplified gives check castling

tested verifying perft and bench is unchanged
on a larger set of epds for both standard and FRC chess.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/live_elo/648587be65ffe077ca123d78
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 153632 W: 41015 L: 40928 D: 71689
Ptnml(0-2): 377, 16077, 43816, 16174, 372

closes https://github.com/official-stockfish/Stockfish/pull/4628

No functional change

9 months agoImproving grammar and readability of comments
FauziAkram [Tue, 27 Jun 2023 12:13:59 +0000 (15:13 +0300)]
Improving grammar and readability of comments

closes https://github.com/official-stockfish/Stockfish/pull/4643

No functional change

9 months agoSimplify score improvement reduction
Muzhen Gaming [Thu, 22 Jun 2023 11:19:21 +0000 (19:19 +0800)]
Simplify score improvement reduction

Reduce depth by 2 based on score improvement, only for depths 3 to 11.

Simplification STC: https://tests.stockfishchess.org/tests/view/64929a53dc7002ce609c7807
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 238912 W: 63466 L: 63468 D: 111978
Ptnml(0-2): 564, 26262, 65805, 26262, 563

Simplification LTC: https://tests.stockfishchess.org/tests/view/64942e47dc7002ce609c9e07
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 64452 W: 17485 L: 17320 D: 29647
Ptnml(0-2): 19, 6161, 19706, 6316, 24

closes https://github.com/official-stockfish/Stockfish/pull/4637

Bench: 2740142

9 months agoSimplify away improvement term in null move search
Muzhen Gaming [Wed, 28 Jun 2023 10:36:11 +0000 (18:36 +0800)]
Simplify away improvement term in null move search

passed STC:
https://tests.stockfishchess.org/tests/view/649c0d2edc7002ce609d33b5
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 271104 W: 72181 L: 72217 D: 126706
Ptnml(0-2): 691, 30042, 74129, 29992, 698

passed LTC:
https://tests.stockfishchess.org/tests/view/649d0dd7dc7002ce609d4efa
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 183120 W: 49469 L: 49418 D: 84233
Ptnml(0-2): 84, 17636, 56063, 17699, 78

closes https://github.com/official-stockfish/Stockfish/pull/4650

Bench: 2642851

9 months agoFix pruning to (in TB loss) in Null move pruning.
peregrineshahin [Tue, 27 Jun 2023 03:07:20 +0000 (06:07 +0300)]
Fix pruning to (in TB loss) in Null move pruning.

Current logic can apply Null move pruning
on a dead-lost position returning an unproven loss
(i.e. in TB loss score or mated in losing score) on nonPv nodes.

on a default bench, this can be observed by adding this debugging line:
```
if (nullValue >= beta)
{
    // Do not return unproven mate or TB scores
    nullValue = std::min(nullValue, VALUE_TB_WIN_IN_MAX_PLY-1);
    dbg_hit_on(nullValue <= VALUE_TB_LOSS_IN_MAX_PLY); // Hit #0: Total 73983 Hits 1 Hit Rate (%) 0.00135166
    if (thisThread->nmpMinPly || depth < 14)
        return nullValue;
```

This fixes this very rare issue (happens at ~0.00135166% of the time) by
eliminating the need to try Null Move Pruning with dead-lost positions
and leaving it to be determined by a normal searching flow.

The previous try to fix was not as safe enough because it was capping
the returned value to (out of TB range) thus reviving the dead-lost position
based on an artificial clamp (i.e. the in TB score/mate score can be lost on that nonPv node):
https://tests.stockfishchess.org/tests/view/649756d5dc7002ce609cd794

Final fix:
Passed STC:
https://tests.stockfishchess.org/tests/view/649a5446dc7002ce609d1049
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 577280 W: 153613 L: 153965 D: 269702
Ptnml(0-2): 1320, 60594, 165190, 60190, 1346

Passed LTC:
https://tests.stockfishchess.org/tests/view/649cd048dc7002ce609d4801
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 246432 W: 66769 L: 66778 D: 112885
Ptnml(0-2): 83, 22105, 78847, 22100, 81

closes https://github.com/official-stockfish/Stockfish/pull/4649

Bench: 2425978

9 months agoSimplify lookup_count and clean up pieces().
mstembera [Mon, 3 Jul 2023 02:48:18 +0000 (19:48 -0700)]
Simplify lookup_count and clean up pieces().

https://github.com/official-stockfish/Stockfish/pull/4656

No functional change

9 months agoAdd bmi2 to CI generated binaries
disservin [Mon, 3 Jul 2023 06:20:56 +0000 (08:20 +0200)]
Add bmi2 to CI generated binaries

verify bench for avx2 and bmi2 as well

closes https://github.com/official-stockfish/Stockfish/pull/4658

No functional change

9 months agoMake posix and msys2 shells consistent in CI
ppigazzini [Sat, 1 Jul 2023 12:36:52 +0000 (14:36 +0200)]
Make posix and msys2 shells consistent in CI

In CI, it is typical for the process to halt immediately when an error
is encountered. However, with our `shell: bash {0}` configuration,
the process continues despite errors for posix shells.
This commit updates the behavior of posix and msys2 shells to ensure
consistency in terms of pipeline exit codes and stop conditions.
We adopt the most appropriate default behavior as recommended
by the GitHub documentation.

Update the code that searches for the bench value in the git log:
- to be compatible with the new shell settings
- to retry the value from the first line that contains
  only the template and spaces/tabs/newlines

see also

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
https://github.com/msys2/setup-msys2/blob/main/main.js

closes https://github.com/official-stockfish/Stockfish/pull/4653

No functional change

9 months agoUpdate NNUE architecture to SFNNv7 with larger L1 size of 2048
Linmiao Xu [Sun, 25 Jun 2023 21:44:28 +0000 (17:44 -0400)]
Update NNUE architecture to SFNNv7 with larger L1 size of 2048

Creating this net involved:
- a 5-step training process from scratch
- greedy permuting L1 weights with https://github.com/official-stockfish/Stockfish/pull/4620
- leb128 compression with https://github.com/glinscott/nnue-pytorch/pull/251
- greedy 2- and 3- cycle permuting with https://github.com/official-stockfish/Stockfish/pull/4640

The 5 training steps were:

1. 400 epochs, lambda 1.0, lr 9.75e-4
   UHOx2-wIsRight-multinet-dfrc-n5000-largeGensfen-d9.binpack (178G)
     nodes5000pv2_UHO.binpack
     data_pv-2_diff-100_nodes-5000.binpack
     wrongIsRight_nodes5000pv2.binpack
     multinet_pv-2_diff-100_nodes-5000.binpack
     dfrc_n5000.binpack
     large_gensfen_multipvdiff_100_d9.binpack
   ep399 chosen as start model for step2

2. 800 epochs, end-lambda 0.75, skip 16
   LeelaFarseer-T78juntoaugT79marT80dec.binpack (141G)
     T60T70wIsRightFarseerT60T74T75T76.binpack
     test78-junjulaug2022-16tb7p.no-db.min.binpack
     test79-mar2022-16tb7p.no-db.min.binpack
     test80-dec2022-16tb7p.no-db.min.binpack
   ep559 chosen as start model for step3

3. 800 epochs, end-lambda 0.725, skip 20
   leela96-dfrc99-v2-T80dectofeb-sk20-mar-v6-T77decT78janfebT79apr.binpack (223G)
     leela96-filt-v2.min.binpack
     dfrc99-16tb7p-eval-filt-v2.min.binpack
     test80-dec2022-16tb7p-filter-v6-sk20.min-mar2023.binpack
     test80-jan2023-16tb7p-filter-v6-sk20.min-mar2023.binpack
     test80-feb2023-16tb7p-filter-v6-sk20.min-mar2023.binpack
     test80-mar2023-2tb7p-filter-v6.min.binpack
     test77-dec2021-16tb7p.no-db.min.binpack
     test78-janfeb2022-16tb7p.no-db.min.binpack
     test79-apr2022-16tb7p.no-db.min.binpack
   ep499 chosen as start model for step4

4. 800 epochs, end-lambda 0.7, skip 24
   0dd1cebea57 dataset https://github.com/official-stockfish/Stockfish/pull/4606
   ep599 chosen as start model for step5

5. 800 epochs, end-lambda 0.7, skip 28
   same dataset as step4
   ep619 became nn-1b951f8b449d.nnue

For the final step5 training:

python3 easy_train.py \
  --experiment-name L1-2048-S5-sameData-sk28-S4-0dd1cebea57-shuffled-S3-leela96-dfrc99-v2-T80dectofeb-sk20-mar-v6-T77decT78janfebT79apr-sk20-S2-LeelaFarseerT78T79T80-ep399-S1-UHOx2-wIsRight-multinet-dfrc-n5000-largeGensfen-d9 \
  --training-dataset /data/leela96-dfrc99-T60novdec-v2-T80juntonovjanfebT79aprmayT78jantosepT77dec-v6dd-T80apr.binpack \
  --early-fen-skipping 28 \
  --nnue-pytorch-branch linrock/nnue-pytorch/misc-fixes-L1-2048 \
  --engine-test-branch linrock/Stockfish/L1-2048 \
  --start-from-engine-test-net False \
  --start-from-model /data/experiments/experiment_L1-2048-S4-0dd1cebea57-shuffled-S3-leela96-dfrc99-v2-T80dectofeb-sk20-mar-v6-T77decT78janfebT79apr-sk20-S2-LeelaFarseerT78T79T80-ep399-S1-UHOx2-wIsRight-multinet-dfrc-n5000-largeGensfen-d9/training/run_0/nn-epoch599.nnue
  --max_epoch 800 \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --tui False \
  --seed $RANDOM \
  --gpus 0

SF training data components for the step1 dataset:
https://drive.google.com/drive/folders/1yLCEmioC3Xx9KQr4T7uB6GnLm5icAYGU

Leela training data for steps 2-5 can be found at:
https://robotmoon.com/nnue-training-data/

Due to larger L1 size and slower inference, the speed penalty loses elo
at STC. Measurements from 100 bench runs at depth 13 with x86-64-modern
on Intel Core i5-1038NG7 2.00GHz:

sf_base =  1240730  +/-   3443 (95%)
sf_test =  1153341  +/-   2832 (95%)
diff    =   -87388  +/-   1616 (95%)
speedup = -7.04330% +/- 0.130% (95%)

Local elo at 25k nodes per move (vs. L1-1536 nn-fdc1d0fe6455.nnue):
nn-epoch619.nnue : 21.1 +/- 3.2

Failed STC:
https://tests.stockfishchess.org/tests/view/6498ee93dc7002ce609cf979
LLR: -2.95 (-2.94,2.94) <0.00,2.00>
Total: 11680 W: 3058 L: 3299 D: 5323
Ptnml(0-2): 44, 1422, 3149, 1181, 44

LTC:
https://tests.stockfishchess.org/tests/view/649b32f5dc7002ce609d20cf
Elo: 0.68 ± 1.5 (95%) LOS: 80.5%
Total: 40000 W: 10887 L: 10809 D: 18304
Ptnml(0-2): 36, 3938, 11958, 4048, 20
nElo: 1.50 ± 3.4 (95%) PairsRatio: 1.02

Passed VLTC 180+1.8:
https://tests.stockfishchess.org/tests/view/64992b43dc7002ce609cfd20
LLR: 3.06 (-2.94,2.94) <0.00,2.00>
Total: 38086 W: 10612 L: 10338 D: 17136
Ptnml(0-2): 9, 3316, 12115, 3598, 5

Passed VLTC SMP 60+0.6 th 8:
https://tests.stockfishchess.org/tests/view/649a21fedc7002ce609d0c7d
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 38936 W: 11091 L: 10820 D: 17025
Ptnml(0-2): 1, 2948, 13305, 3207, 7

closes https://github.com/official-stockfish/Stockfish/pull/4646

Bench: 2505168

9 months agoNegative extension on cutNodes based on depth
cj5716 [Mon, 26 Jun 2023 11:40:22 +0000 (19:40 +0800)]
Negative extension on cutNodes based on depth

This patch was inspired by candirufish original attempt at negative extensions
here that failed yellow: https://tests.stockfishchess.org/tests/view/6486529065ffe077ca124f32

I tested some variations of the idea and tuned a depth condition for
a modified version of it here https://tests.stockfishchess.org/tests/view/648db80a91c58631ce31fe00
after noticing abnormal scaling (ie many passed STC but not LTC)
After some small tweaks I got the final version here

Passed STC:
LLR: 2.98 (-2.94,2.94) <0.00,2.00>
Total: 122208 W: 32776 L: 32350 D: 57082
Ptnml(0-2): 310, 13250, 33553, 13686, 305
https://tests.stockfishchess.org/tests/view/64997934dc7002ce609d01e3

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 145092 W: 39617 L: 39115 D: 66360
Ptnml(0-2): 54, 13691, 44552, 14197, 52
https://tests.stockfishchess.org/tests/view/649a1c5ddc7002ce609d0bff

closes https://github.com/official-stockfish/Stockfish/pull/4644

Bench: 2637784

9 months agoDocument the LEB128 patch
Stéphane Nicolet [Tue, 27 Jun 2023 10:03:00 +0000 (12:03 +0200)]
Document the LEB128 patch

Add some comments and harmonize style for the LEB128 patch.

closes https://github.com/official-stockfish/Stockfish/pull/4642

No functional change

9 months agoUpdate default net to nn-a3d1bfca1672.nnue
Daniel Monroe [Fri, 23 Jun 2023 22:36:27 +0000 (18:36 -0400)]
Update default net to nn-a3d1bfca1672.nnue

faster permutation of master net weights

Activation data taken from https://drive.google.com/drive/folders/1Ec9YuuRx4N03GPnVPoQOW70eucOKngQe?usp=sharing
Permutation found using https://github.com/Ergodice/nnue-pytorch/blob/836387a0e5e690431d404158c46648710f13904d/ftperm.py
See also https://github.com/glinscott/nnue-pytorch/pull/254

The algorithm greedily selects 2- and 3-cycles that can be permuted to increase the number of runs of zeroes. The percent of zero runs from the master net increased from 68.46 to 70.11 from 2-cycles and only increased to 70.32 when considering 3-cycles. Interestingly, allowing both halves of L1 to intermix when creating zero runs can give another 0.5% zero-run density increase with this method.

Measured speedup:

```
CPU: 16 x AMD Ryzen 9 3950X 16-Core Processor
Result of 50 runs

base (./stockfish.master ) = 1561556 +/- 5439
test (./stockfish.patch ) = 1575788 +/- 5427
diff = +14231 +/- 2636

speedup = +0.0091
P(speedup > 0) = 1.0000
```

closes https://github.com/official-stockfish/Stockfish/pull/4640

No functional change

9 months agoRestore development
Joost VandeVondele [Sat, 1 Jul 2023 10:18:46 +0000 (12:18 +0200)]
Restore development

closes https://github.com/official-stockfish/Stockfish/pull/4651

No functional change

9 months agoStockfish 16
Joost VandeVondele [Sat, 24 Jun 2023 06:58:17 +0000 (08:58 +0200)]
Stockfish 16

Official release version of Stockfish 16

Bench: 2593605

---

Stockfish 16

A new major release of Stockfish is now available at

https://stockfishchess.org/download/

*Quality of chess play*

Stockfish continues to demonstrate its ability to discover superior moves
with remarkable speed. In self-play against Stockfish 15, this new
release gains up to 50 Elo[1] and wins up to 12 times more game pairs[2]
than it loses. In major chess engine tournaments, Stockfish reliably tops
the rankings[3] winning the TCEC season 24 Superfinal, Swiss, Fischer
Random, and Double Random Chess tournaments and the CCC 19 Bullet,
20 Blitz, and 20 Rapid competitions. Leela Chess Zero[4] was the
challenger in most finals, putting top-engine chess now firmly in the
hands of teams embracing free and open-source software.

*Progress made*

This updated version of Stockfish introduces several enhancements,
including an upgraded neural net architecture (SFNNv6)[5], improved
implementation, and refined parameterization. The ongoing utilization
of Leela’s data combined with a novel inference approach exploiting
sparsity[6], and network compression[7] ensure a speedy evaluation and
modest binary sizes while allowing for more weights and higher accuracy.
The search has undergone more optimization, leading to improved
performance, particularly in longer analyses[8]. Additionally,
the Fishtest framework has been improved and is now able to run the
tests needed to validate new ideas with 10000s of CPU cores.

*Usability improvements*

Stockfish now comes with documentation, found in the wiki folder when
downloading it or on GitHub[9]. Additionally, Stockfish now includes
a clear and consistent forced tablebase win score, displaying a value
of 200 minus the number of plies required to reach a tablebase win[10].
Furthermore, the UCI_Elo option, to reduce its strength, has been
calibrated[11]. It is worth noting that the evaluation system remains
consistent with Stockfish 15.1[12], maintaining the choice that 100cp
means a 50% chance of winning the game against an equal opponent[13].
Finally, binaries of our latest development version are now provided
continuously as pre-releases on GitHub making it easier for
enthusiasts to download the latest and strongest version of
the program[14], we thank Roman Korba for having provided a similar
service for a long time.

*Thank you*

The success of the Stockfish project relies on the vibrant community
of passionate enthusiasts (we appreciate each and every one of you!)
who generously contribute their knowledge, time, and resources.
Together, this dedicated community works towards the common goal of
developing a powerful, freely accessible, and open-source chess engine.
We invite all chess enthusiasts to join the Fishtest testing framework
and contribute to the project[15].

The Stockfish team

[1] https://tests.stockfishchess.org/tests/view/649409f0dc7002ce609c99cc
[2] https://tests.stockfishchess.org/tests/view/649409d7dc7002ce609c99c6
[3] https://en.wikipedia.org/wiki/Stockfish_(chess)#Competition_results
[4] https://lczero.org/
[5] https://github.com/official-stockfish/Stockfish/commit/c1fff71
[6] https://github.com/official-stockfish/Stockfish/commit/38e6166
[7] https://github.com/official-stockfish/Stockfish/commit/a46087e
[8] https://github.com/official-stockfish/Stockfish/commit/472e726
[9] https://github.com/official-stockfish/Stockfish/wiki/
[10] https://github.com/official-stockfish/Stockfish/commit/def2966
[11] https://github.com/official-stockfish/Stockfish/commit/a08b8d4
[12] https://github.com/official-stockfish/Stockfish/commit/52e84e4
[13] https://github.com/official-stockfish/Stockfish/wiki/Stockfish-FAQ#interpretation-of-the-stockfish-evaluation
[14] https://github.com/official-stockfish/Stockfish/releases?q=prerelease%3Atrue
[15] https://stockfishchess.org/get-involved/

10 months agoUpdate default net to nn-5af11540bbfe.nnue
Linmiao Xu [Wed, 21 Jun 2023 04:43:46 +0000 (00:43 -0400)]
Update default net to nn-5af11540bbfe.nnue

Created by retraining the sparsified master net (nn-cd2ff4716c34.nnue) on
a 100% minified dataset including Leela transformers data from T80 may2023.

Weights permuted with the exact methods and code in:
https://github.com/official-stockfish/Stockfish/pull/4620

LEB128 compression done with the new serialize.py param in:
https://github.com/glinscott/nnue-pytorch/pull/251

Initially trained with max epoch 800. Around epoch 780, training was paused
and max epoch raised to 960.

python3 easy_train.py \
  --experiment-name L1-1536-sparse-master-retrain \
  --training-dataset /data/leela96-dfrc99-v2-T60novdecT77decT78jantosepT79aprmayT80juntonovjan-v6dd-T80febtomay2023.min.binpack \
  --early-fen-skipping 27 \
  --start-from-engine-test-net True \
  --max_epoch 960 \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --tui False \
  --seed $RANDOM \
  --gpus 0

For preparing the training dataset (interleaved size 328G):

python3 interleave_binpacks.py \
  leela96-filt-v2.min.binpack \
  dfrc99-16tb7p-eval-filt-v2.min.binpack \
  filt-v6-dd-min/test60-novdec2021-12tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test77-dec2021-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test78-jantomay2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test78-juntosep2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test79-apr2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test79-may2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-jun2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-jul2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-aug2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-sep2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-oct2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-nov2022-16tb7p-filter-v6-dd.min.binpack \
  filt-v6-dd-min/test80-jan2023-16tb7p-filter-v6-dd.min.binpack \
  test80-2023/test80-feb2023-16tb7p-no-db.min.binpack \
  test80-2023/test80-mar2023-2tb7p-no-db.min.binpack \
  test80-2023/test80-apr2023-2tb7p-no-db.min.binpack \
  test80-2023/test80-may2023-2tb7p-no-db.min.binpack \
  /data/leela96-dfrc99-v2-T60novdecT77decT78jantosepT79aprmayT80juntonovjan-v6dd-T80febtomay2023.min.binpack

Minified binpacks and Leela T80 training data from 2023 available at:
https://robotmoon.com/nnue-training-data/

Local elo at 25k nodes per move:
nn-epoch879.nnue : 3.9 +/- 5.7

Passed STC:
https://tests.stockfishchess.org/tests/view/64928c1bdc7002ce609c7690
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 72000 W: 19242 L: 18889 D: 33869
Ptnml(0-2): 182, 7787, 19716, 8126, 189

Passed LTC:
https://tests.stockfishchess.org/tests/view/64930a37dc7002ce609c82e3
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 54552 W: 14978 L: 14647 D: 24927
Ptnml(0-2): 23, 5123, 16650, 5460, 20

closes https://github.com/official-stockfish/Stockfish/pull/4635

bench 2593605

10 months agoFix Potential in TB cutoffs for NMP.
peregrineshahin [Mon, 12 Jun 2023 09:57:41 +0000 (12:57 +0300)]
Fix Potential in TB cutoffs for NMP.

Removes the second dependency on beta and caps the return value to VALUE_TB_WIN_IN_MAX_PLY - 1

Earlier tests:

STC:
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 193632 W: 51372 L: 51326 D: 90934
Ptnml(0-2): 447, 20111, 55687, 20091, 480
https://tests.stockfishchess.org/tests/view/6486ee4465ffe077ca125bc1

LTC:
LLR: 2.97 (-2.94,2.94) <-1.75,0.25>
Total: 331758 W: 89538 L: 89624 D: 152596
Ptnml(0-2): 114, 30121, 105516, 29993, 135
https://tests.stockfishchess.org/tests/view/6489401af42a44347ed7be42

updated constant:
LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 100260 W: 27143 L: 27017 D: 46100
Ptnml(0-2): 34, 8842, 32248, 8976, 30
https://tests.stockfishchess.org/tests/view/6492fcafdc7002ce609c818c

closes: https://github.com/official-stockfish/Stockfish/pull/4632
fixes: https://github.com/official-stockfish/Stockfish/issues/4598

bench: 2370027

10 months agoUpdate winrate model with June data
Joost VandeVondele [Thu, 22 Jun 2023 07:59:03 +0000 (09:59 +0200)]
Update winrate model with June data

Retained 748191776 scored positions for analysis

const int NormalizeToPawnValue = 328;
Corresponding spread = 60;
Corresponding normalized spread = 0.18337766691628035;
Draw rate at 0.0 eval at move 32 = 0.9914715947898592;

closes https://github.com/official-stockfish/Stockfish/pull/4636

No functional change

10 months agoUpdate top CPU contributors
Joost VandeVondele [Tue, 20 Jun 2023 07:46:02 +0000 (09:46 +0200)]
Update top CPU contributors

closes https://github.com/official-stockfish/Stockfish/pull/4629

No functional change

10 months agoFix failing CI of pull requests
disservin [Tue, 20 Jun 2023 16:27:20 +0000 (18:27 +0200)]
Fix failing CI of pull requests

adds a guard to prevent pull requests from trying to delete the previous pre-release

closing https://github.com/official-stockfish/Stockfish/pull/4631

No functional change.