1
0
Fork 0
Commit Graph

5276 Commits (riscv64-cartesi)

Author SHA1 Message Date
Stéphane Nicolet 0470bcef0e Detect fortresses a little bit quicker
In the so-called "hybrid" method of evaluation of current master, we use the
classical eval (because of its speed) instead of the NNUE eval when the classical
material balance approximation hints that the position is "winning enough" to
rely on the classical eval.

This trade-off idea between speed and accuracy works well in general, but in
some fortress positions the classical eval is just bad. So in shuffling branches
of the search tree, we (slowly) increase the thresehold so that eventually we
don't trust classical anymore and switch to NNUE evaluation.

This patch increases that threshold faster, so that we switch to NNUE quicker
in shuffling branches. Idea is to incite Stockfish to spend less time in fortresses
lines in the search tree, and spend more time searching the critical lines.

passed STC:
LLR: 2.96 (-2.94,2.94) <-0.50,2.50>
Total: 47872 W: 3908 L: 3720 D: 40244
Ptnml(0-2): 122, 3053, 17419, 3199, 143
https://tests.stockfishchess.org/tests/view/60cef34b457376eb8bcab79d

passed LTC:
LLR: 2.93 (-2.94,2.94) <0.50,3.50>
Total: 73616 W: 2326 L: 2143 D: 69147
Ptnml(0-2): 21, 1940, 32705, 2119, 23
https://tests.stockfishchess.org/tests/view/60cf6d842114332881e73528

Retested at LTC against lastest master:
LLR: 2.93 (-2.94,2.94) <0.50,3.50>
Total: 18264 W: 642 L: 532 D: 17090
Ptnml(0-2): 6, 479, 8055, 583, 9
https://tests.stockfishchess.org/tests/view/60d18cd540925195e7a6c351

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

Bench: 5139233
2021-06-22 11:51:03 +02:00
MichaelB7 9b82414b67 Make net nn-190f102a22c3.nnue the default net.
Trained with the pytorch trainer: https://github.com/glinscott/nnue-pytorch

python train.py i:/bin/all.binpack i:/bin/all.binpack --gpus 1 --threads 4 --num-workers 30 --batch-size 16384 --progress_bar_refresh_rate 300 --smart-fen-skipping --random-fen-skipping 3 --features=HalfKAv2^ --lambda=1.0 --max_epochs=440 --seed %random%%random% --default_root_dir exp/run_17 --resume-from-model ./pt/nn-75980ca503c6.pt

This run is thus started from the previous master net.

all.binpack equaled 4 parts Wrong_NNUE_2.binpack https://drive.google.com/file/d/1seGNOqcVdvK_vPNq98j-zV3XPE5zWAeq/view?usp=sharing plus two parts of Training_Data.binpack https://drive.google.com/file/d/1RFkQES3DpsiJqsOtUshENtzPfFgUmEff/view?usp=sharing
Each set was concatenated together - making one large Wrong_NNUE 2 binpack and one large Training so the were approximately equal in size. They were then interleaved together. The idea was to give Wrong_NNUE.binpack closer to equal weighting with the Training_Data binpack

passed LTC
https://tests.stockfishchess.org/tests/view/60d09f52b4c17000d679517f
LLR: 2.93 (-2.94,2.94) <0.50,3.50>
Total: 32184 W: 1100 L: 970 D: 30114
Ptnml(0-2): 10, 878, 14193, 994, 17

passed STC
https://tests.stockfishchess.org/tests/view/60d086c02114332881e7368e
LLR: 2.93 (-2.94,2.94) <-0.50,2.50>
Total: 11360 W: 1056 L: 906 D: 9398
Ptnml(0-2): 25, 735, 4026, 853, 41

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

Bench: 4631244
2021-06-21 23:16:55 +02:00
Joost VandeVondele 2e2865d34b Fix build error on OSX
directly use integer version for cp calculation.

fixes https://github.com/official-stockfish/Stockfish/issues/3573

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

No functional change
2021-06-21 23:14:58 +02:00
Stéphane Nicolet ed436a36ba Remove the Contempt UCI option
This patch removes the UCI option for setting Contempt in classical evaluation.

It is exactly equivalent to using Contempt=0 for the UCI contempt value and keeping
the dynamic part in the algo (renaming this dynamic part `trend` to better describe
what it does). We have tried quite hard to implement a working Contempt feature for
NNUE but nothing really worked, so it is probably time to give up.

Interested chess fans wishing to keep playing with the UCI option for Contempt and
use it with the classical eval are urged to download the version tagged "SF_Classical"
of Stockfish (dated 31 July 2020), as it was the last version where our search
algorithm was tuned for the classical eval and is probably our strongest classical
player ever: https://github.com/official-stockfish/Stockfish/tags

Passed STC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 72904 W: 6228 L: 6175 D: 60501
Ptnml(0-2): 221, 5006, 25971, 5007, 247
https://tests.stockfishchess.org/tests/view/60c98bf9457376eb8bcab18d

Passed LTC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 45168 W: 1601 L: 1547 D: 42020
Ptnml(0-2): 38, 1331, 19786, 1397, 32
https://tests.stockfishchess.org/tests/view/60c9c7fa457376eb8bcab1bb

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

Bench: 4947716
2021-06-21 22:58:56 +02:00
Stéphane Nicolet 70ac5ecbb6 Keep more pawns and pieces when attacking
This patch increase the weight of pawns and pieces from 28 to 32
in the scaling formula we apply to the output of the NNUE pure eval.

Increasing this gradient for pawns and pieces means that Stockfish
will try a little harder to keep material when she has the advantage,
and try a little bit harder to escape into an endgame when she is
under pressure.

STC:
LLR: 2.93 (-2.94,2.94) <-0.50,2.50>
Total: 53168 W: 4371 L: 4177 D: 44620
Ptnml(0-2): 160, 3389, 19283, 3601, 151
https://tests.stockfishchess.org/tests/view/60cefd1d457376eb8bcab7ab

LTC:
LLR: 2.94 (-2.94,2.94) <0.50,3.50>
Total: 10888 W: 386 L: 288 D: 10214
Ptnml(0-2): 3, 260, 4821, 356, 4
https://tests.stockfishchess.org/tests/view/60cf709d2114332881e7352b

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

Bench: 4965430
2021-06-20 23:17:07 +02:00
MichaelB7 ba01f4b954 Make net nn-75980ca503c6.nnue the default.
trained with the Python command

c:\nnue>python train.py i:/bin/all.binpack i:/bin/all.binpack --gpus 1 --threads 4 --num-workers 30 --batch-size 16384 --progress_bar_refresh_rate 300 --smart-fen-skipping --random-fen-skipping 3 --features=HalfKAv2^ --lambda=1.0 --max_epochs=440 --seed %random%%random% --default_root_dir exp/run_10 --resume-from-model ./pt/nn-3b20abec10c1.pt
`
all.binpack equaled 4 parts Wrong_NNUE_2.binpack https://drive.google.com/file/d/1seGNOqcVdvK_vPNq98j-zV3XPE5zWAeq/view?usp=sharing plus two parts of Training_Data.binpack https://drive.google.com/file/d/1RFkQES3DpsiJqsOtUshENtzPfFgUmEff/view?usp=sharing
Each set was concatenated together - making one large Wrong_NNUE 2 binpack and one large Training so the were approximately equal in size. They were then interleaved together. The idea was to give Wrong_NNUE.binpack closer to equal weighting with the Training_Data binpack .

Net nn-3b20abec10c1.nnue was chosen as the --resume-from-model with the idea that through learning, the manually hex edited values will be learned and will not need to be manually adjusted going forward. They would also be fine tuned by the learning process.

passed STC:
https://tests.stockfishchess.org/tests/view/60cdf91e457376eb8bcab66f
LLR: 2.95 (-2.94,2.94) <-0.50,2.50>
Total: 18256 W: 1639 L: 1479 D: 15138
Ptnml(0-2): 59, 1179, 6505, 1313, 72

passed LTC:
https://tests.stockfishchess.org/tests/view/60ce2166457376eb8bcab6e1
LLR: 2.94 (-2.94,2.94) <0.50,3.50>
Total: 18792 W: 654 L: 542 D: 17596
Ptnml(0-2): 9, 490, 8291, 592, 14

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

Bench: 5020972
2021-06-19 23:24:35 +02:00
Tomasz Sobczyk 2e745956c0 Change trace with NNUE eval support
This patch adds some more output to the `eval` command. It adds a board display
with estimated piece values (method is remove-piece, evaluate, put-piece), and
splits the NNUE evaluation with (psqt,layers) for each bucket for the NNUE net.

Example:

```

./stockfish
position fen 3Qb1k1/1r2ppb1/pN1n2q1/Pp1Pp1Pr/4P2p/4BP2/4B1R1/1R5K b - - 11 40
eval

 Contributing terms for the classical eval:
+------------+-------------+-------------+-------------+
|    Term    |    White    |    Black    |    Total    |
|            |   MG    EG  |   MG    EG  |   MG    EG  |
+------------+-------------+-------------+-------------+
|   Material |  ----  ---- |  ----  ---- | -0.73 -1.55 |
|  Imbalance |  ----  ---- |  ----  ---- | -0.21 -0.17 |
|      Pawns |  0.35 -0.00 |  0.19 -0.26 |  0.16  0.25 |
|    Knights |  0.04 -0.08 |  0.12 -0.01 | -0.08 -0.07 |
|    Bishops | -0.34 -0.87 | -0.17 -0.61 | -0.17 -0.26 |
|      Rooks |  0.12  0.00 |  0.08  0.00 |  0.04  0.00 |
|     Queens |  0.00  0.00 | -0.27 -0.07 |  0.27  0.07 |
|   Mobility |  0.84  1.76 |  0.01  0.66 |  0.83  1.10 |
|King safety | -0.99 -0.17 | -0.72 -0.10 | -0.27 -0.07 |
|    Threats |  0.27  0.27 |  0.73  0.86 | -0.46 -0.59 |
|     Passed |  0.00  0.00 |  0.79  0.82 | -0.79 -0.82 |
|      Space |  0.61  0.00 |  0.24  0.00 |  0.37  0.00 |
|   Winnable |  ----  ---- |  ----  ---- |  0.00 -0.03 |
+------------+-------------+-------------+-------------+
|      Total |  ----  ---- |  ----  ---- | -1.03 -2.14 |
+------------+-------------+-------------+-------------+

 NNUE derived piece values:
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |   Q   |   b   |       |   k   |       |
|       |       |       | +12.4 | -1.62 |       |       |       |
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |   r   |       |       |   p   |   p   |   b   |       |
|       | -3.89 |       |       | -0.84 | -1.19 | -3.32 |       |
+-------+-------+-------+-------+-------+-------+-------+-------+
|   p   |   N   |       |   n   |       |       |   q   |       |
| -1.81 | +3.71 |       | -4.82 |       |       | -5.04 |       |
+-------+-------+-------+-------+-------+-------+-------+-------+
|   P   |   p   |       |   P   |   p   |       |   P   |   r   |
| +1.16 | -0.91 |       | +0.55 | +0.12 |       | +0.50 | -4.02 |
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |       |   P   |       |       |   p   |
|       |       |       |       | +2.33 |       |       | +1.17 |
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |       |   B   |   P   |       |       |
|       |       |       |       | +4.79 | +1.54 |       |       |
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |       |       |       |   B   |       |   R   |       |
|       |       |       |       | +4.54 |       | +6.03 |       |
+-------+-------+-------+-------+-------+-------+-------+-------+
|       |   R   |       |       |       |       |       |   K   |
|       | +4.81 |       |       |       |       |       |       |
+-------+-------+-------+-------+-------+-------+-------+-------+

 NNUE network contributions (Black to move)
+------------+------------+------------+------------+
|   Bucket   |  Material  | Positional |   Total    |
|            |   (PSQT)   |  (Layers)  |            |
+------------+------------+------------+------------+
|  0         |  +  0.32   |  -  1.46   |  -  1.13   |
|  1         |  +  0.25   |  -  0.68   |  -  0.43   |
|  2         |  +  0.46   |  -  1.72   |  -  1.25   |
|  3         |  +  0.55   |  -  1.80   |  -  1.25   |
|  4         |  +  0.48   |  -  1.77   |  -  1.29   |
|  5         |  +  0.40   |  -  2.00   |  -  1.60   |
|  6         |  +  0.57   |  -  2.12   |  -  1.54   | <-- this bucket is used
|  7         |  +  3.38   |  -  2.00   |  +  1.37   |
+------------+------------+------------+------------+

Classical evaluation   -1.00 (white side)
NNUE evaluation        +1.54 (white side)
Final evaluation       +2.38 (white side) [with scaled NNUE, hybrid, ...]

```

Also renames the export_net() function to save_eval() while there.

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

No functional change
2021-06-19 11:57:01 +02:00
proukornew 0171b506ec Fix for Cygwin's environment build-profile (fixed)
The Cygwin environment has two g++ compilers, each with a different problem
for compiling  Stockfish at the moment:

(a) g++.exe : full posix build compiler, linked to cygwin dll.

    => This one has a problem embedding the net.

(b) x86_64-w64-mingw32-g++.exe : native Windows build compiler.

    => This one manages to embed the net, but has a problem related to libgcov
       when we use the profile-build target of Stockfish.

This patch solves the problem for compiler (b), so that our recommended command line
if you want to build an optimized version of Stockfish on Cygwin becomes something
like the following (you can change the ARCH value to whatever you want, but note
the COMP and CXX variables pointing at the right compiler):

```
   make -j profile-build ARCH=x86-64-modern COMP=mingw CXX=x86_64-w64-mingw32-c++.exe
```

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

No functional change
2021-06-19 11:22:30 +02:00
Joost VandeVondele adfb23c029 Make net nn-50144f835024.nnue the default
trained with the Python command

c:\nnue>python train.py i:/bin/all.binpack i:/bin/all.binpack --gpus 1 --threads 4 --num-workers 30 --batch-size 16384 --progress_bar_refresh_rate 300 --smart-fen-skipping --random-fen-skipping 3 --features=HalfKAv2^ --lambda=1.0 --max_epochs=440 --seed %random%%random% --default_root_dir exp/run_8 --resume-from-model ./pt/nn-6ad41a9207d0.pt
`
all.binpack equaled 4 parts Wrong_NNUE_2.binpack https://drive.google.com/file/d/1seGNOqcVdvK_vPNq98j-zV3XPE5zWAeq/view?usp=sharing plus two parts of Training_Data.binpack https://drive.google.com/file/d/1RFkQES3DpsiJqsOtUshENtzPfFgUmEff/view?usp=sharing
Each set was concatenated together - make one large Wrong_NNUE 2 binpack and one large Training_Data of approximate size. They were then interleaved together. The idea was to give Wrong_NNUE.binpack closer to equal weighting with the Training _Data binpack .

nn-6ad41a9207d0.pt was derived from a net vondele ran which passed STC quickly,
but faltered in LTC. https://tests.stockfishchess.org/tests/view/60cba666457376eb8bcab443

STC:
LLR: 2.95 (-2.94,2.94) <-0.50,2.50>
Total: 18792 W: 2068 L: 1889 D: 14835
Ptnml(0-2): 82, 1480, 6117, 1611, 106
https://tests.stockfishchess.org/tests/view/60ccda8b457376eb8bcab568

LTC:
LLR: 2.94 (-2.94,2.94) <0.50,3.50>
Total: 11376 W: 574 L: 454 D: 10348
Ptnml(0-2): 4, 412, 4747, 510, 15
https://tests.stockfishchess.org/tests/view/60ccf952457376eb8bcab58d

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

Bench: 4900906
2021-06-18 23:50:26 +02:00
SFisGOD 86afb6a7cf Update default net to nn-aa9d7eeb397e.nnue
Optimization of vondele's nn-33c9d39e5eb6.nnue using SPSA
https://tests.stockfishchess.org/tests/view/60ca68be457376eb8bcab28b
Setting: ck values are default based on how large the parameters are
The new values for this net are the raw values at the end of the tuning (80k games)

The significant changes are in buckets 1 and 2 (5-12 pieces) so the main difference is in playing endgames if we compare it to nn-33c9. There is also change in bucket 7 (29-32 pieces) but not as substantial as the changes in buckets 1 and 2. If we interpret the changes based on an experiment a few months ago, this new net plays more optimistically during endgames and less optimistically during openings.

STC:
LLR: 2.93 (-2.94,2.94) <-0.50,2.50>
Total: 49504 W: 4246 L: 4053 D: 41205
Ptnml(0-2): 140, 3282, 17749, 3407, 174
https://tests.stockfishchess.org/tests/view/60cbd752457376eb8bcab478

LTC:
LLR: 2.95 (-2.94,2.94) <0.50,3.50>
Total: 88720 W: 4926 L: 4651 D: 79143
Ptnml(0-2): 105, 4048, 35793, 4295, 119
https://tests.stockfishchess.org/tests/view/60cc7828457376eb8bcab4fa

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

Bench: 4758885
2021-06-18 21:29:14 +02:00
ap 14b673d90f New default net nn-3b20abec10c1.nnue
This net was created by @pleomati, who manually edited with an hex editor
10 values randomly chosen in the LCSFNet10 net (nn-6ad41a9207d0.nnue) to
create this one. The LCSFNet10 net was trained by Joost VandeVondele from
a dataset combining Stockfish games and Leela games (16x10^9 positions from
SF self-play at depth 9, and 6.3x10^9 positions from Leela games, so overall
72% of Stockfish positions and 28% of Leela positions).

passed STC 10+0.1:
LLR: 2.94 (-2.94,2.94) <-0.50,2.50>
Total: 50888 W: 5881 L: 5654 D: 39353
Ptnml(0-2): 281, 4290, 16085, 4497, 291
https://tests.stockfishchess.org/tests/view/60cbfa68457376eb8bcab49a

passed LTC 60+0.6:
LLR: 2.94 (-2.94,2.94) <0.50,3.50>
Total: 25480 W: 1498 L: 1338 D: 22644
Ptnml(0-2): 36, 1155, 10193, 1325, 31
https://tests.stockfishchess.org/tests/view/60cc4af8457376eb8bcab4d4

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

Bench: 4904930
2021-06-18 20:00:13 +02:00
Stéphane Nicolet 07c8448034 Revert "Fix for Cygwin's environment build-profile"
This reverts commit "Fix for Cygwin's environment build-profile", as it was
giving errors for "make clean" on some Windows environments. See comments in
68bf362ea2

Possibly somebody can propose a solution that would fix Cygwin builds and
not break on other system too, stay tuned! :-)

No functional change
2021-06-17 18:10:01 +02:00
bmc4 55e69dc88d Simplify reduction when best move doesn't change frequently.
STC:
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 40400 W: 3468 L: 3377 D: 33555
Ptnml(0-2): 134, 2734, 14388, 2795, 149
https://tests.stockfishchess.org/tests/view/60c93e5a457376eb8bcab15f

LTC:
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 34200 W: 1190 L: 1128 D: 31882
Ptnml(0-2): 22, 998, 15001, 1054, 25
https://tests.stockfishchess.org/tests/view/60c96a1a457376eb8bcab180

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

bench: 5629669
2021-06-17 02:08:33 +02:00
proukornew 68bf362ea2 Fix for Cygwin's environment build-profile
The Cygwin environment has two g++ compilers, each with a different problem
for compiling  Stockfish at the moment:

(a) g++.exe : full posix build compiler, linked to cygwin dll.

    => This one has a problem embedding the net.

(b) x86_64-w64-mingw32-g++.exe : native Windows build compiler.

    => This one manages to embed the net, but has a problem related to libgcov
       when we use the profile-build target of Stockfish.

This patch solves the problem for compiler (b), so that our recommended command line
if you want to build an optimized version of Stockfish on Cygwin becomes something
like the following (you can change the ARCH value to whatever you want, but note
the COMP and CXX variables pointing at the right compiler):

```
   make -j profile-build ARCH=x86-64-modern COMP=mingw CXX=x86_64-w64-mingw32-c++.exe
```

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

No functional change
2021-06-17 01:14:20 +02:00
Joost VandeVondele 8ec9e10866 New default net nn-33c9d39e5eb6.nnue
As the previous net, this net is trained on Leela games as provided by borg.
See also https://lczero.org/blog/2021/06/the-importance-of-open-data/

The particular data set, which is a mix of T60 and T74 data, is now available as a single binpack:
https://drive.google.com/file/d/1RFkQES3DpsiJqsOtUshENtzPfFgUmEff/view?usp=sharing

The training command was:
python train.py ../../training_data_pylon.binpack ../../training_data_pylon.binpack --gpus 1 --threads 2 --num-workers 2 --batch-size 16384 --progress_bar_refresh_rate 300 --smart-fen-skipping --random-fen-skipping 10 --features=HalfKAv2^   --lambda=1.0  --max_epochs=440 --seed $RANDOM --default_root_dir exp/run_2

passed STC:
https://tests.stockfishchess.org/tests/view/60c887cb457376eb8bcab054
LLR: 2.94 (-2.94,2.94) <-0.50,2.50>
Total: 12792 W: 1483 L: 1311 D: 9998
Ptnml(0-2): 62, 989, 4131, 1143, 71

passed LTC:
https://tests.stockfishchess.org/tests/view/60c8e5c4457376eb8bcab0f0
LLR: 2.95 (-2.94,2.94) <0.50,3.50>
Total: 11272 W: 601 L: 477 D: 10194
Ptnml(0-2): 9, 421, 4657, 535, 14

also had strong LTC performance against another strong net of the series:
https://tests.stockfishchess.org/tests/view/60c8c40d457376eb8bcab0c6

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

Bench: 5032320
2021-06-15 22:08:40 +02:00
J. Oster 4c4e104cad Fix a rare case of wrong TB ranking
of a root move leading to a 3-fold repetition.
With this small fix a draw ranking and thus a draw score is being applied.
This works for both, ranking by dtz or wdl tables.

Fixes https://github.com/official-stockfish/Stockfish/issues/3542

(No functional change without TBs.)
Bench: 4877339
2021-06-14 17:28:30 +02:00
Tomasz Sobczyk 900f249f59 Reduce the number of accumulator states
Reduce from 3 to 2. Make the intent of the states clearer.

STC: https://tests.stockfishchess.org/tests/view/60c50111457376eb8bcaad03
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 61888 W: 5007 L: 4944 D: 51937
Ptnml(0-2): 164, 3947, 22649, 4030, 154

LTC: https://tests.stockfishchess.org/tests/view/60c52b1c457376eb8bcaad2c
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 20248 W: 688 L: 618 D: 18942
Ptnml(0-2): 7, 551, 8946, 605, 15

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

No functional change.
2021-06-14 11:22:08 +02:00
JWmer f8c779dbe5 Update default net to nn-8e47cf062333.nnue
This net is the result of training on data used by the Leela project. More precisely,
we shuffled T60 and T74 data kindly provided by borg (for different Tnn, the data is
a result of Leela selfplay with differently sized Leela nets).

The data is available at vondele's google drive:
https://drive.google.com/drive/folders/1mftuzYdl9o6tBaceR3d_VBQIrgKJsFpl.

The Leela data comes in small chunks of .binpack files. To shuffle them, we simply
used a small python script to randomly rename the files, and then concatenated them
using `cat`. As validation data we picked a file of T60 data. We will further investigate
T74 data.

The training for the NNUE architecture used 200 epochs with the Python trainer from
the Stockfish project. Unlike the previous run we tried with this data, this run does
not have adjusted scaling — not because we didn't want to, but because we forgot.
However, this training randomly skips 40% more positions than previous run. The loss
was very spiky and decreased slower than it does usually.

Training loss: https://github.com/official-stockfish/images/blob/main/training-loss-8e47cf062333.png
Validation loss: https://github.com/official-stockfish/images/blob/main/validation-loss-8e47cf062333.png

This is the exact training command:
python train.py --smart-fen-skipping --random-fen-skipping 14 --batch-size 16384 --threads 4 --num-workers 4 --gpus 1 trainingdata\training_data.binpack validationdata\val.binpack

---

10k STC result:
ELO: 3.61 +-3.3 (95%) LOS: 98.4%
Total: 10000 W: 1241 L: 1137 D: 7622
Ptnml(0-2): 68, 841, 3086, 929, 76
https://tests.stockfishchess.org/tests/view/60c67e50457376eb8bcaae70

10k LTC result:
ELO: 2.71 +-2.4 (95%) LOS: 98.8%
Total: 10000 W: 659 L: 581 D: 8760
Ptnml(0-2): 22, 485, 3900, 579, 14
https://tests.stockfishchess.org/tests/view/60c69deb457376eb8bcaae98

Passed LTC:
LLR: 2.93 (-2.94,2.94) <0.50,3.50>
Total: 9648 W: 685 L: 545 D: 8418
Ptnml(0-2): 22, 448, 3740, 596, 18
https://tests.stockfishchess.org/tests/view/60c6d41c457376eb8bcaaecf

---

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

Bench: 4877339
2021-06-14 09:24:07 +02:00
Tomasz Sobczyk ce4c523ad3 Register count for feature transformer
Compute optimal register count for feature transformer accumulation dynamically.
This also introduces a change where AVX512 would only use 8 registers instead of 16
(now possible due to a 2x increase in feature transformer size).

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

No functional change
2021-06-13 13:10:56 +02:00
Vizvezdenec e1f181ee64 Do less LMR extensions
This patch restricts LMR extensions (of non-transposition table moves) from being
used when the transposition table move was extended by two plies via singular
extension. This may serve to limit search explosions in certain positions.

This makes a lot of sense because the precondition for the tt-move to have been
singular extended by two plies is that the result of the alternate search (with
excluded the tt-move) has been a hard fail low: it is natural to later search less
for non tt-moves in this situation.

The current state of depth/extensions/reductions management is getting quite tricky
in our search algo, see https://github.com/official-stockfish/Stockfish/pull/3546#issuecomment-860174549
for some discussion. Suggestions welcome!

Passed STC
https://tests.stockfishchess.org/tests/view/60c3f293457376eb8bcaac8d
LLR: 2.95 (-2.94,2.94) <-0.50,2.50>
Total: 117984 W: 9698 L: 9430 D: 98856
Ptnml(0-2): 315, 7708, 42703, 7926, 340

passed LTC
https://tests.stockfishchess.org/tests/view/60c46ea5457376eb8bcaacc7
LLR: 2.97 (-2.94,2.94) <0.50,3.50>
Total: 11280 W: 401 L: 302 D: 10577
Ptnml(0-2): 2, 271, 4998, 364, 5

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

Bench: 4709974
2021-06-13 12:00:20 +02:00
Stéphane Nicolet 7819412002 Clarify use of UCI options
Update README.md to clarify use of UCI options

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

No functional change
2021-06-13 10:02:43 +02:00
Tomasz Sobczyk b84fa04db6 Read NNUE net faster
Load feature transformer weights in bulk on little-endian machines.
This is in particular useful to test new nets with c-chess-cli,
see https://github.com/lucasart/c-chess-cli/issues/44

```
$ time ./stockfish.exe uci

Before : 0m0.914s
After  : 0m0.483s
```

No functional change
2021-06-13 09:39:03 +02:00
Joost VandeVondele 559942d64d Limit double extensions
Double extensions can lead to search explosions, for specific positions.
Currently, however, these double extensions are worth about 10Elo and cannot
be removed. This patch instead limits the number of double extensions given
to a maximum of 3.

This fixes https://github.com/official-stockfish/Stockfish/issues/3532
where the following testcase was shown to be problematic:

```
uci
setoption name Hash value 4
setoption name Contempt value 0
ucinewgame
position fen 8/Pk6/8/1p6/8/P1K5/8/6B1 w - - 37 130
go depth 20
```

passed STC:
https://tests.stockfishchess.org/tests/view/60c13161457376eb8bcaaa0f
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 73256 W: 6114 L: 6062 D: 61080
Ptnml(0-2): 222, 4912, 26306, 4968, 220

passed LTC:
https://tests.stockfishchess.org/tests/view/60c196fb457376eb8bcaaa6b
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 166440 W: 5559 L: 5594 D: 155287
Ptnml(0-2): 106, 4921, 73197, 4894, 102

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

Bench: 5067605
2021-06-11 20:33:24 +02:00
bmc4 785b708097 Simplify promotion move generator
This patch removes Knight promotion checks from Captures. As a consequence,
it also removes this underpromotion from qsearch.

STC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 37776 W: 3113 L: 3023 D: 31640
Ptnml(0-2): 103, 2419, 13755, 2507, 104
https://tests.stockfishchess.org/tests/view/60be6a06457376eb8bcaa775

LTC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 39760 W: 1257 L: 1203 D: 37300
Ptnml(0-2): 11, 1079, 17646, 1133, 11
https://tests.stockfishchess.org/tests/view/60beb972457376eb8bcaa7c5

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

Bench: 5530620
2021-06-08 20:16:20 +02:00
bmc4 999e142c54 Reduce in LMR reduction on PvNode
reduce reduction in LMR by 1 on PvNode.

STC:
LLR: 2.93 (-2.94,2.94) <-0.50,2.50>
Total: 266080 W: 22438 L: 21996 D: 221646
Ptnml(0-2): 774, 17874, 95376, 18168, 848
https://tests.stockfishchess.org/tests/view/60bc0661457376eb8bcaa4bb

LTC:
LLR: 2.93 (-2.94,2.94) <0.50,3.50>
Total: 20144 W: 698 L: 587 D: 18859
Ptnml(0-2): 2, 529, 8906, 626, 9
https://tests.stockfishchess.org/tests/view/60bcc3f2457376eb8bcaa58d

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

bench: 5173012
2021-06-06 21:22:39 +02:00
Guy Vreuls 3802cdf9b6 Makefile: Extend sanitize support
Enable compiling with multiple sanitizers at once.

Syntax:
make build ARCH=x86-64-avx512 debug=on sanitize="address undefined"

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

No functional change.
2021-06-05 11:38:28 +02:00
Guy Vreuls 58307562b6 Revert "Simplify En Passant"
This reverts commit 9f8058bd26.

Fixes the memory leak discussed in pull request #3523
https://github.com/official-stockfish/Stockfish/pull/3523

Passed non-regression STC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 76184 W: 6330 L: 6282 D: 63572
Ptnml(0-2): 202, 5047, 27564, 5059, 220
https://tests.stockfishchess.org/tests/view/60ba146c457376eb8bcaa2e2

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

Benched to verify there is no functional change.

Bench: 4364128
2021-06-05 10:47:46 +02:00
Stéphane Nicolet 8f081c86f7 Clean SIMD code a bit
Cleaner vector code structure in feature transformer. This patch just
regroups the parts of the inner loop for each SIMD instruction set.

Tested for non-regression:
LLR: 2.96 (-2.94,2.94) <-2.50,0.50>
Total: 115760 W: 9835 L: 9831 D: 96094
Ptnml(0-2): 326, 7776, 41715, 7694, 369
https://tests.stockfishchess.org/tests/view/60b96b39457376eb8bcaa26e

It would be nice if a future patch could use some of the macros at
the top of the file to unify the code between the distincts SIMD
instruction sets (of course, unifying the Relu will be the challenge).

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

No functional change
2021-06-04 14:07:46 +02:00
Stéphane Nicolet 4445965f97 Makefile: better "make clean" for Windows
Make clean should be really clean on Windows.

Fixes issue https://github.com/official-stockfish/Stockfish/issues/3291
Closes https://github.com/official-stockfish/Stockfish/pull/3517

No functional change
2021-06-04 01:32:11 +02:00
bmc4 0b7cc8bd2f Introducing NodeType Root
We transform rootNode into constexpr by adding a new NodeType `Root`,
which causes a speed up.

Local test:
```
Build Tester: 1.4.7.0
Windows 10 (Version 10.0, Build 0, 64-bit Edition)
Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
SafeMode: No
Running In VM: No
HyperThreading Enabled: Yes
CPU Warmup: Yes
Command Line: bench
Tests per Build: 25
ANOVA: n/a

                Engine# (NPS)                     Speedup     Sp     Conf. 95%    S.S.
patch  (920.179,4) ---> master  (906.329,2)  --->  1,528%  20.336,5     Yes        No
```

---------

STC:
LLR: 2.94 (-2.94,2.94) <-0.50,2.50>
Total: 98216 W: 8348 L: 8102 D: 81766
Ptnml(0-2): 295, 6357, 35549, 6621, 286
https://tests.stockfishchess.org/tests/view/60b797e2457376eb8bcaa0ab

Yellow LTC:
LLR: -2.95 (-2.94,2.94) <0.50,3.50>
Total: 76936 W: 2651 L: 2626 D: 71659
Ptnml(0-2): 29, 2233, 33916, 2264, 26
https://tests.stockfishchess.org/tests/view/60b80d6d457376eb8bcaa145

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

No functional change
2021-06-04 01:23:49 +02:00
xoto10 9353e72103 Make extra time for bestMoveInstability dependent on rootdepth.
This change allocates more base time to moves and makes the additional time added for best move instability dependent on rootdepth.

STC 10+0.1 :
LLR: 2.94 (-2.94,2.94) <-0.50,2.50>
Total: 19432 W: 1711 L: 1553 D: 16168
Ptnml(0-2): 47, 1250, 6989, 1358, 72
https://tests.stockfishchess.org/tests/view/60b8cd41457376eb8bcaa1ad

LTC 60+0.6 :
LLR: 2.93 (-2.94,2.94) <0.50,3.50>
Total: 22480 W: 810 L: 693 D: 20977
Ptnml(0-2): 9, 603, 9902, 714, 12
https://tests.stockfishchess.org/tests/view/60b8e5bf457376eb8bcaa1e6

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

Bench 4364128
2021-06-03 21:22:56 +02:00
Joost VandeVondele d53071eff4 Update default net to nn-7e66505906a6.nnue
Trained with pytorch using the master branch and recommended settings,
the data used is the previous 64B binpack enhanced with a 2B binpack
generated using an opening book of positions for with the static eval
is significantly different from d9 search.

book           : https://drive.google.com/file/d/1rHcKY5rv34kwku6g89OhnE8Bkfq3UWau/view?usp=sharing
book generation: 3ce43ab0c4
binpack        : https://drive.google.com/file/d/1rHcKY5rv34kwku6g89OhnE8Bkfq3UWau/view?usp=sharing

-------

Data generation command:

generate_training_data depth 9 count 31250000 random_multi_pv 2 random_multi_pv_diff 100 random_move_max_ply 8 random_move_count 3 set_recommended_uci_options eval_limit 32000 output_file_name output.binpack book wrongNNUE.epd seed ${RANDOM}${RANDOM}

Training command:

python train.py ../../all_d9_fishd9_d8_d10_wrong_shuffle.binpack ../../all_d9_fishd9_d8_d10_wrong_shuffle.binpack  --gpus 1 --threads 2 --num-workers 2 --batch-size 16384 --progress_bar_refresh_rate 300 --smart-fen-skipping --random-fen-skipping 3 --features=HalfKAv2^   --lambda=1.0  --max_epochs=400 --seed $RANDOM --default_root_dir exp/run_5

-------

passed STC:
https://tests.stockfishchess.org/tests/view/60b7c79a457376eb8bcaa104
LLR: 2.94 (-2.94,2.94) <-0.50,2.50>
Total: 64592 W: 6254 L: 6028 D: 52310
Ptnml(0-2): 255, 4785, 22020, 4951, 285

passed LTC:
https://tests.stockfishchess.org/tests/view/60b85307457376eb8bcaa182
LLR: 2.96 (-2.94,2.94) <0.50,3.50>
Total: 45560 W: 1998 L: 1826 D: 41736
Ptnml(0-2): 36, 1604, 19335, 1762, 43

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

Bench: 4364128
2021-06-03 16:25:44 +02:00
Stefan Geschwentner 95f73ff393 Remove formerPV variable.
STC:
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 75672 W: 6546 L: 6496 D: 62630
Ptnml(0-2): 238, 5274, 26761, 5326, 237
https://tests.stockfishchess.org/tests/view/60b349c0ec0c03148cbed055

LTC:
LLR: 2.98 (-2.94,2.94) <-2.50,0.50>
Total: 137816 W: 4676 L: 4689 D: 128451
Ptnml(0-2): 52, 4237, 60354, 4202, 63
https://tests.stockfishchess.org/tests/view/60b38970ec0c03148cbed075

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

Bench: 4892288
2021-06-01 23:21:00 +02:00
J. Oster 9fd5b44d60 Pre-initialize ss->ply
We pre-initialize ss->ply over the whole stack. There is no need
to re-assign the same value(s) over and over again while searching.
Probably a tiny speedup on longer searches.

Tested for no regression:

STC
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 25784 W: 2205 L: 2101 D: 21478
Ptnml(0-2): 62, 1660, 9368, 1716, 86
https://tests.stockfishchess.org/tests/view/60b516c6457376eb8bca9dfa

LTC
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 26200 W: 944 L: 878 D: 24378
Ptnml(0-2): 12, 732, 11545, 800, 11
https://tests.stockfishchess.org/tests/view/60b53652457376eb8bca9e0e

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

No functional change.
2021-06-01 21:25:28 +02:00
candirufish e8418bb1b9 Check Extension with Static Evaluation
extension for checking moves, at higher depth and more decisive positions.

stc:
LLR: 2.97 (-2.94,2.94) <-0.50,2.50>
Total: 87008 W: 7337 L: 7100 D: 72571
Ptnml(0-2): 264, 5737, 31270, 5964, 269
https://tests.stockfishchess.org/tests/view/60b1034787a1a67ae56c47b6

ltc:
LLR: 2.94 (-2.94,2.94) <0.50,3.50>
Total: 79320 W: 2629 L: 2432 D: 74259
Ptnml(0-2): 29, 2205, 35000, 2392, 34
https://tests.stockfishchess.org/tests/view/60b1ae0b87a1a67ae56c487c

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

Bench: 4447112
2021-05-31 18:31:32 +02:00
Tomasz Sobczyk 5448cad29e Fix export of the feature transformer.
PSQT export was missing.

fixes #3507

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

No functional change
2021-05-30 21:31:58 +02:00
Joost VandeVondele 4c02998325 Simplify NNUE / classical evaluation selection
for the new network architecture these rules can be simplified,
closer to the original PSQT difference based again.

passed STC
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 22656 W: 1979 L: 1868 D: 18809
Ptnml(0-2): 70, 1496, 8087, 1603, 72
https://tests.stockfishchess.org/tests/view/60b24579db3c4776cb89d122

passed LTC
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 30224 W: 1015 L: 953 D: 28256
Ptnml(0-2): 4, 860, 13330, 906, 12
https://tests.stockfishchess.org/tests/view/60b27613db3c4776cb89d145

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

Bench: 3937626
2021-05-30 21:30:15 +02:00
VoyagerOne 6174a37a37 Remove Stat Reset at beta cutoff
STC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 63936 W: 5350 L: 5288 D: 53298
Ptnml(0-2): 184, 4295, 22954, 4345, 190
https://tests.stockfishchess.org/tests/view/60affb4c12066fd299795c64

LTC:
LLR: 2.96 (-2.94,2.94) <-2.50,0.50>
Total: 35856 W: 1201 L: 1142 D: 33513
Ptnml(0-2): 7, 1031, 15795, 1086, 9
https://tests.stockfishchess.org/tests/view/60b0537812066fd299795cc6

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

bench: 3831936
2021-05-28 20:16:11 +02:00
Stéphane Nicolet f193778446 Do not use lazy evaluation inside NNUE
This simplification patch implements two changes:

1. it simplifies away the so-called "lazy" path in the NNUE evaluation internals,
   where we trusted the psqt head alone to avoid the costly "positional" head in
   some cases;
2. it raises a little bit the NNUEThreshold1 in evaluate.cpp (from 682 to 800),
   which increases the limit where we switched from NNUE eval to Classical eval.

Both effects increase the number of positional evaluations done by our new net
architecture, but the results of our tests below seem to indicate that the loss
of speed will be compensated by the gain of eval quality.

STC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 26280 W: 2244 L: 2137 D: 21899
Ptnml(0-2): 72, 1755, 9405, 1810, 98
https://tests.stockfishchess.org/tests/view/60ae73f112066fd299795a51

LTC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 20592 W: 750 L: 677 D: 19165
Ptnml(0-2): 9, 614, 8980, 681, 12
https://tests.stockfishchess.org/tests/view/60ae88e812066fd299795a82

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

Bench: 3817907
2021-05-27 01:21:56 +02:00
Stefan Geschwentner 1b325bf86d Less reduction for capture/promotions.
Exclude captures/promotions at expected cut nodes (which also not a
former PV node) from LMR if a response to the first previous
opponent move.

STC:
LLR: 2.93 (-2.94,2.94) <-0.50,2.50>
Total: 288656 W: 24886 L: 24413 D: 239357
Ptnml(0-2): 900, 19738, 102578, 20213, 899
https://tests.stockfishchess.org/tests/view/60ad505112066fd29979595b

LTC:
LLR: 2.97 (-2.94,2.94) <0.50,3.50>
Total: 31344 W: 1107 L: 975 D: 29262
Ptnml(0-2): 12, 879, 13757, 1013, 11
https://tests.stockfishchess.org/tests/view/60adffce12066fd2997959d2

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

Bench: 3827710
2021-05-26 17:32:54 +02:00
IIvec 83e0af288a Simplify the thread term for reduction formula
Dependance on Threads.size() was removed Search::init() for the Reductions[] initialization.

STC:
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 17376 W: 1024 L: 929 D: 15423
Ptnml(0-2): 24, 781, 6989, 864, 30
https://tests.stockfishchess.org/tests/view/60ac110812066fd2997957dc

LTC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 145552 W: 3656 L: 3673 D: 138223
Ptnml(0-2): 37, 3351, 66014, 3340, 34
https://tests.stockfishchess.org/tests/view/60ac267412066fd299795825

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

Bench 3864295
2021-05-26 17:25:05 +02:00
Tomasz Sobczyk 9d53129075 Expose the lazy threshold for the feature transformer PSQT as a parameter.
Definition of the lazy threshold moved to evaluate.cpp where all others are.
Lazy threshold only used for real searches, not used for the "eval" call.
This preserves the purity of NNUE evaluation, which is useful to verify
consistency between the engine and the NNUE trainer.

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

No functional change
2021-05-25 21:40:51 +02:00
bmc4 e044068b43 Increased reduction for captures in LMR
It now does, in LMR, an increased on reduction by 1 for captures in cut nodes.

STC:
LLR: 2.93 (-2.94,2.94) <-0.50,2.50>
Total: 30656 W: 2565 L: 2397 D: 25694
Ptnml(0-2): 63, 2012, 11029, 2142, 82
https://tests.stockfishchess.org/tests/view/60a96733ce8ea25a3ef04178

LTC:
LLR: 2.93 (-2.94,2.94) <0.50,3.50>
Total: 124840 W: 4139 L: 3878 D: 116823
Ptnml(0-2): 48, 3480, 55100, 3747, 45
https://tests.stockfishchess.org/tests/view/60a995f5ce8ea25a3ef041b7

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

bench: 3864295
2021-05-24 15:52:22 +02:00
Stéphane Nicolet a2f01c07eb Sometimes change the (materialist, positional) balance
Our new nets output two values for the side to move in the last layer.
We can interpret the first value as a material evaluation of the
position, and the second one as the dynamic, positional value of the
location of pieces.

This patch changes the balance for the (materialist, positional) parts
of the score from (128, 128) to (121, 135) when the piece material is
equal between the two players, but keeps the standard (128, 128) balance
when one player is at least an exchange up.

Passed STC:
LLR: 2.93 (-2.94,2.94) <-0.50,2.50>
Total: 15936 W: 1421 L: 1266 D: 13249
Ptnml(0-2): 37, 1037, 5694, 1134, 66
https://tests.stockfishchess.org/tests/view/60a82df9ce8ea25a3ef0408f

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,3.50>
Total: 13904 W: 516 L: 410 D: 12978
Ptnml(0-2): 4, 374, 6088, 484, 2
https://tests.stockfishchess.org/tests/view/60a8bbf9ce8ea25a3ef04101

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

Bench: 3856635
2021-05-22 21:09:22 +02:00
bmc4 ff4c22238a Tuning Search
This patch tunes constant in search.cpp

STC:
LLR: 2.94 (-2.94,2.94) <-0.50,2.50>
Total: 30648 W: 2580 L: 2410 D: 25658
Ptnml(0-2): 80, 1969, 11093, 2065, 117
https://tests.stockfishchess.org/tests/view/60a71d3cce8ea25a3ef03fae

LTC:
LLR: 2.95 (-2.94,2.94) <0.50,3.50>
Total: 52896 W: 1776 L: 1617 D: 49503
Ptnml(0-2): 13, 1462, 23347, 1605, 21
https://tests.stockfishchess.org/tests/view/60a794ddce8ea25a3ef0400a

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

Bench: 4004731
2021-05-22 19:23:15 +02:00
bmc4 49c79aa15c Simplify reduction for consecutive fails
Revert the heuristic introduced in #3184, by which we reduced more
the late sons of the root position after consecutive fail highs.

---
Before new net architecture:

STC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 226336 W: 20373 L: 20500 D: 185463
Ptnml(0-2): 755, 16087, 79595, 15992, 739
https://tests.stockfishchess.org/tests/view/609dec205085663412d08e9d

LTC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 67432 W: 2411 L: 2375 D: 62646
Ptnml(0-2): 33, 1944, 29714, 2004, 21
https://tests.stockfishchess.org/tests/view/609ee30f5085663412d08fc3

---
After new net architecture:

STC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 141752 W: 11591 L: 11617 D: 118544
Ptnml(0-2): 387, 9231, 51674, 9189, 395
https://tests.stockfishchess.org/tests/view/60a4320ace8ea25a3ef03cfd

LTC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 294072 W: 9825 L: 9950 D: 274297
Ptnml(0-2): 121, 8610, 129681, 8521, 103
https://tests.stockfishchess.org/tests/view/60a51b5ece8ea25a3ef03dcd
---

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

Bench: 3752892
2021-05-22 19:02:36 +02:00
Joost VandeVondele fb2d175f97 Update default net to nn-7756374aaed3.nnue
trained with pytorch using the master branch and recommended settings,
same data set as previously used:

python train.py ../../all_d9_fishd9_d8_d10_shuffle.binpack ../../all_d9_fishd9_d8_d10_shuffle.binpack \
        --gpus 1 --threads 2 --num-workers 2 --batch-size 16384 --progress_bar_refresh_rate 300 \
        --smart-fen-skipping --random-fen-skipping 3 --features=HalfKAv2^   --lambda=1.0 \
        --max_epochs=400 --seed $RANDOM --default_root_dir exp/run_8

passed STC:
LLR: 2.93 (-2.94,2.94) <-0.50,2.50>
Total: 21424 W: 2078 L: 1907 D: 17439
Ptnml(0-2): 80, 1512, 7385, 1627, 108
https://tests.stockfishchess.org/tests/view/60a6c749ce8ea25a3ef03f4d

passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,3.50>
Total: 67912 W: 2851 L: 2648 D: 62413
Ptnml(0-2): 40, 2348, 28984, 2537, 47
https://tests.stockfishchess.org/tests/view/60a722ecce8ea25a3ef03fb9

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

Bench: 3779522
2021-05-22 07:35:39 +02:00
Guy Vreuls f233ca1af4 Compact position structures
Reorder the structures data members in position.h to reduce padding.

Passed STC:
https://tests.stockfishchess.org/tests/view/60a8011fce8ea25a3ef04069
LLR: 2.94 (-2.94,2.94) <-0.50,2.50>
Total: 14120 W: 1214 L: 1067 D: 11839
Ptnml(0-2): 26, 857, 5161, 976, 40

---

Also tested for speed locally by Joost:

Result of  50 runs
==================
base (./stockfish.master       ) =    2254919  +/- 4439
test (./stockfish.patch        ) =    2274003  +/- 5278
diff                             =     +19084  +/- 6386
==================
speedup        = +0.0085
P(speedup > 0) =  1.0000

---

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

No functional change.
2021-05-22 00:26:00 +02:00
Stéphane Nicolet 754fc8a8b5 Remove Tempo
The Tempo variable was introduced 10 years ago in our search because the
classical evaluation function was antisymmetrical in White and Black by design
to gain speed:

    Eval(White to play) = -Eval(Black to play)

Nowadays our neural networks know which side is to play in a position when
they evaluate a position and are trained on real games, so the neural network
encodes the advantage of moving as an output of search. This patch shows that
the Tempo variable is not necessary anymore.

STC:
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 33512 W: 2805 L: 2709 D: 27998
Ptnml(0-2): 80, 2209, 12095, 2279, 93
https://tests.stockfishchess.org/tests/view/60a44ceace8ea25a3ef03d30

LTC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 53920 W: 1807 L: 1760 D: 50353
Ptnml(0-2): 16, 1617, 23650, 1658, 19
https://tests.stockfishchess.org/tests/view/60a477f0ce8ea25a3ef03d49

We also tried a match (20000 games) at STC using purely classical, result was neutral:
https://tests.stockfishchess.org/tests/view/60a4eebcce8ea25a3ef03db5

Note: there are two locations left in search.cpp where we assume antisymmetry
of evaluation (in relation with a speed optimization for null moves in lines
770 and 1439), but as the values are just used for heuristic pruning this
approximation should not hurt too much because the order of magnitude is still
true most of the time.

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

Bench: 4015864
2021-05-19 20:34:37 +02:00
Vizvezdenec 2c3f7619f9 Simplify usage of LMR for captures
This patch simplifies a lot of "enablers" for LMR when move is a capture or promotion.
After it we will have only 2 conditions - if node is a cutNode
or if it's an allNode that was not in PV,
so all captures or promotions wouldn't go thru LMR at any PVnodes.

passed STC
https://tests.stockfishchess.org/tests/view/60a40117ce8ea25a3ef03ca7
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 58976 W: 4875 L: 4807 D: 49294
Ptnml(0-2): 176, 3897, 21270, 3973, 172

passed LTC
https://tests.stockfishchess.org/tests/view/60a43ff8ce8ea25a3ef03d18
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 65272 W: 2203 L: 2165 D: 60904
Ptnml(0-2): 28, 1936, 28668, 1978, 26

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

bench 4110764
2021-05-19 20:08:51 +02:00
Prokop Randáček 6b9a70ace8 Use if instead of goto
This PR inverts the if and removes goto in the generate_all function.

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

No functional change
2021-05-19 19:38:44 +02:00
Fanael Linithien 038487f954 Use packed 32-bit MMX operations for updating the PSQT accumulator
This improves the speed of NNUE by a bit on old hardware that code path
is intended for, like a Pentium III 1.13 GHz:

10 repeats of "./stockfish bench 16 1 13 default depth NNUE":

Before:
54 642 504 897 cycles (± 0.12%)
62 301 937 829 instructions (± 0.03%)

After:
54 320 821 928 cycles (± 0.13%)
62 084 742 699 instructions (± 0.02%)

Speed of go depth 20 from startpos:

Before: 53103 nps
After: 53856 nps

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

No functional change.
2021-05-19 19:34:44 +02:00
Vizvezdenec d37de3cb1d Do more continuation history based pruning
This patch increases lmrDepth threshold for continuation history based pruning in search.
This part of code for a long time was known to be really TC sensitive - decreasing
this threshold easily passed lower time controls but failed badly at LTC,
on the other hand it increase was part of a tuning that resulted
in being negative at STC but was +12 elo at 180+1.8.

After recent simplification of special conditions that sometimes
increase it from 4 to 5 it was logical to overall test at longer
time controls if 5 is better than 4 with deeper searches.

reduces strenght on STC
https://tests.stockfishchess.org/tests/view/60a3a8bbce8ea25a3ef03c74
ELO: -2.57 +-2.0 (95%) LOS: 0.6%
Total: 20000 W: 1820 L: 1968 D: 16212
Ptnml(0-2): 68, 1582, 6836, 1458, 56

Passed LTC with STC bounds
https://tests.stockfishchess.org/tests/view/60a027395085663412d090ce
LLR: 2.93 (-2.94,2.94) <-0.50,2.50>
Total: 175256 W: 6774 L: 6548 D: 161934
Ptnml(0-2): 91, 5808, 75604, 6034, 91

Passed VLTC with LTC bounds
https://tests.stockfishchess.org/tests/view/60a2bccce229097940a037a7
LLR: 2.96 (-2.94,2.94) <0.50,3.50>
Total: 65736 W: 1224 L: 1092 D: 63420
Ptnml(0-2): 5, 1012, 30706, 1136, 9

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

bench 3689330
2021-05-19 19:34:37 +02:00
Tomasz Sobczyk e8d64af123 New NNUE architecture and net
Introduces a new NNUE network architecture and associated network parameters,
as obtained by a new pytorch trainer.

The network is already very strong at short TC, without regression at longer TC,
and has potential for further improvements.

https://tests.stockfishchess.org/tests/view/60a159c65085663412d0921d
TC: 10s+0.1s, 1 thread
ELO: 21.74 +-3.4 (95%) LOS: 100.0%
Total: 10000 W: 1559 L: 934 D: 7507
Ptnml(0-2): 38, 701, 2972, 1176, 113

https://tests.stockfishchess.org/tests/view/60a187005085663412d0925b
TC: 60s+0.6s, 1 thread
ELO: 5.85 +-1.7 (95%) LOS: 100.0%
Total: 20000 W: 1381 L: 1044 D: 17575
Ptnml(0-2): 27, 885, 7864, 1172, 52

https://tests.stockfishchess.org/tests/view/60a2beede229097940a03806
TC: 20s+0.2s, 8 threads
LLR: 2.93 (-2.94,2.94) <0.50,3.50>
Total: 34272 W: 1610 L: 1452 D: 31210
Ptnml(0-2): 30, 1285, 14350, 1439, 32

https://tests.stockfishchess.org/tests/view/60a2d687e229097940a03c72
TC: 60s+0.6s, 8 threads
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 45544 W: 1262 L: 1214 D: 43068
Ptnml(0-2): 12, 1129, 20442, 1177, 12

The network has been trained (by vondele) using the https://github.com/glinscott/nnue-pytorch/ trainer (started by glinscott),
specifically the branch https://github.com/Sopel97/nnue-pytorch/tree/experiment_56.
The data used are in 64 billion positions (193GB total) generated and scored with the current master net
d8: https://drive.google.com/file/d/1hOOYSDKgOOp38ZmD0N4DV82TOLHzjUiF/view?usp=sharing
d9: https://drive.google.com/file/d/1VlhnHL8f-20AXhGkILujnNXHwy9T-MQw/view?usp=sharing
d10: https://drive.google.com/file/d/1ZC5upzBYMmMj1gMYCkt6rCxQG0GnO3Kk/view?usp=sharing
fishtest_d9: https://drive.google.com/file/d/1GQHt0oNgKaHazwJFTRbXhlCN3FbUedFq/view?usp=sharing

This network also contains a few architectural changes with respect to the current master:

    Size changed from 256x2-32-32-1 to 512x2-16-32-1
        ~15-20% slower
        ~2x larger
        adds a special path for 16 valued ClippedReLU
        fixes affine transform code for 16 inputs/outputs, buy using InputDimensions instead of PaddedInputDimensions
            this is safe now because the inputs are processed in groups of 4 in the current affine transform code
    The feature set changed from HalfKP to HalfKAv2
        Includes information about the kings like HalfKA
        Packs king features better, resulting in 8% size reduction compared to HalfKA
    The board is flipped for the black's perspective, instead of rotated like in the current master
    PSQT values for each feature
        the feature transformer now outputs a part that is fowarded directly to the output and allows learning piece values more directly than the previous network architecture. The effect is visible for high imbalance positions, where the current master network outputs evaluations skewed towards zero.
        8 PSQT values per feature, chosen based on (popcount(pos.pieces()) - 1) / 4
        initialized to classical material values on the start of the training
    8 subnetworks (512x2->16->32->1), chosen based on (popcount(pos.pieces()) - 1) / 4
        only one subnetwork is evaluated for any position, no or marginal speed loss

A diagram of the network is available: https://user-images.githubusercontent.com/8037982/118656988-553a1700-b7eb-11eb-82ef-56a11cbebbf2.png
A more complete description: https://github.com/glinscott/nnue-pytorch/blob/master/docs/nnue.md

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

Bench: 3806488
2021-05-18 18:06:23 +02:00
Stéphane Nicolet f90274d8ce Small clean-ups
- Comment for Countemove pruning -> Continuation history
- Fix comment in input_slice.h
- Shorter lines in Makefile
- Comment for scale factor
- Fix comment for pinners in see_ge()
- Change Thread.id() signature to size_t
- Trailing space in reprosearch.sh
- Add Douglas Matos Gomes to the AUTHORS file
- Introduce comment for undo_null_move()
- Use Stockfish coding style for export_net()
- Change date in AUTHORS file

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

No functional change
2021-05-17 10:47:14 +02:00
Vizvezdenec 61e1c66b7c Simplification for countermoves based pruning
Simplify away two extra conditions in countermoves based pruning.
These conditions (both of them) were introduced quite a long time ago
via speculative LTCs and seem to no longer bring any benefit.

passed STC
https://tests.stockfishchess.org/tests/view/609e81f35085663412d08f31
LLR: 2.96 (-2.94,2.94) <-2.50,0.50>
Total: 28488 W: 2487 L: 2382 D: 23619
Ptnml(0-2): 87, 1919, 10123, 2032, 83

passed LTC
https://tests.stockfishchess.org/tests/view/609e9c085085663412d08f59
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 33176 W: 1219 L: 1155 D: 30802
Ptnml(0-2): 13, 1036, 14423, 1106, 10

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

Bench: 4749514
2021-05-15 10:29:39 +02:00
bmc4 c82f6f56a6 Simplify LMR rules for statScore
We simplify two parts of LMR which seem not to bring strength anymore.

---

Individual Tests:
https://tests.stockfishchess.org/tests/view/609d1cc15085663412d0856a
https://tests.stockfishchess.org/tests/view/609cb0cc7746e3dc74ffae8d
https://tests.stockfishchess.org/tests/view/609d1c9f5085663412d08568

---

LTC:
LLR: 2.97 (-2.94,2.94) <-2.50,0.50>
Total: 84184 W: 3093 L: 3066 D: 78025
Ptnml(0-2): 47, 2755, 36458, 2788, 44
https://tests.stockfishchess.org/tests/view/609d84615085663412d08e2f

---

While at it, we also update the Elo estimate of the previous rule in LMR, see:
https://tests.stockfishchess.org/tests/view/609a933c3a33eb67a844f7ca
https://tests.stockfishchess.org/tests/view/609a959c3a33eb67a844f7d5
https://tests.stockfishchess.org/tests/view/609afff73a33eb67a844f870

---

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

Bench: 4156523
2021-05-15 10:16:01 +02:00
bmc4 24b8b3098b Remove early return in Probcut code
We simplify away early return in ProbCut, as it seems not to bring any strength anymore.

STC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 42632 W: 3705 L: 3617 D: 35310
Ptnml(0-2): 123, 2947, 15110, 2991, 145
https://tests.stockfishchess.org/tests/view/609c49da7746e3dc74ffae02

LTC:
LLR: 2.96 (-2.94,2.94) <-2.50,0.50>
Total: 35384 W: 1314 L: 1251 D: 32819
Ptnml(0-2): 11, 1130, 15355, 1177, 19
https://tests.stockfishchess.org/tests/view/609c71467746e3dc74ffae47

---

While at it, we also update the Elo estimate of ProbCut
(see https://tests.stockfishchess.org/tests/view/609bfb597746e3dc74ffabe3).

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

bench: 3764662
2021-05-15 10:07:40 +02:00
Unai Corzo bd756ee45c Remove BoolConditions from tuning code
Remove BoolConditions from tuning code, as the feature does not work
and the code has not be touched in years.

No functional change
2021-05-15 09:40:40 +02:00
bmc4 594e2ac999 Simplify LMR rule for non-checking captures
We simplify away the complicated rule in LMR for "non-checking captures
likely to be bad", as it seems not to bring any strength anymore.

STC:
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 55256 W: 4972 L: 4897 D: 45387
Ptnml(0-2): 177, 3976, 19234, 4077, 164
https://tests.stockfishchess.org/tests/view/609adf3b3a33eb67a844f842

LTC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 10344 W: 437 L: 353 D: 9554
Ptnml(0-2): 1, 322, 4449, 392, 8
https://tests.stockfishchess.org/tests/view/609b3dfa3a33eb67a844f88e

--

While at it, we also update the Elo estimate of the previous rule in LMR
(see https://tests.stockfishchess.org/tests/view/609af2a63a33eb67a844f867).

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

Bench: 3840688
2021-05-12 17:13:52 +02:00
EntityFX b62af7ac1e E2K: added support for MCST Elbrus 2000 CPU architecture
e2k (Elbrus 2000) - this is a VLIW/EPIC architecture,
the like Intel Itanium (IA-64) architecture.
The architecture has half native / half software support
for most Intel/AMD SIMD (e.g. MMX/SSE/SSE2/SSE3/SSSE3/SSE4.1/SSE4.2/AES/AVX/AVX2 & 3DNow!/SSE4a/XOP/FMA4) via intrinsics.

https://en.wikipedia.org/wiki/Elbrus_2000

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

No functional change
2021-05-11 19:45:14 +02:00
bmc4 a0e2debe3f Remove coordination between searching threads
In summary, this revert #2204, as it seems not to bring any strength anymore, so it's no long needed.

STC (5+0.05 @ 8 threads):
LLR: 2.96 (-2.94,2.94) <-2.50,0.50>
Total: 105728 W: 6406 L: 6393 D: 92929
Ptnml(0-2): 154, 5479, 41599, 5464, 168
https://tests.stockfishchess.org/tests/view/6096994095e7f1852abd3154

LTC (20+0.2 @ 8 threads):
LLR: 2.96 (-2.94,2.94) <-2.50,0.50>
Total: 26336 W: 774 L: 712 D: 24850
Ptnml(0-2): 9, 641, 11810, 695, 13
https://tests.stockfishchess.org/tests/view/6097c62995e7f1852abd31e8

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

No functional change.
2021-05-11 19:41:44 +02:00
bmc4 602687801b Simplify LMR
as it seems not to bring any strength and thus is no longer needed.

Tests for updating elo estimates:
https://tests.stockfishchess.org/tests/view/6099ff123a33eb67a844f789
https://tests.stockfishchess.org/tests/view/60953e6695e7f1852abd305b

Individual simplification tests:
https://tests.stockfishchess.org/tests/view/6098cfc73a33eb67a844f6a1
https://tests.stockfishchess.org/tests/view/6095539495e7f1852abd308b

LTC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 96984 W: 3624 L: 3608 D: 89752
Ptnml(0-2): 45, 3222, 41939, 3244, 42
https://tests.stockfishchess.org/tests/view/6099921a3a33eb67a844f74f

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

bench: 3836428
2021-05-11 19:37:39 +02:00
Tomasz Sobczyk 58054fd0fa Exporting the currently loaded network file
This PR adds an ability to export any currently loaded network.
The export_net command now takes an optional filename parameter.
If the loaded net is not the embedded net the filename parameter is required.

Two changes were required to support this:

* the "architecture" string, which is really just a some kind of description in the net, is now saved into netDescription on load and correctly saved on export.
* the AffineTransform scrambles weights for some architectures and sparsifies them, such that retrieving the index is hard. This is solved by having a temporary scrambled<->unscrambled index lookup table when loading the network, and the actual index is saved for each individual weight that makes it to canSaturate16. This increases the size of the canSaturate16 entries by 6 bytes.

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

No functional change
2021-05-11 19:36:11 +02:00
Vizvezdenec d777ea79ff Cleanup of likelyFailLow logic
This patch broadens and simplifies definition of PvNode that is likely to fail low.
New definition can be described as following "If node was already researched
at depth >= current depth and failed low there" which is more logical than the
previous version and takes less space + allows to not recompute it every time during move loop.

Passed simplification STC
https://tests.stockfishchess.org/tests/view/609148bf95e7f1852abd2e82
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 20128 W: 1865 L: 1751 D: 16512
Ptnml(0-2): 63, 1334, 7165, 1430, 72

Passed simplification LTC
https://tests.stockfishchess.org/tests/view/6091691295e7f1852abd2e8b
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 95128 W: 3498 L: 3481 D: 88149
Ptnml(0-2): 41, 2956, 41549, 2981, 37

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

Bench: 3933037
2021-05-07 09:47:17 +02:00
Tomasz Sobczyk ca250e969c Add an UCI level command "export_net".
This command writes the embedded net to the file `EvalFileDefaultName`.
If there is no embedded net the command does nothing.

fixes #3453

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

No functional change
2021-05-07 09:45:08 +02:00
Unai Corzo b1c8840f10 Simplify check extension
Simplify check extension, as it seems not to bring any strength and thus is no longer needed.

STC https://tests.stockfishchess.org/tests/view/608c18e995e7f1852abd2b81
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 54544 W: 4891 L: 4815 D: 44838
Ptnml(0-2): 186, 3889, 19081, 3895, 221

LTC https://tests.stockfishchess.org/tests/view/608c6ab195e7f1852abd2bc6
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 51008 W: 1845 L: 1794 D: 47369
Ptnml(0-2): 31, 1591, 22206, 1648, 28

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

bench: 3993071
2021-05-02 17:48:57 +02:00
xoto10 6ad4f485d3 Change tempo with time and threads
Introduce variable tempo for nnue depending on logarithm of estimated
strength, where strength is the product of time and number of threads.

The original idea here was that NNUE is best with a slightly different
tempo value to classical, since its style of play is slightly different.
It turns out that the best tempo for NNUE varies with strength of play,
so a formula is used which gives about 19 for STC and 24 for LTC under
current fishtest settings.

STC 10+0.1:
LLR: 2.94 (-2.94,2.94) {-0.20,1.10}
Total: 120816 W: 11155 L: 10861 D: 98800
Ptnml(0-2): 406, 8728, 41933, 8848, 493
https://tests.stockfishchess.org/tests/view/60735b3a8141753378960534

LTC 60+0.6:
LLR: 2.94 (-2.94,2.94) {0.20,0.90}
Total: 35688 W: 1392 L: 1234 D: 33062
Ptnml(0-2): 23, 1079, 15473, 1255, 14
https://tests.stockfishchess.org/tests/view/6073ffbc814175337896057f

Passed non-regression SMP test at LTC 20+0.2 (8 threads):
LLR: 2.95 (-2.94,2.94) {-0.70,0.20}
Total: 11008 W: 317 L: 267 D: 10424
Ptnml(0-2): 2, 245, 4962, 291, 4
https://tests.stockfishchess.org/tests/view/60749ea881417533789605a4

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

Bench 4075325
2021-04-28 13:58:46 +02:00
bmc4 84b42b3ab3 Simplify pawn moves generator
This patch simplifies QUIET_CHECKS pawn move generator by merging discovery check
move generator with direct check move generator. It also simplifies emptySquares
instantiation. In addition, I added a comment in generate_moves() to clarify Check
branches.

STC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 112648 W: 9952 L: 9945 D: 92751
Ptnml(0-2): 369, 7682, 40195, 7729, 349
https://tests.stockfishchess.org/tests/view/6088226895e7f1852abd2978

LTC:
LLR: 2.93 (-2.94,2.94) <-2.50,0.50>
Total: 74656 W: 2797 L: 2765 D: 69094
Ptnml(0-2): 38, 2328, 32554, 2380, 28
https://tests.stockfishchess.org/tests/view/60884e5095e7f1852abd2994

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

No functional change
2021-04-28 13:38:28 +02:00
lonfom169 33a858eaa1 More extensions if SE search is very low.
More extensions for non-PV nodes if value from singular extension search is significantly below singularBeta.

Passed STC:
LLR: 2.97 (-2.94,2.94) <-0.50,2.50>
Total: 25064 W: 2334 L: 2162 D: 20568
Ptnml(0-2): 82, 1720, 8768, 1868, 94
https://tests.stockfishchess.org/tests/view/6084ba7995e7f1852abd27e3

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,3.50>
Total: 67136 W: 2644 L: 2450 D: 62042
Ptnml(0-2): 46, 2134, 28990, 2376, 22
https://tests.stockfishchess.org/tests/view/6084d79195e7f1852abd27ee

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

Bench: 4075325
2021-04-25 13:26:22 +02:00
Stefan Geschwentner c0ff241464 Thread based reduction tweak.
For PV nodes at the first two plies no reductions are done for each fourth thread.

STC (8 threads):
LLR: 2.94 (-2.94,2.94) <-0.50,2.50>
Total: 53992 W: 3334 L: 3167 D: 47491
Ptnml(0-2): 64, 2713, 21285, 2860, 74
https://tests.stockfishchess.org/tests/view/6083b2d695e7f1852abd277a

LTC (8 threads):
LLR: 2.93 (-2.94,2.94) <0.50,3.50>
Total: 64888 W: 1888 L: 1725 D: 61275
Ptnml(0-2): 14, 1556, 29146, 1709, 19
https://tests.stockfishchess.org/tests/view/6084249595e7f1852abd2795

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

No functional change (for one thread)
2021-04-25 13:21:57 +02:00
Tomasz Sobczyk b748b46714 Cleanup and simplify NNUE code.
A lot of optimizations happend since the NNUE was introduced
and since then some parts of the code were left unused. This
got to the point where asserts were have to be made just to
let people know that modifying something will not have any
effects or may even break everything due to the assumptions
being made. Removing these parts removes those inexisting
"false dependencies". Additionally:

 * append_changed_indices now takes the king pos and stateinfo
   explicitly, no more misleading pos parameter
 * IndexList is removed in favor of a generic ValueList.
   Feature transformer just instantiates the type it needs.
 * The update cost and refresh requirement is deferred to the
   feature set once again, but now doesn't go through the whole
   FeatureSet machinery and just calls HalfKP directly.
 * accumulator no longer has a singular dimension.
 * The PS constants and the PieceSquareIndex array are made local
   to the HalfKP feature set because they are specific to it and
   DO differ for other feature sets.
 * A few names are changed to more descriptive

Passed STC non-regression:
https://tests.stockfishchess.org/tests/view/608421dd95e7f1852abd2790
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 180008 W: 16186 L: 16258 D: 147564
Ptnml(0-2): 587, 12593, 63725, 12503, 596

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

No functional change
2021-04-25 13:16:30 +02:00
bmc4 32d781769d Merge all move generators
Merging `generate<EVASIONS>` and `generate<QUIET_CHECKS>` into `generate_all()`.

verified to yield correct perft results, even though bench changes due to different order of generated moves.

No regresion playing games:

passed STC:
LLR: 2.94 (-2.94,2.94) {-1.00,0.20}
Total: 161800 W: 14585 L: 14624 D: 132591
Ptnml(0-2): 577, 11681, 56451, 11586, 605
https://tests.stockfishchess.org/tests/view/606532732b2df919fd5f026d

passed LTC:
LLR: 2.98 (-2.94,2.94) {-0.70,0.20}
Total: 188504 W: 6906 L: 6961 D: 174637
Ptnml(0-2): 87, 6272, 81610, 6175, 108
https://tests.stockfishchess.org/tests/view/6065b0772b2df919fd5f02ae

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

Bench: 4536129
2021-04-24 12:55:33 +02:00
Tomasz Sobczyk fbbd4adc3c Unify naming convention of the NNUE code
matches the rest of the stockfish code base

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

No functional change
2021-04-24 12:49:29 +02:00
dsmsgms a7ab92ec25 Use classical eval for Bishop vs Pawns
NNUE evaluation is incapable of recognizing trivially drawn bishop endgames
(the wrong-colored rook pawn), which are in fact ubiquitous and stock standard
in chess analysis. Switching off NNUE evaluation in KBPs vs KPs endgames is
a measure that stops Stockfish from trading down to a drawn version of these
endings when we presumably have advantage. The patch is able to edge over master
in endgame positions.

Patch tested for Elo gain with the "endgame.epd" book, and verified for
non-regression with our usual book (see the pull request for details).

STC:
LLR: 2.93 (-2.94,2.94) {-0.20,1.10}
Total: 33232 W: 6655 L: 6497 D: 20080
Ptnml(0-2): 4, 2342, 11769, 2494, 7
https://tests.stockfishchess.org/tests/view/6074a52981417533789605b8

LTC:
LLR: 2.93 (-2.94,2.94) {0.20,0.90}
Total: 159056 W: 29799 L: 29378 D: 99879
Ptnml(0-2): 7, 9004, 61085, 9425, 7
https://tests.stockfishchess.org/tests/view/6074c39a81417533789605ca

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

Bench: 4503918

blah
2021-04-15 12:45:39 +02:00
Tomasz Sobczyk 255514fb29 Documentation patch: AppendChangedIndices
Clarify the assumptions on the position passed to the AppendChangedIndices().

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

No functional change
2021-04-15 12:21:30 +02:00
Vizvezdenec 14d162d9f4 Simplification: last capture extension
The code for last capture extension can be removed in current master.

Passed STC
LLR: 2.95 (-2.94,2.94) {-1.00,0.20}
Total: 85024 W: 7754 L: 7707 D: 69563
Ptnml(0-2): 293, 5991, 29914, 6004, 310
https://tests.stockfishchess.org/tests/view/607690f1814175337896068f

Passed LTC
LLR: 2.96 (-2.94,2.94) {-0.70,0.20}
Total: 39880 W: 1503 L: 1453 D: 36924
Ptnml(0-2): 17, 1281, 17293, 1333, 16
https://tests.stockfishchess.org/tests/view/6076ccbe814175337896069e

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

Bench: 4202264
2021-04-15 11:41:30 +02:00
Stéphane Nicolet 4889cf22bb Revert previous patch
Revert the previous patch about move generation, as it unexpectedly
changed the bench. Better to take the time to understand the issue.

Bench: 4191632
2021-04-15 11:19:44 +02:00
bmc4 79bb28281c Merge all move generators
Merging `generate<EVASIONS>` and `generate<QUIET_CHECKS>` into `generate_all()`.

STC:
LLR: 2.94 (-2.94,2.94) {-1.00,0.20}
Total: 161800 W: 14585 L: 14624 D: 132591
Ptnml(0-2): 577, 11681, 56451, 11586, 605
https://tests.stockfishchess.org/tests/view/606532732b2df919fd5f026d

LTC:
LLR: 2.98 (-2.94,2.94) {-0.70,0.20}
Total: 188504 W: 6906 L: 6961 D: 174637
Ptnml(0-2): 87, 6272, 81610, 6175, 108
https://tests.stockfishchess.org/tests/view/6065b0772b2df919fd5f02ae

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

Verified for correctness of `EVASIONS` by running perft:
```
./stockfish b3nch 16 1 6 default perft          (replace 3 by e in b3nch)
Nodes searched  : 71608931810
```

Also tested for correctness on Chess960 with a similar code shown here:
https://github.com/official-stockfish/Stockfish/pull/3418#issuecomment-816630295

```
./stockfish b3nch 16 1 6 fischer.txt perft
Nodes searched  : 506736009395
```

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

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

No functional change
2021-04-15 10:53:51 +02:00
Vizvezdenec 3dfda1b28e Replace distanceFromPv with a better logic
This patch removes the recently introduced distanceFromPv logic, and replaces
it with following logic: if reduction of moves with low movecount is really
negative, we search them deeper than the first move.

passed STC:
LLR: 2.95 (-2.94,2.94) {-0.20,1.10}
Total: 153008 W: 13913 L: 13579 D: 125516
Ptnml(0-2): 547, 10811, 53470, 11113, 563
https://tests.stockfishchess.org/tests/view/6069c9d02b2df919fd5f04d2

passed LTC:
LLR: 2.94 (-2.94,2.94) {0.20,0.90}
Total: 101920 W: 3964 L: 3699 D: 94257
Ptnml(0-2): 55, 3279, 44019, 3560, 47
https://tests.stockfishchess.org/tests/view/606a99fd2b2df919fd5f0532

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

Bench: 4191632
2021-04-06 18:23:35 +02:00
Stéphane Nicolet f40913f7f6 Keep more pawns
This patch increases the weight of pawns in the scale factor applied
to the output of the NNUE evaluation. This has the effect that Stockfish
will try a little bit harder to keep more pawns in position where the
engine has the advantage, and exchange more pawns in bad positions.

STC:
LLR: 2.93 (-2.94,2.94) {-0.20,1.10}
Total: 42552 W: 3858 L: 3668 D: 35026
Ptnml(0-2): 152, 2956, 14876, 3134, 158
https://tests.stockfishchess.org/tests/view/606a06dd2b2df919fd5f0504

LTC:
LLR: 2.95 (-2.94,2.94) {0.20,0.90}
Total: 44328 W: 1703 L: 1531 D: 41094
Ptnml(0-2): 20, 1373, 19207, 1543, 21
https://tests.stockfishchess.org/tests/view/606aa4ec2b2df919fd5f053e

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

Bench: 4310076
2021-04-06 09:07:20 +02:00
Stéphane Nicolet b862c8d4be Small clean-up
Bench: 4321677
2021-03-31 08:12:25 +02:00
bmc4 c489df6f5b Simplify King Evasion
Simplify away the removal of some illegal `KING`-evasion moves during move
generation. Verified for correctness by running perft on the following positions:

```
./stockfish
bench 16 1 6 default perft
Nodes searched: 71608931810

./stockfish
position fen 4rrk1/1p1nq3/p7/2p1P1pp/3P2bp/3Q1Bn1/PPPB4/1K2R1NR w - - 40 21
go perft 6
Nodes searched: 6136386434
```

Passed STC:
LLR: 2.94 (-2.94,2.94) {-1.00,0.20}
Total: 16072 W: 1473 L: 1349 D: 13250
Ptnml(0-2): 57, 1047, 5710, 1159, 63
https://tests.stockfishchess.org/tests/view/60629e7ef183b42957b423b1

Passed LTC:
LLR: 2.94 (-2.94,2.94) {-0.70,0.20}
Total: 59064 W: 2214 L: 2177 D: 54673
Ptnml(0-2): 26, 1944, 25556, 1979, 27
https://tests.stockfishchess.org/tests/view/6062dce4f183b42957b423de

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

No functional change
2021-03-31 07:47:15 +02:00
mstembera 62a0b65ff8 Simplify and unify FRC cornered bishop.
tested locally as fishtest doesn't support FRC:

STC NNUE
9646 - 9647 - 20707 [0.500] 40000 -0.0 +/- 2.4, LOS: 49.7 %, DrawRatio: 51.8 %

STC classical
9678 - 9609 - 20713 [0.501] 40000 0.6 +/- 2.4, LOS: 69.0 %, DrawRatio: 51.8 %

and verified independently:

Score of master vs patch: 6463 - 6580 - 34957 [0.499] 48000

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

bench: 4321677
2021-03-27 17:03:10 +01:00
Tomasz Sobczyk f28303d214 Allow using Intel SDE for PGO builds.
The software development emulator (SDE) allows to run binaries compiled
for architectures not supported by the actual CPU. This is useful to
do PGO builds for newer architectures. The SDE can currently be obtained from
https://software.intel.com/content/www/us/en/develop/articles/intel-software-development-emulator.html

This patch introduces a new optional makefile argument SDE_PATH.
If not empty it should contain the path to the sde executable

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

No functional change.
2021-03-27 16:56:05 +01:00
Stéphane Nicolet 83eac08e75 Small cleanups (march 2021)
With help of @BM123499, @mstembera, @gvreuls, @noobpwnftw and @Fanael
Thanks!

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

No functional change
2021-03-24 17:11:06 +01:00
Guy Vreuls ec42154ef2 Use reference instead of pointer for pop_lsb() signature
This patch changes the pop_lsb() signature from Square pop_lsb(Bitboard*) to
Square pop_lsb(Bitboard&). This is more idomatic for C++ style signatures.

Passed a non-regression STC test:
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 21280 W: 1928 L: 1847 D: 17505
Ptnml(0-2): 71, 1427, 7558, 1518, 66
https://tests.stockfishchess.org/tests/view/6053a1e22433018de7a38e2f

We have verified that the generated binary is identical on gcc-10.

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

No functional change.
2021-03-19 20:28:57 +01:00
Vizvezdenec ace9632c67 Add a specific FRC correction from classical to NNUE
our net currently is not trained on FRC games, and so doesn't know about the important pattern of a bishop that is cornered in FRC.
This patch introduces a term we have in the classical evaluation for this case, and adds it to the NNUE eval.

Since fishtest doesn't support FRC right now, the patch was tested locally at STC conditions,
starting from the book of FRC starting positions.

Score of master vs patch: 993 - 2226 - 6781  [0.438] 10000

Which corresponds to approximately 40 Elo

The patch passes non-regression testing for traditional chess (where it adds one branch).

passed STC:
https://tests.stockfishchess.org/tests/view/604fa2532433018de7a38b67
LLR: 2.95 (-2.94,2.94) {-1.25,0.25}
Total: 30560 W: 2701 L: 2636 D: 25223
Ptnml(0-2): 88, 2056, 10921, 2133, 82

passed STC also in an earlier version:
https://tests.stockfishchess.org/tests/view/604f61282433018de7a38b4d

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

No functional change
2021-03-19 11:58:17 +01:00
bmc4 5089061659 Change definition of between_bb()
We remark that in current master, most of our use cases for between_bb() can be
optimized if the second parameter of the function is added to the segment. So we
change the definition of between_bb(s1, s2) such that it excludes s1 but includes s2.

We also use a precomputed array for between_bb() for another small speed gain
(see https://tests.stockfishchess.org/tests/view/604d09f72433018de7a389fb).

Passed STC:
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 18736 W: 1746 L: 1607 D: 15383
Ptnml(0-2): 61, 1226, 6644, 1387, 50
https://tests.stockfishchess.org/tests/view/60428c84ddcba5f0627bb6e4

Yellow LTC:
LTC:
LLR: -3.00 (-2.94,2.94) {0.25,1.25}
Total: 39144 W: 1431 L: 1413 D: 36300
Ptnml(0-2): 13, 1176, 17184, 1178, 21
https://tests.stockfishchess.org/tests/view/605128702433018de7a38ca1

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

---------

Verified for correctness by running perft on the following position:

./stockfish
position fen 4rrk1/1p1nq3/p7/2p1P1pp/3P2bp/3Q1Bn1/PPPB4/1K2R1NR w - - 40 21
go perft 6

Nodes searched: 6136386434

--------

No functional change
2021-03-18 00:21:41 +01:00
Vizvezdenec d58e83695f Remove advanced_pawn_push()
Continuation of work by @topologist: we now do futility pruning and movecount
pruning in qsearch() for pawn pushes up to the 7th rank. So the condition to
avoid the pruning is if the move is a promotion or not. This allows to get rid
of the advanced_pawn_push() function in position.h alltogether.

Passed STC
https://tests.stockfishchess.org/tests/view/6048c5842433018de7a387e6
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 34424 W: 3081 L: 3015 D: 28328
Ptnml(0-2): 110, 2442, 12052, 2488, 120

Passed LTC
https://tests.stockfishchess.org/tests/view/6048f7d22433018de7a387f0
LLR: 2.94 (-2.94,2.94) {-0.75,0.25}
Total: 142024 W: 5170 L: 5202 D: 131652
Ptnml(0-2): 50, 4678, 61613, 4596, 75

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

Bench: 4339126
2021-03-17 10:34:02 +01:00
bmc4 830f597134 Simplify move generation (2/2)
STC:
LLR: 2.97 (-2.94,2.94) {-1.25,0.25}
Total: 39352 W: 3551 L: 3493 D: 32308
Ptnml(0-2): 143, 2695, 13928, 2781, 129
https://tests.stockfishchess.org/tests/view/6050007a2433018de7a38bbb

LTC:
LLR: 2.96 (-2.94,2.94) {-0.75,0.25}
Total: 44944 W: 1629 L: 1596 D: 41719
Ptnml(0-2): 22, 1319, 19762, 1342, 27
https://tests.stockfishchess.org/tests/view/60500e892433018de7a38bc4

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

No functional change
2021-03-16 22:34:23 +01:00
bmc4 4b509559fb Simplify move generation (1/2)
STC:
LLR: 2.95 (-2.94,2.94) {-1.25,0.25}
Total: 29792 W: 2611 L: 2545 D: 24636
Ptnml(0-2): 94, 1982, 10659, 2086, 75
https://tests.stockfishchess.org/tests/view/604fe5b62433018de7a38ba8

LTC:
LLR: 2.92 (-2.94,2.94) {-0.75,0.25}
Total: 22040 W: 826 L: 777 D: 20437
Ptnml(0-2): 8, 646, 9664, 693, 9
https://tests.stockfishchess.org/tests/view/604fec892433018de7a38bac

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

No functional change
2021-03-16 22:32:53 +01:00
bmc4 939395729c Introduce least_significant_square_bb()
Introducing least_significant_square_bb(). It is a function that returns a value equal
to square_bb(lsb(bb)), but it uses fewer instruction. It should speed up more on older
processors like armv7-a Clang.

Passed STC:
LLR: 2.93 (-2.94,2.94) {-0.25,1.25}
Total: 213200 W: 19171 L: 18753 D: 175276
Ptnml(0-2): 680, 14513, 75831, 14861, 715
https://tests.stockfishchess.org/tests/view/604bc7632433018de7a38982

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

No functional change
2021-03-16 20:54:52 +01:00
Topologist f3b296c2e2 Change advanced pawn push threshold
A pawn push is now considered to be "advanced" if the relative destination
rank is > 6 (previously it was > 5). This affects the search heuristic.

Also remove an assert concerning en passant moves in qsearch().

STC:
LLR: 2.97 (-2.94,2.94) {-0.25,1.25}
Total: 46744 W: 4224 L: 4040 D: 38480
Ptnml(0-2): 165, 3206, 16451, 3380, 170
https://tests.stockfishchess.org/tests/view/604746082433018de7a3872e

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 107840 W: 4198 L: 3892 D: 99750
Ptnml(0-2): 58, 3472, 46557, 3772, 61
https://tests.stockfishchess.org/tests/view/60475eae2433018de7a38737

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

Bench: 4796780
2021-03-10 12:32:53 +01:00
bmc4 b74274628c Use Bitboard over Square in movegen
It uses pos.checkers() on target when movegen is the type of EVASION.
It simplify the code. And it's also expected a slightly speed up,
because Bitboard is more direct when doing bitwise.

Passed STC:
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 28176 W: 2506 L: 2437 D: 23233
Ptnml(0-2): 80, 1904, 10063, 1949, 92
https://tests.stockfishchess.org/tests/view/60421d18ddcba5f0627bb6a9

Passed LTC:
LLR: 2.93 (-2.94,2.94) {-0.75,0.25}
Total: 9704 W: 402 L: 341 D: 8961
Ptnml(0-2): 3, 279, 4230, 334, 6
https://tests.stockfishchess.org/tests/view/60422823ddcba5f0627bb6ae

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

No functional change
2021-03-07 21:16:38 +01:00
mattginsberg 5346f1c6c7 Deal with commented lines in UCI input
commands starting with '#' as the first character will be ignored

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

No functional change
2021-03-07 21:10:04 +01:00
noobpwnftw d4b864ff12 Do not try to use large pages on 32 bit Windows.
verified to work on windows XP.

fixes  #3379

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

No functional change.
2021-03-07 20:02:11 +01:00
Dieter Dobbelaere 7ffae17f85 Add Stockfish namespace.
fixes #3350 and is a small cleanup that might make it easier to use SF
in separate projects, like a NNUE trainer or similar.

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

No functional change.
2021-03-07 14:26:54 +01:00
Antoine Champion 9b1274aba3 Clean functions returning by const values
The codebase contains multiple functions returning by const-value.
This patch is a small cleanup making those function returns
by value instead, removing the const specifier.

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

No functional change
2021-03-07 14:05:01 +01:00
Stéphane Nicolet 0f3f5d85fb Introduce DistanceFromPV
We introduce a metric for each internal node in search, called DistanceFromPV.
This distance indicated how far the current node is from the principal variation.

We then use this distance to search the nodes which are close to the PV a little
deeper (up to 4 plies deeper than the PV): this improves the quality of the search
at these nodes and bring better updates for the PV during search.

STC:
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 54936 W: 5047 L: 4850 D: 45039
Ptnml(0-2): 183, 3907, 19075, 4136, 167
https://tests.stockfishchess.org/tests/view/6037b88e7f517a561bc4a392

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 49608 W: 1880 L: 1703 D: 46025
Ptnml(0-2): 22, 1514, 21555, 1691, 22
https://tests.stockfishchess.org/tests/view/6038271b7f517a561bc4a3cb

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

Bench: 5037279
2021-02-26 19:45:29 +01:00
Vizvezdenec 7c30091a92 Introduce ProbCut for check evasions
The idea of this patch can be described as follows: if we are in check
and the transposition table move is a capture that returns a value
far above beta, we can assume that the opponent just blundered a piece
by giving check, and we return the transposition table value. This is
similar to the usual probCut logic for quiet moves, but with a different
threshold.

Passed STC
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 33440 W: 3056 L: 2891 D: 27493
Ptnml(0-2): 110, 2338, 11672, 2477, 123
https://tests.stockfishchess.org/tests/view/602cd1087f517a561bc49bda

Passed LTC
LLR: 2.98 (-2.94,2.94) {0.25,1.25}
Total: 10072 W: 401 L: 309 D: 9362
Ptnml(0-2): 2, 288, 4365, 378, 3
https://tests.stockfishchess.org/tests/view/602ceea57f517a561bc49bf0

The committed version has an additional fix to never return unproven wins
in the tablebase range or the mate range. This fix passed tests for non-
regression at STC and LTC:

STC:
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 26240 W: 2354 L: 2280 D: 21606
Ptnml(0-2): 85, 1763, 9372, 1793, 107
https://tests.stockfishchess.org/tests/view/602d86a87f517a561bc49c7a

LTC:
LLR: 2.95 (-2.94,2.94) {-0.75,0.25}
Total: 35304 W: 1299 L: 1256 D: 32749
Ptnml(0-2): 14, 1095, 15395, 1130, 18
https://tests.stockfishchess.org/tests/view/602d98d17f517a561bc49c83

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

Bench: 3830215
2021-02-20 22:49:39 +01:00
Vizvezdenec 6294db7514 Tune search parameters (with Unai Corzo)
The values used in this patch are taken from a SPSA parameter tuning session
originated by Unai Corzo (@unaiic), but the final difference of his tune was
multiplied x2 by hand. Most of the credits should go to him :-)

STC:
https://tests.stockfishchess.org/tests/view/602f03d07f517a561bc49d40
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 67664 W: 6252 L: 6035 D: 55377
Ptnml(0-2): 256, 4799, 23527, 4972, 278

LTC:
https://tests.stockfishchess.org/tests/view/602f41697f517a561bc49d5a
LLR: 2.96 (-2.94,2.94) {0.25,1.25}
Total: 26256 W: 1034 L: 906 D: 24316
Ptnml(0-2): 10, 804, 11377, 922, 15

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

Bench: 3957653
2021-02-20 22:22:07 +01:00
Stéphane Nicolet a31007c9e7 Restore development version
No functional change
2021-02-20 22:19:14 +01:00
Joost VandeVondele 3597f1942e Stockfish 13
Official release version of Stockfish 13

Bench: 3766422

-----

It is our pleasure to release Stockfish 13 to chess fans worldwide.
As usual, downloads are freely available at

https://stockfishchess.org

The Stockfish project builds on a thriving community of enthusiasts
who contribute their expertise, time, and resources to build a free
and open-source chess engine that is robust, widely available, and
very strong. We would like to thank them all!

The good news first: from now on, our users can expect more frequent
high-quality releases of Stockfish! Sadly, this decision has been
triggered by the start of sales of the Fat Fritz 2 engine by ChessBase,
which is a copy of a very recent development version of Stockfish
with minor modifications. We refer to our statement on Fat Fritz 2[1]
and a community blog[2] for further information.

This version of Stockfish is significantly stronger than any of its
predecessors. Stockfish 13 outperforms Stockfish 12 by at least
35 Elo[3]. When playing against a one-year-old Stockfish, it wins 60
times more game pairs than it loses[4]. This release features an NNUE
network retrained on billions of positions, much faster network
evaluation code, and significantly improved search heuristics, as
well as additional evaluation tweaks. In the course of its development,
this version has won the superfinals of the TCEC Season 19 and
TCEC Season 20.

Going forward, the Leela Chess Zero and Stockfish teams will join
forces to demonstrate our commitment to open source chess engines and
training tools, and open data. We are convinced that our free and
open-source chess engines serve the chess community very well.

Stay safe and enjoy chess!

The Stockfish team
[1] https://blog.stockfishchess.org/post/643239805544792064/statement-on-fat-fritz-2
[2] https://lichess.org/blog/YCvy7xMAACIA8007/fat-fritz-2-is-a-rip-off
[3] https://tests.stockfishchess.org/tests/view/602bcccf7f517a561bc49b11
[4] https://tests.stockfishchess.org/tests/view/600fbb9c735dd7f0f0352d59
2021-02-18 22:14:55 +01:00
Lolligerhans 40cb0f076a Small trivial clean-ups, February 2021
Closes https://github.com/official-stockfish/Stockfish/pull/3329

No functional change
2021-02-16 01:31:42 +01:00
Vizvezdenec 76daa88cf8 PV-Nodes likely to fail low
Do not decrease reduction at pv-nodes which are likely to fail low.

The idea of this patch can be described as following: during the search, if a node
on the principal variation was re-searched in non-pv search and this re-search got
a value which was much lower than alpha, then we can assume that this pv-node is
likely to fail low again, and we can reduce more aggressively at this node.

Passed STC
https://tests.stockfishchess.org/tests/view/6023a5fa7f517a561bc49638
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 70288 W: 6443 L: 6223 D: 57622
Ptnml(0-2): 239, 5022, 24436, 5174, 273

Passed LTC
https://tests.stockfishchess.org/tests/view/6023f2617f517a561bc49661
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 105656 W: 4048 L: 3748 D: 97860
Ptnml(0-2): 67, 3312, 45761, 3630, 58

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

Bench: 3766422
2021-02-11 23:39:06 +01:00
mattginsberg 573f0e364f Better code for hash table generation
This patch removes some magic numbers in TT bit management and introduce proper
constants in the code, to improve documentation and ease further modifications.

No function change
2021-02-11 22:29:35 +01:00
Gian-Carlo Pascutto 550fed3343 Enable New Pass Manager for Clang.
It's about 1% speedup for Stockfish.

Result of 100 runs
==================
base (...fish_clang12) =    1946851  +/- 3717
test (./stockfish    ) =    1967276  +/- 3408
diff                   =     +20425  +/- 2438

speedup        = +0.0105
P(speedup > 0) =  1.0000

Thanks to David Major for making me aware of this part
of LLVM development.

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

No functional change
2021-02-10 19:54:26 +01:00
Gian-Carlo Pascutto b15e3b3fa9 Disable ThinLTO when using Clang.
Benchmarking with current Clang 12 shows that
and ThinLTO is a pessimization, see issue #3341.

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

No functional change.
2021-02-10 19:52:20 +01:00
Andy Pilate 1f87a9eb6c Fixes FreeBSD compilation when using Clang
closes https://github.com/official-stockfish/Stockfish/pull/3342

No functional change
2021-02-10 19:50:44 +01:00
bmc4 29ed22de8c Search Parameters Tuning
A simple tuning on search.cpp.

based SPSA test:
https://tests.stockfishchess.org/tests/view/601f2a787f517a561bc493cd

passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 117840 W: 10796 L: 10508 D: 96536
Ptnml(0-2): 422, 8381, 41041, 8639, 437
https://tests.stockfishchess.org/tests/view/602144c37f517a561bc494ae

passed LTC:
LLR: 2.96 (-2.94,2.94) {0.25,1.25}
Total: 25024 W: 972 L: 847 D: 23205
Ptnml(0-2): 7, 767, 10847, 876, 15
https://tests.stockfishchess.org/tests/view/602156877f517a561bc494be

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

Bench: 3974098
2021-02-08 21:42:03 +01:00
FauziAkram 5ebdc40f83 Pawns Tuning
A simple tuning of Pawns parameters, and some PSQT changes.

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 219424 W: 43681 L: 43103 D: 132640
Ptnml(0-2): 4014, 25760, 49669, 26172, 4097
https://tests.stockfishchess.org/tests/view/601bce167f517a561bc491eb

Passed LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 317312 W: 42525 L: 41579 D: 233208
Ptnml(0-2): 2447, 30157, 92636, 30835, 2581
https://tests.stockfishchess.org/tests/view/601c21557f517a561bc49227

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

Bench: 4154473
2021-02-08 21:39:30 +01:00
bmc4 9f8058bd26 Simplify En Passant
simplifies the handling of en passant during search, needs a little more care in initialization.

Passed STC:
LLR: 2.95 (-2.94,2.94) {-1.25,0.25}
Total: 72608 W: 6569 L: 6559 D: 59480
Ptnml(0-2): 233, 5117, 25629, 5057, 268
https://tests.stockfishchess.org/tests/view/600f1363735dd7f0f0352ce7

Passed LTC:
LLR: 2.92 (-2.94,2.94) {-0.75,0.25}
Total: 24328 W: 913 L: 864 D: 22551
Ptnml(0-2): 10, 731, 10633, 780, 10
https://tests.stockfishchess.org/tests/view/600f2e93735dd7f0f0352cf6

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

No functional change.
2021-02-08 21:35:59 +01:00
bmc4 6617ad6e03 Tune ordering of moves at internal nodes
We change the relative weights of the function used to order
quiet moves in our MovePicker class.

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 32184 W: 2936 L: 2773 D: 26475
Ptnml(0-2): 115, 2196, 11328, 2317, 136
https://tests.stockfishchess.org/tests/view/60161ee1735dd7f0f03530f8

Passed LTC:
LLR: 2.93 (-2.94,2.94) {0.25,1.25}
Total: 33088 W: 1292 L: 1149 D: 30647
Ptnml(0-2): 14, 1030, 14318, 1163, 19
https://tests.stockfishchess.org/tests/view/60163146735dd7f0f03530ff

The new weight were chosen after the following SPSA session:
https://tests.stockfishchess.org/tests/view/60136857735dd7f0f0352f6c

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

Bench: 4398803
2021-01-31 16:00:06 +01:00
bmc4 dd96095214 Simplify Chess 960 castling
a little cleanup, and small speedup (about 0.3%) for Chess 960.

Verified with perft on a large set of chess960 positions.

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

No functional change
2021-01-31 10:07:02 +01:00
bmc4 0db374777e Speed Up Perft Search
It speeds up generate<LEGAL>, and thus perft, roughly by 2-3%.

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

No functional change
2021-01-31 10:04:41 +01:00
bmc4 befbcffb4e Clean Up Castling in gives_check
There is no need to add rto or kto on the Bitboard which represents the pieces.

STC:
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 57064 W: 5096 L: 5067 D: 46901
Ptnml(0-2): 202, 3862, 20355, 3931, 182
https://tests.stockfishchess.org/tests/view/6005ea2c6019e097de3efa55

LTC:
LLR: 2.92 (-2.94,2.94) {-0.75,0.25}
Total: 30088 W: 1094 L: 1052 D: 27942
Ptnml(0-2): 10, 882, 13217, 926, 9
https://tests.stockfishchess.org/tests/view/6006115a6019e097de3efa6e

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

No functional change.
2021-01-31 10:02:10 +01:00
bmc4 7d0a16e06d Avoid more expensive legality check
speedup of the code, enough to pass STC, failed LTC.

Passed STC:
LLR: 2.93 (-2.94,2.94) {-0.25,1.25}
Total: 68928 W: 6334 L: 6122 D: 56472
Ptnml(0-2): 233, 4701, 24369, 4943, 218
https://tests.stockfishchess.org/tests/view/6002747f6019e097de3ef8dc

Failed LTC:
LLR: -2.96 (-2.94,2.94) {0.25,1.25}
Total: 44560 W: 1702 L: 1675 D: 41183
Ptnml(0-2): 25, 1383, 19438, 1408, 26
https://tests.stockfishchess.org/tests/view/6002a4836019e097de3ef8e3

About 1% speedup:

Result of  50 runs
==================
base (...kfish.master) =    2237500  +/- 7428
test (...ckfish.patch) =    2267003  +/- 7017
diff                   =     +29503  +/- 4774

speedup        = +0.0132
P(speedup > 0) =  1.0000

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

No functional change.
2021-01-31 10:00:17 +01:00
Lolligerhans 70a818cbd6 Small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/3301

No functional change
2021-01-30 13:27:31 +01:00
Stéphane Nicolet 1188141aa7 Improve play for closed positions
This patch give a small bonus to incite the attacking side to keep more
pawns on the board.

A consequence of this bonus is that Stockfish will tend to play positions
slightly more closed on average than master, especially when it believes
that it has an advantage.

To lower the risk of blockades where Stockfish start shuffling without
progress, we also implement a progressive decrease of the evaluation
value with the 50 moves counter (along with the necessary aging of the
transposition table to reduce the impact of the Graph History Interaction
problem): since the evaluation decreases during shuffling phases, the
engine will tend to examine the consequences of pawn breaks faster during
the search.

Passed STC:
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 26184 W: 2406 L: 2252 D: 21526
Ptnml(0-2): 85, 1784, 9223, 1892, 108
https://tests.stockfishchess.org/tests/view/600cc08b735dd7f0f0352c06

Passed LCT:
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 199768 W: 7695 L: 7191 D: 184882
Ptnml(0-2): 85, 6478, 86269, 6952, 100
https://tests.stockfishchess.org/tests/view/600ccd28735dd7f0f0352c10

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

Bench: 3988915
2021-01-30 13:20:56 +01:00
Krystian Kuzniarek 329ef2a6aa Change lock type
No additional features of std::unique_lock has been previously used
so it's better to use a lighter lock.

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

No functional change.
2021-01-30 12:57:27 +01:00
Lolligerhans 77eeea407c Add penalty for doubled pawns in agile structure
Give an additional penalty of S(20, 10) for any doubled pawn if none of
the opponent's pawns is facing any of our
 - pawns or
 - pawn attacks;
that means, each of their pawns can push at least one square without
being captured.
This ignores their non-pawns pieces and attacks.

One possible justification: Their pawns' ability to push freely provides
options to react to our threats by changing their pawn structure. Our
doubled pawns however will likely lead to an exploitable weakness, even
if the pawn structure is not yet fixed.

Note that the notion of "their pawns not being fixed" is symmetric for
both players: If all of their pawns can push freely so can ours. All
pawns being freely pushable might just be an early-game-indicator.
However, it can trigger during endgame pawns races, where doubled pawns
are especially hindering, too.

LTC
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 134976 W: 17964 L: 17415 D: 99597
Ptnml(0-2): 998, 12702, 39619, 13091, 1078
https://tests.stockfishchess.org/tests/view/5ffdd5316019e097de3ef281

STC
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 35640 W: 7219 L: 6904 D: 21517
Ptnml(0-2): 645, 4096, 8084, 4289, 706
https://tests.stockfishchess.org/tests/view/5ffda4a16019e097de3ef265

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

Bench: 4363873
2021-01-17 09:35:59 +01:00
Tomasz Sobczyk 6dddcecb09 Optimize generate_moves
This change simplifies control flow in the generate_moves function which ensures the compiler doesn't duplicate work due to possibly not resolving pureness of the function calls. Also the biggest change is the removal of the unnecessary condition checking for empty b in a convoluted way. The rationale for removal of this condition is that computing attacks_bb with occupancy is not much more costly than computing pseudo attacks and overall the condition (also being likely unpredictable) is a pessimisation.

This is inspired by previous changes by @BM123499.

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 88040 W: 8172 L: 7931 D: 71937
Ptnml(0-2): 285, 6128, 30957, 6361, 289
https://tests.stockfishchess.org/tests/view/5ffc28386019e097de3ef1c7

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

No functional change.
2021-01-13 22:59:54 +01:00
FauziAkram ee3f7b6b6e Bad Outpost Pawn Scale
Changed name from Bad Outpost to Uncontested Outpost
Scale Uncontested Outpost with number of pawns + Decrease Bishop PSQT values and general tuning

Credits for the decrease of the Bishop PSQT values: Fauzi
Credits for scaling Uncontested Outpost with number of pawns: Lolligerhans
Credits for the tunings: Fauzi

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 32040 W: 6593 L: 6281 D: 19166
Ptnml(0-2): 596, 3713, 7095, 4015, 601
https://tests.stockfishchess.org/tests/view/5ffa43026019e097de3ef0f2

Passed LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 84376 W: 11395 L: 10950 D: 62031
Ptnml(0-2): 652, 7930, 24623, 8287, 696
https://tests.stockfishchess.org/tests/view/5ffa6e7b6019e097de3ef0fd

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

Bench: 4287509
2021-01-11 19:42:31 +01:00
Vizvezdenec 37c2b5685e Refine stat based reductions
This patch separates stat based reductions for quiet moves in case of being in check and in case of not being in check.
We will be using sum of first continuation history and main history (similar to movepicker) instead of statScore for the first case.

passed STC
https://tests.stockfishchess.org/tests/view/5ff87b2f6019e097de3ef09b
LLR: 2.93 (-2.94,2.94) {-0.25,1.25}
Total: 63992 W: 5887 L: 5678 D: 52427
Ptnml(0-2): 201, 4561, 22305, 4686, 243

passed LTC
https://tests.stockfishchess.org/tests/view/5ff8b6206019e097de3ef0b2
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 81216 W: 3127 L: 2880 D: 75209
Ptnml(0-2): 46, 2544, 35176, 2801, 41

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

bench 4395984
2021-01-11 19:36:07 +01:00
BM123499 5f222f1d98 Rethink En Passant Evasion Capture
It now checks if it were a discovery attack instead of the attacking piece is the double-moved pawn.

As a side effect, certain illegal fens have different, and slightly more logical move generation.
There is no intend to maintain particular behavior for such non-reachable fens.

Passed STC:
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 47912 W: 4327 L: 4285 D: 39300
Ptnml(0-2): 144, 3312, 17012, 3334, 154
https://tests.stockfishchess.org/tests/view/5ff890946019e097de3ef0a5

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

closes / fixes https://github.com/official-stockfish/Stockfish/issues/3270

No functional change
2021-01-11 19:31:22 +01:00
Dieter Dobbelaere 0266e70297 Fix static_assert.
With a hard-coded true, this declaration has no effect.

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

No functional change.
2021-01-11 19:23:05 +01:00
Dieter Dobbelaere 87586b3d0c Use correct chess terms + fix spelling.
- "discovered check" (instead of "discovery check")
  - "en passant" (instead of "en-passant")
  - "pseudo-legal" before a noun (instead of "pseudo legal")
  - "3-fold" (instead of "3fold")

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

No functional change.
2021-01-11 19:19:39 +01:00
Vizvezdenec b1bb376c3c Small code cleanup in LMR
In a recent patch we added comparing capture history to a number for LMR of captures.
Calling it via thisThread-> is not needed since capture history was already declared by this time -
so removing makes code slightly shorter and easier to follow.

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

No functional change.
2021-01-11 19:17:03 +01:00
MaximMolchanov 303713b560 Affine transform robust implementation
Size of the weights in the last layer is less than 512 bits. It leads to wrong data access for AVX512. There is no error because in current implementation it is guaranteed that there is an array of zeros after weights so zero multiplied by something is returned and sum is correct. It is a mistake that can lead to unexpected bugs in the future. Used AVX2 instructions for smaller input size.

No measurable slowdown on avx512.

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

No functional change.
2021-01-11 18:54:18 +01:00
bmc4 4d30438400 Remove Condition from Generate_Move Loop
it seems it's faster to handle blockers_for_king(~Us) outside loops

Passed STC:
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 22184 W: 2063 L: 1919 D: 18202
Ptnml(0-2): 63, 1485, 7855, 1623, 66
https://tests.stockfishchess.org/tests/view/5ffbee2f6019e097de3ef18d

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

No functional change
2021-01-11 18:41:47 +01:00
Joost VandeVondele c4d67d77c9 Update copyright years
No functional change
2021-01-08 17:04:23 +01:00
Vizvezdenec 2c1be0be8e Reorder conditions in LMR and pruning
Make code logic somewhat easier to follow.

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

No functional change.
2021-01-08 16:57:26 +01:00
MaximMolchanov 23c385ec36 Affine transform refactoring.
Reordered weights in such a way that accumulated sum fits to output.
Weights are grouped in blocks of four elements because four
int8 (weight type) corresponds to one int32 (output type).
No horizontal additions.
Grouped AVX512, AVX2 and SSSE3 implementations.
Repeated code was removed.

An earlier version passed STC:

LLR: 2.97 (-2.94,2.94) {-0.25,1.25}
Total: 15336 W: 1495 L: 1355 D: 12486
Ptnml(0-2): 44, 1054, 5350, 1158, 62
https://tests.stockfishchess.org/tests/view/5ff60e106019e097de3eefd5

Speedup depends on the architecture, up to 4% measured on a NNUE only bench.

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

No functional change
2021-01-08 16:35:44 +01:00
FauziAkram d21e421ad7 WeakUnopposed penalty for backwards on file A or H
Do not give the WeakUnopposed penalty for backwards on file A or H

The original idea comes from Lolligerhans, and a series of tunings and tests done by Fauzi.

Passed STC:
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 140864 W: 28127 L: 27660 D: 85077
Ptnml(0-2): 2529, 16660, 31735, 16831, 2677
https://tests.stockfishchess.org/tests/view/5fe39dec3932f79192d39673

Passed LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 67568 W: 8993 L: 8590 D: 49985
Ptnml(0-2): 523, 6176, 19983, 6579, 523
https://tests.stockfishchess.org/tests/view/5fe3dd1b3932f79192d39693

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

Bench: 4109336
2020-12-31 18:03:33 +01:00
Unai Corzo 8ec97d161e Remove razoring
has become ineffective now.

STC https://tests.stockfishchess.org/tests/view/5fe653403932f79192d3981a
LLR: 2.95 (-2.94,2.94) {-1.25,0.25}
Total: 63448 W: 5965 L: 5934 D: 51549
Ptnml(0-2): 230, 4738, 21769, 4745, 242

LTC https://tests.stockfishchess.org/tests/view/5fe6f0f03932f79192d39856
LLR: 2.93 (-2.94,2.94) {-0.75,0.25}
Total: 65368 W: 2485 L: 2459 D: 60424
Ptnml(0-2): 33, 2186, 28230, 2192, 43

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

bench: 4493379
2020-12-31 17:51:14 +01:00
Unai Corzo 8985c210a1 Simplify away late irreversible move extension
Late irreversible move extension seems to be useless now.

STC https://tests.stockfishchess.org/tests/view/5fe75c5c3932f79192d398ca
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 196192 W: 18111 L: 18278 D: 159803
Ptnml(0-2): 681, 14097, 68652, 14040, 626

LTC https://tests.stockfishchess.org/tests/view/5fe875e23932f79192d39952
LLR: 2.96 (-2.94,2.94) {-0.75,0.25}
Total: 28080 W: 1105 L: 1053 D: 25922
Ptnml(0-2): 13, 904, 12158, 948, 17

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

bench: 4144640
2020-12-31 17:48:47 +01:00
Unai Corzo c57c71bf5c Assorted parameter tweak
Parameter tweak from various tunes and patches.

STC https://tests.stockfishchess.org/tests/view/5fec2ae36019e097de3ee94a
LLR: 2.97 (-2.94,2.94) {-0.25,1.25}
Total: 41976 W: 4032 L: 3848 D: 34096
Ptnml(0-2): 147, 3086, 14341, 3264, 150

LTC https://tests.stockfishchess.org/tests/view/5fec5c3c6019e097de3ee973
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 23936 W: 970 L: 844 D: 22122
Ptnml(0-2): 14, 749, 10319, 869, 17

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

bench: 4354546
2020-12-31 17:44:15 +01:00
Stefan Geschwentner 4262461457 Tweak capture LMR.
Apply the recently added LMR condition for captures at nodes which are not PV or former PV nodes only if capture history is not too good.

STC:
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 95296 W: 8917 L: 8660 D: 77719
Ptnml(0-2): 323, 6871, 33045, 7044, 365
https://tests.stockfishchess.org/tests/view/5feca7f46019e097de3ee9ae

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 29216 W: 1172 L: 1034 D: 27010
Ptnml(0-2): 11, 946, 12568, 1060, 23
https://tests.stockfishchess.org/tests/view/5fecf1786019e097de3ee9d5

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

Bench: 4006138
2020-12-31 17:41:34 +01:00
Vizvezdenec 51deae8998 Do more LMR for captures
This patch enables LMR for all captures at allNodes that were not in PV.
Currently we do LMR for all captures at cutNodes so this is an expansion of this logic:
now we do LMR for all captures almost at all non-pv nodes,
excluding only allNodes that were in PV.

passed STC
https://tests.stockfishchess.org/tests/view/5fe50b9d3932f79192d3973c
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 83128 W: 7606 L: 7368 D: 68154
Ptnml(0-2): 292, 5905, 28939, 6129, 299

passed LTC
https://tests.stockfishchess.org/tests/view/5fe552e43932f79192d39744
LLR: 2.92 (-2.94,2.94) {0.25,1.25}
Total: 13968 W: 568 L: 466 D: 12934
Ptnml(0-2): 5, 418, 6043, 506, 12

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

Bench: 4194835
2020-12-25 10:21:00 +01:00
Moez Jellouli b06ef36ae5 Correct Outflanking calculations in classical eval
Take signed value of rank difference between kings squares instead absolute value in outflanking calculation. This change correct evaluation of endgames with one king invading opponent last ranks.

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 122240 W: 24326 L: 23896 D: 74018
Ptnml(0-2): 2101, 14139, 28236, 14517, 2127
https://tests.stockfishchess.org/tests/view/5fdfc33a3932f79192d394b8

Passed LTC:
LLR: 2.97 (-2.94,2.94) {0.25,1.25}
Total: 157416 W: 20870 L: 20292 D: 116254
Ptnml(0-2): 973, 13954, 48333, 14418, 1030
https://tests.stockfishchess.org/tests/view/5fe07a453932f79192d39502

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

Bench: 4162769
2020-12-23 20:20:24 +01:00
FauziAkram 45b05328b6 Tweak the formulas for unsafeSquares
We give more bonus for a special case: If there are some enemy squares occupied
or attacked by the enemy on the passed pawn span,
but if they are all attacked by our pawn, use new intermediate factor 30.

The main credit goes to Rocky for the idea, with additional tuning and tests.

Passed STC:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 96464 W: 19233 L: 18834 D: 58397
Ptnml(0-2): 1683, 11327, 21950, 11452, 1820
https://tests.stockfishchess.org/tests/view/5fdd21ab3932f79192d39357

Passed LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 81320 W: 10784 L: 10352 D: 60184
Ptnml(0-2): 602, 7524, 24044, 7820, 670
https://tests.stockfishchess.org/tests/view/5fddec983932f79192d393a4

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

Bench: 4338972
2020-12-23 20:17:57 +01:00
pb00067 1f3b5b8b54 Simplify condition for assigning static-eval based bonus
for quiet move ordering and simplify bonus formula.

Due to clamping the bonus to relative low values the impact on high
depths is minimal, thus the restriction to low depths seems not
necessary.
Also the condition of movecount in previous node seems to be not
determinant.

Passed STC:
LLR: 2.95 (-2.94,2.94) {-1.25,0.25}
Total: 14600 W: 1424 L: 1323 D: 11853
Ptnml(0-2): 55, 1033, 5020, 1140, 52
https://tests.stockfishchess.org/tests/view/5fd67b381ac16912018885ec

Passed LTC:
LLR: 2.95 (-2.94,2.94) {-0.75,0.25}
Total: 85008 W: 3218 L: 3206 D: 78584
Ptnml(0-2): 49, 2840, 36700, 2880, 35
https://tests.stockfishchess.org/tests/view/5fd6af041ac16912018885f8

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

bench: 4524994
2020-12-18 21:19:46 +01:00
FauziAkram 66a7a8a0cc Adjust definition of unsafeSquares
and adjust related bonus values. The bonus is now not given whenever
there is an enemy piece in front of the pawn.

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 109472 W: 22097 L: 21673 D: 65702
Ptnml(0-2): 2111, 12800, 24482, 13240, 2103
https://tests.stockfishchess.org/tests/view/5fd8d3740c5870924361ffad

Passed LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 39384 W: 5334 L: 4990 D: 29060
Ptnml(0-2): 279, 3648, 11535, 3910, 320
https://tests.stockfishchess.org/tests/view/5fd971ab0c5870924361fff0

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

Bench: 4488955
2020-12-18 21:17:34 +01:00
Vizvezdenec a88a38c3a9 Increase reduction in case of stable best move
The idea of this patch is pretty simple - we already do more reductions
for non-PV and root nodes in case of stable best move for depth > 10.
This patch makes us do so if root depth if > 10 instead, which
is logical since best move changes (thus instability of it) is
counted at root, so it makes a lot of sense to use depth of the root.

passed STC
https://tests.stockfishchess.org/tests/view/5fd643271ac16912018885c5
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 13232 W: 1308 L: 1169 D: 10755
Ptnml(0-2): 39, 935, 4535, 1062, 45

passed LTC
https://tests.stockfishchess.org/tests/view/5fd68db11ac16912018885f0
LLR: 2.96 (-2.94,2.94) {0.25,1.25}
Total: 14024 W: 565 L: 463 D: 12996
Ptnml(0-2): 3, 423, 6062, 517, 7

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

Bench: 4050630
2020-12-14 07:52:02 +01:00
pb00067 16adcb5374 Merge static history into main history,
thus simplifying and reducing the memory footprint.
I believe using static diff for better move ordering is more suited for
low depths, so restrict writing to low depths.

Todo: probably the condition for writing can be simplified

LTC:
LLR: 2.95 (-2.94,2.94) {-0.75,0.25}
Total: 18752 W: 768 L: 705 D: 17279
Ptnml(0-2): 7, 635, 8034, 688, 12
https://tests.stockfishchess.org/tests/view/5fd631791ac169120188859e

STC:
LLR: 2.95 (-2.94,2.94) {-1.25,0.25}
Total: 36504 W: 3380 L: 3313 D: 29811
Ptnml(0-2): 116, 2667, 12645, 2682, 142
https://tests.stockfishchess.org/tests/view/5fd5ed861ac1691201888569

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

bench: 4018036
2020-12-14 07:48:48 +01:00
mstembera d862ba4069 AVX512, AVX2 and SSSE3 speedups
Improves throughput by summing 2 intermediate dot products using 16 bit addition before upconverting to 32 bit.

Potential saturation is detected and the code-path is avoided in this case.
The saturation can't happen with the current nets,
but nets can be constructed that trigger this check.

STC https://tests.stockfishchess.org/tests/view/5fd40a861ac1691201888479
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 25544 W: 2451 L: 2296 D: 20797
Ptnml(0-2): 92, 1761, 8925, 1888, 106

about 5% speedup

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

No functional change
2020-12-14 07:46:15 +01:00
FauziAkram d706ae62d7 New Imbalance Tables Tweak
Imbalance tables tweaked to contain MiddleGame and Endgame values, instead of a single value.

The idea started from Fisherman, which requested my help to tune the values back in June/July,
so I tuned the values back then, and we were able to accomplish good results,
but not enough to pass both STC and LTC tests.

So after the recent changes, I decided to give it another shot, and I am glad that it was a successful attempt.

A special thanks goes also to mstembera, which notified me a simple way to let the patch perform a little better.

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 115976 W: 23124 L: 22695 D: 70157
Ptnml(0-2): 2074, 13652, 26285, 13725, 2252
https://tests.stockfishchess.org/tests/view/5fc92d2d42a050a89f02ccc8

Passed LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 156304 W: 20617 L: 20024 D: 115663
Ptnml(0-2): 1138, 14647, 46084, 15050, 1233
https://tests.stockfishchess.org/tests/view/5fc9fee142a050a89f02cd3e

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

Bench: 4278746
2020-12-12 09:31:28 +01:00
Fanael Linithien c7f0a768cb Use arithmetic right shift for sign extension in MMX and SSE2 paths
This appears to be slightly faster than using a comparison against zero
to compute the high bits, on both old (like Pentium III) and new (like
Zen 2) hardware.

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

No functional change.
2020-12-12 09:20:15 +01:00
Vizvezdenec 8630d03dd4 Add comments to uncommented parts of code
https://github.com/official-stockfish/Stockfish/pull/3250

No functional change
2020-12-05 16:58:42 +01:00