]> git.sesse.net Git - stockfish/log
stockfish
16 months agoRemove static eval threshold for extensions when giving check
Linmiao Xu [Tue, 30 May 2023 22:24:54 +0000 (18:24 -0400)]
Remove static eval threshold for extensions when giving check

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/647685d54a36543c4c9f4f2a
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 114688 W: 30701 L: 30571 D: 53416
Ptnml(0-2): 336, 12708, 31136, 12818, 346

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/64774b02b81f005b572de770
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 107310 W: 28920 L: 28796 D: 49594
Ptnml(0-2): 33, 10427, 32621, 10531, 43

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

bench 2597974

16 months agoSimplify away SEE verification
Guenther Demetz [Wed, 31 May 2023 09:48:18 +0000 (11:48 +0200)]
Simplify away SEE verification

After 4 simplificatons over PR#4453 the idea does not yield significant
improvement anymore. Maybe also
https://tests.stockfishchess.org/tests/view/640c88092644b62c3394c1c5 was
a fluke.

Passed non-regression bounds:

STC:
https://tests.stockfishchess.org/tests/view/64705389c079b6583146d873
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 131936 W: 35040 L: 34930 D: 61966
Ptnml(0-2): 336, 14559, 36035, 14735, 303

LTC:
https://tests.stockfishchess.org/tests/view/6471a2ade549d9cf2fb213cd
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 407700 W: 109999 L: 110164 D: 187537
Ptnml(0-2): 279, 39913, 123689, 39632, 337

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

bench: 2675974

16 months agoSimplify blending nnue complexity with optimism
Linmiao Xu [Thu, 1 Jun 2023 13:50:19 +0000 (09:50 -0400)]
Simplify blending nnue complexity with optimism

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/6478a26d54dd118e1d98f21c
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 241248 W: 64058 L: 64063 D: 113127
Ptnml(0-2): 644, 26679, 65960, 26720, 621

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/647b464854dd118e1d9928b2
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 24336 W: 6658 L: 6451 D: 11227
Ptnml(0-2): 8, 2316, 7312, 2525, 7

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

bench 2425813

16 months agoSearch tuning at very long time control with new net
Muzhen Gaming [Fri, 2 Jun 2023 11:55:25 +0000 (19:55 +0800)]
Search tuning at very long time control with new net

The most significant change would be the singularBeta formula.
It was first tested by cj5716 (see https://tests.stockfishchess.org/tests/view/647317c9d29264e4cfa74ec7),
and I took much inspiration from that idea.

LTC (fixed games): https://tests.stockfishchess.org/tests/view/6479d8da54dd118e1d990b12
Elo: 0.61 ± 1.2 (95%) LOS: 83.4%
Total: 60000 W: 16278 L: 16172 D: 27550
Ptnml(0-2): 16, 5845, 18179, 5937, 23
nElo: 1.38 ± 2.8 (95%) PairsRatio: 1.02

VLTC 180+1.8: https://tests.stockfishchess.org/tests/view/6479da1454dd118e1d990b2b
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 33224 W: 9261 L: 8984 D: 14979
Ptnml(0-2): 5, 2809, 10710, 3080, 8

SMP VLTC 8-thread: https://tests.stockfishchess.org/tests/view/647b0fe354dd118e1d992425
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 61398 W: 17386 L: 17081 D: 26931
Ptnml(0-2): 7, 4571, 21232, 4888, 1

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

Bench: 2805878

17 months agoSmall simplification for probcut in check
Michael Chaly [Wed, 31 May 2023 06:22:26 +0000 (09:22 +0300)]
Small simplification for probcut in check

Remove depth condition from there as not longer needed.

Passed STC:
https://tests.stockfishchess.org/tests/view/647367cad29264e4cfa753e6
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 254336 W: 67830 L: 67847 D: 118659
Ptnml(0-2): 580, 28181, 69697, 28096, 614

Passed LTC:
https://tests.stockfishchess.org/tests/view/647576184a36543c4c9f3af7
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 80706 W: 22048 L: 21898 D: 36760
Ptnml(0-2): 28, 7721, 24712, 7857, 35

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

bench 2381945

17 months agoSimplify nnue eval complexity calculation
Linmiao Xu [Sun, 28 May 2023 18:45:24 +0000 (14:45 -0400)]
Simplify nnue eval complexity calculation

Remove a multiplier when blending nnue complexity with semi-classical complexity.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/6473a71dd29264e4cfa75839
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 124768 W: 33180 L: 33060 D: 58528
Ptnml(0-2): 314, 13797, 34030, 13941, 302

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/6474af3dd29264e4cfa768f4
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 108180 W: 29008 L: 28884 D: 50288
Ptnml(0-2): 29, 10420, 33075, 10530, 36

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

bench 2316827

17 months agoUpdate NNUE architecture to SFNNv6 with larger L1 size of 1536
Linmiao Xu [Fri, 12 May 2023 22:07:20 +0000 (18:07 -0400)]
Update NNUE architecture to SFNNv6 with larger L1 size of 1536

Created by training a new net from scratch with L1 size increased from 1024 to 1536.
Thanks to Vizvezdenec for the idea of exploring larger net sizes after recent
training data improvements.

A new net was first trained with lambda 1.0 and constant LR 8.75e-4. Then a strong net
from a later epoch in the training run was chosen for retraining with start-lambda 1.0
and initial LR 4.375e-4 decaying with gamma 0.995. Retraining was performed a total of
3 times, for this 4-step process:

1. 400 epochs, lambda 1.0 on filtered T77+T79 v6 deduplicated data
2. 800 epochs, end-lambda 0.75 on T60T70wIsRightFarseerT60T74T75T76.binpack
3. 800 epochs, end-lambda 0.75 and early-fen-skipping 28 on the master dataset
4. 800 epochs, end-lambda 0.7 and early-fen-skipping 28 on the master dataset

In the training sequence that reached the new nn-8d69132723e2.nnue net,
the epochs used for the 3x retraining runs were:

1. epoch 379 trained on T77T79-filter-v6-dd.min.binpack
2. epoch 679 trained on T60T70wIsRightFarseerT60T74T75T76.binpack
3. epoch 799 trained on the master dataset

For training from scratch:

python3 easy_train.py \
  --experiment-name new-L1-1536-T77T79-filter-v6dd \
  --training-dataset /data/T77T79-filter-v6-dd.min.binpack \
  --max_epoch 400 \
  --lambda 1.0 \
  --start-from-engine-test-net False \
  --engine-test-branch linrock/Stockfish/L1-1536 \
  --nnue-pytorch-branch linrock/Stockfish/misc-fixes-L1-1536 \
  --tui False \
  --gpus "0," \
  --seed $RANDOM

Retraining commands were similar to each other. For the 3rd retraining run:

python3 easy_train.py \
  --experiment-name L1-1536-T77T79-v6dd-Re1-LeelaFarseer-Re2-masterDataset-Re3-sameData \
  --training-dataset /data/leela96-dfrc99-v2-T60novdecT80juntonovjanfebT79aprmayT78jantosepT77dec-v6dd.binpack \
  --early-fen-skipping 28 \
  --max_epoch 800 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --start-from-engine-test-net False \
  --start-from-model /data/L1-1536-T77T79-v6dd-Re1-LeelaFarseer-Re2-masterDataset-nn-epoch799.nnue \
  --engine-test-branch linrock/Stockfish/L1-1536 \
  --nnue-pytorch-branch linrock/nnue-pytorch/misc-fixes-L1-1536 \
  --tui False \
  --gpus "0," \
  --seed $RANDOM

The T77+T79 data used is a subset of the master dataset available at:
https://robotmoon.com/nnue-training-data/

T60T70wIsRightFarseerT60T74T75T76.binpack is available at:
https://drive.google.com/drive/folders/1S9-ZiQa_3ApmjBtl2e8SyHxj4zG4V8gG

Local elo at 25k nodes per move vs. nn-e1fb1ade4432.nnue (L1 size 1024):
nn-epoch759.nnue : 26.9 +/- 1.6

Failed STC
https://tests.stockfishchess.org/tests/view/64742485d29264e4cfa75f97
LLR: -2.94 (-2.94,2.94) <0.00,2.00>
Total: 13728 W: 3588 L: 3829 D: 6311
Ptnml(0-2): 71, 1661, 3610, 1482, 40

Failing LTC
https://tests.stockfishchess.org/tests/view/64752d7c4a36543c4c9f3618
LLR: -1.91 (-2.94,2.94) <0.50,2.50>
Total: 35424 W: 9522 L: 9603 D: 16299
Ptnml(0-2): 24, 3579, 10585, 3502, 22

Passed VLTC 180+1.8
https://tests.stockfishchess.org/tests/view/64752df04a36543c4c9f3638
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 47616 W: 13174 L: 12863 D: 21579
Ptnml(0-2): 13, 4261, 14952, 4566, 16

Passed VLTC SMP 60+0.6 th 8
https://tests.stockfishchess.org/tests/view/647446ced29264e4cfa761e5
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 19942 W: 5694 L: 5451 D: 8797
Ptnml(0-2): 6, 1504, 6707, 1749, 5

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

bench 2222567

17 months agoRemoved quadratic term in optimism
windfishballad [Tue, 23 May 2023 00:13:44 +0000 (20:13 -0400)]
Removed quadratic term in optimism

Remove term which is quadratic in optimism in the eval.
Simplifies and should also remove the bias towards side to move making the eval better for analysis.

STC: https://tests.stockfishchess.org/tests/view/6470a9d8c29e0d4352b0bca5
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 154432 W: 41127 L: 41040 D: 72265
Ptnml(0-2): 380, 17094, 42190, 17163, 389

LTC: https://tests.stockfishchess.org/tests/view/6471e9b3e549d9cf2fb219ef
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 127926 W: 34474 L: 34369 D: 59083
Ptnml(0-2): 43, 12505, 38776, 12582, 57

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

Bench: 2541211

17 months agoUpdate CPU contributors list
Joost VandeVondele [Sat, 27 May 2023 16:01:08 +0000 (18:01 +0200)]
Update CPU contributors list

update CPU contributors list, the previous update was a couple of months ago,
and unfortunately, was not quite accurate for the number of games played.

This version is based clean calculation from the DB and
an updated script that tracks things (see https://github.com/glinscott/fishtest/pull/1702).

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

No functional change

17 months agoRemove ss->ttHit condition where ttValue != VALUE_NONE
cj5716 [Thu, 25 May 2023 06:34:52 +0000 (14:34 +0800)]
Remove ss->ttHit condition where ttValue != VALUE_NONE

Simplification is done at 3 separate places in the code.
Thanks to peregrineshahin for helping me find 2 of such places.
(See original PR #4584)

Passed non-regression test
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 120256 W: 32204 L: 32085 D: 55967
Ptnml(0-2): 292, 12473, 34483, 12584, 296
https://tests.stockfishchess.org/tests/view/646f045968661bfd984325e3

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

No functional change

17 months agoSimplify Futility pruning for captures
FauziAkram [Tue, 23 May 2023 17:36:47 +0000 (20:36 +0300)]
Simplify Futility pruning for captures

Passed STC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 412928 W: 109433 L: 109620 D: 193875
Ptnml(0-2): 1071, 45929, 112650, 45744, 1070
https://tests.stockfishchess.org/tests/view/6468eac40db5177f2b76ef4d

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 190200 W: 51465 L: 51420 D: 87315
Ptnml(0-2): 58, 18585, 57788, 18592, 77
https://tests.stockfishchess.org/tests/view/646b66520db5177f2b772a84

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

bench: 2486604

17 months agoSimplify Prune moves with negative SEE
FauziAkram [Sun, 21 May 2023 13:22:28 +0000 (16:22 +0300)]
Simplify Prune moves with negative SEE

Passed STC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 57760 W: 15472 L: 15286 D: 27002
Ptnml(0-2): 123, 6025, 16430, 6147, 155
https://tests.stockfishchess.org/tests/view/6468eb6b0db5177f2b76ef62

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 93966 W: 25274 L: 25141 D: 43551
Ptnml(0-2): 33, 8498, 29792, 8623, 37
https://tests.stockfishchess.org/tests/view/6469570b0db5177f2b76f81b

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

Bench: 2304063

17 months agoSimplify delta calculation in aspiration window
Muzhen Gaming [Sat, 20 May 2023 13:28:54 +0000 (21:28 +0800)]
Simplify delta calculation in aspiration window

Simplification STC: https://tests.stockfishchess.org/tests/view/6468cb200db5177f2b76ecbb
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 220416 W: 58503 L: 58487 D: 103426
Ptnml(0-2): 596, 24384, 60188, 24488, 552

Simplification LTC: https://tests.stockfishchess.org/tests/view/646a15840db5177f2b770704
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 177756 W: 47882 L: 47825 D: 82049
Ptnml(0-2): 55, 17430, 53858, 17473, 62

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

Bench: 2304063

17 months agoMore Depth Reduction
candirufish [Sun, 21 May 2023 22:14:55 +0000 (00:14 +0200)]
More Depth Reduction

Reduce more for depth > 3 and depth < 12

LTC: https://tests.stockfishchess.org/tests/view/646c5abbd1f14fd69a6f2fab
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 197280 W: 53405 L: 52797 D: 91078
Ptnml(0-2): 62, 19025, 59886, 19577, 90

STC: https://tests.stockfishchess.org/tests/view/646bee71d1f14fd69a6f259d
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 100832 W: 26861 L: 26466 D: 47505
Ptnml(0-2): 240, 10985, 27622, 11278, 291

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

bench: 2276617

17 months agoSmall simplification in low depth pruning
Michael Chaly [Sat, 13 May 2023 21:30:35 +0000 (00:30 +0300)]
Small simplification in low depth pruning

Uncap low depth pruning lmr depth.
It's anyway capped for most cases apart from futility pruning for captures - removes one std::min call.

Passed STC:
https://tests.stockfishchess.org/tests/view/645e8fa6d55cccb2e64225a1
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 184064 W: 49039 L: 48982 D: 86043
Ptnml(0-2): 462, 20353, 50349, 20402, 466

Passed LTC:
https://tests.stockfishchess.org/tests/view/645f4d48d55cccb2e6423335
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 83886 W: 22613 L: 22465 D: 38808
Ptnml(0-2): 31, 8090, 25546, 8252, 24

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

bench 3201883

17 months agoSimplify SEE verfication logic
pb00067 [Wed, 17 May 2023 07:22:02 +0000 (09:22 +0200)]
Simplify SEE verfication logic

Passed STC
https://tests.stockfishchess.org/tests/view/6461d51887f6567dd4df27d0
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 177056 W: 47181 L: 47118 D: 82757
Ptnml(0-2): 456, 19381, 48792, 19442, 457

Passed LTC
https://tests.stockfishchess.org/tests/view/64631a9287f6567dd4df4502
2.94 (-2.94,2.94) <-1.75,0.25>
Total: 104346 W: 28062 L: 27935 D: 48349
Ptnml(0-2): 25, 10190, 31631, 10287, 40

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

bench: 2903251

17 months agoSimplify optimism calculation
xoto10 [Fri, 19 May 2023 18:58:18 +0000 (19:58 +0100)]
Simplify optimism calculation

This change removes one of the constants in the calculation of optimism. It also changes the 2 constants used with the scale value so that they are independent, instead of applying a constant to the scale and then adjusting it again when it is applied to the optimism. This might make the tuning of these constants cleaner and more reliable in the future.

STC 10+0.1 (accidentally run as an Elo gainer:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 154080 W: 41119 L: 40651 D: 72310
Ptnml(0-2): 375, 16840, 42190, 17212, 423
https://tests.stockfishchess.org/tests/live_elo/64653eabf3b1a4e86c317f77

LTC 60+0.6:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 217434 W: 58382 L: 58363 D: 100689
Ptnml(0-2): 66, 21075, 66419, 21088, 69
https://tests.stockfishchess.org/tests/live_elo/6465d077f3b1a4e86c318d6c

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

bench: 3190961

17 months agoSmall simplification in history pruning.
Stefan Geschwentner [Fri, 19 May 2023 21:16:48 +0000 (23:16 +0200)]
Small simplification in history pruning.

Remove the constant term of the history threshold which lowers the chance that pruning occurs.
As compensation allow pruning at a slightly higher depth.

Passed STC:
https://tests.stockfishchess.org/tests/view/64634c9a87f6567dd4df4901
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 101536 W: 27156 L: 27012 D: 47368
Ptnml(0-2): 266, 11165, 27772, 11289, 276

Passed LTC:
https://tests.stockfishchess.org/tests/view/6463d68b17982fde89d2bc2b
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 32154 W: 8741 L: 8543 D: 14870
Ptnml(0-2): 8, 3093, 9687, 3271, 18

Passed LTC: retest on top of VLTC tuning PR 4571 because this changes the history depth factor (use this new factor here)
https://tests.stockfishchess.org/tests/view/6467300e165c4b29ec0afd3f
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 99270 W: 26840 L: 26707 D: 45723
Ptnml(0-2): 36, 9753, 29928, 9878, 40

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

Bench: 2984341

17 months agoSearch tuning at very long time control
Muzhen Gaming [Tue, 16 May 2023 13:30:53 +0000 (21:30 +0800)]
Search tuning at very long time control

Many search parameter changes, tuned
(https://tests.stockfishchess.org/tests/view/645e4c67d55cccb2e64220ff)
at ~300k games @ VLTC (120+1.2).

Failed STC:
https://tests.stockfishchess.org/tests/view/6465fcd77968ca827c1410c2
LLR: -2.95 (-2.94,2.94) <0.00,2.00>
Total: 33824 W: 8863 L: 9067 D: 15894
Ptnml(0-2): 89, 3833, 9266, 3641, 83

Neutral LTC:
https://tests.stockfishchess.org/tests/view/646385ce87f6567dd4df4e37
Elo: -0.48 +-1.2 (95%) LOS: 22.2%
Total: 60000 W: 16235 L: 16318 D: 27447
Ptnml(0-2): 27, 5831, 18366, 5750, 26
nElo: -1.08 +-2.8 (95%) PairsRatio: 0.99

Passed VLTC 180+1.8:
https://tests.stockfishchess.org/tests/view/646385f787f6567dd4df4e3e
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 126448 W: 34704 L: 34258 D: 57486
Ptnml(0-2): 9, 10970, 40825, 11406, 14

Passed VLTC SMP 60+0.6 8thread:
https://tests.stockfishchess.org/tests/view/646628de884ce93b65df2ac9
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 59456 W: 16791 L: 16487 D: 26178
Ptnml(0-2): 5, 4473, 20467, 4779, 4

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

Bench: 3347573

17 months agoUpdate WLD model
Joost VandeVondele [Fri, 19 May 2023 21:02:27 +0000 (23:02 +0200)]
Update WLD model

using data of May, recalibrate the WLD model.

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

No functional change

17 months agoRefine deeper post-lmr searches
Michael Chaly [Sun, 7 May 2023 20:33:04 +0000 (23:33 +0300)]
Refine deeper post-lmr searches

This patch improves logic conditions for performing deeper searches after passed LMR.

Instead of exceeding alpha by some margin now it requires to exceed the
current best value - which may be lower than alpha (but never bigger since we
update alpha with bestvalue if it exceeds alpha).

Passed STC:
https://tests.stockfishchess.org/tests/view/6455f78008858de8313775b6
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 209344 W: 55993 L: 55448 D: 97903
Ptnml(0-2): 507, 22798, 57526, 23325, 516

Passed LTC:
https://tests.stockfishchess.org/tests/view/64572d46eb75932ccfebff97
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 66288 W: 17867 L: 17514 D: 30907
Ptnml(0-2): 21, 6240, 20269, 6593, 21

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

bench 3808503

17 months agoSmall cleanup
Michael Chaly [Fri, 5 May 2023 20:32:56 +0000 (23:32 +0300)]
Small cleanup

In search remove one condition check and reorder conditions. Removes some code.

Passed non-regression test:
https://tests.stockfishchess.org/tests/view/64548fa06206ee34ebf853ad
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 282976 W: 75327 L: 75374 D: 132275
Ptnml(0-2): 604, 29673, 80995, 29598, 618

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

No functional change

17 months agoClean up after "Simplify away complexity in evaluation"
peregrineshahin [Wed, 3 May 2023 11:11:55 +0000 (14:11 +0300)]
Clean up after "Simplify away complexity in evaluation"

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

No functional change.

17 months agoReduce more if current node has a lot of refuted moves.
Michael Chaly [Fri, 5 May 2023 04:54:12 +0000 (07:54 +0300)]
Reduce more if current node has a lot of refuted moves.

This patch refines idea of cutoff count - in master we reduce more if current node has at least 4 moves that are refuted by search, this patch increases this count by 1 if refutation happened without having a tt move.

Passed STC:
https://tests.stockfishchess.org/tests/view/645363c36206ee34ebf8191d
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 67616 W: 18220 L: 17874 D: 31522
Ptnml(0-2): 142, 7346, 18504, 7656, 160

Passed LTC:
https://tests.stockfishchess.org/tests/view/6453a0ea6206ee34ebf82796
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 195228 W: 52741 L: 52140 D: 90347
Ptnml(0-2): 53, 18718, 59482, 19297, 64

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

bench 3448916

17 months agoAdjust reductions
candirufish [Fri, 28 Apr 2023 17:05:56 +0000 (19:05 +0200)]
Adjust reductions

Decrease further on cutNodes with tte->depth() >= depth + 3 condition.

LTC: https://tests.stockfishchess.org/tests/view/644dc84bccf5e93df5e50c13
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 155346 W: 42184 L: 41660 D: 71502
Ptnml(0-2): 59, 14765, 47504, 15283, 62

STC: https://tests.stockfishchess.org/tests/view/644d05de68e01d8194cd9bbb
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 121888 W: 32868 L: 32444 D: 56576
Ptnml(0-2): 332, 13273, 33343, 13631, 365

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

bench: 3739675

17 months agoUpdate 7 eval and optimism params
Linmiao Xu [Sat, 29 Apr 2023 19:45:22 +0000 (15:45 -0400)]
Update 7 eval and optimism params

Params found using spsa at 30+0.3 with this tuning config:

```
// evaluate.cpp
int nnueOptScaleBase = 1001;
int nnueComplexityMult = 406;
int nnueComplexityOptOffset = 424;
int evalOptComplexityOffset = 272;
int evalOptScaleOffset = 748;
TUNE(SetRange(801, 1201), nnueOptScaleBase);
TUNE(SetRange(306, 506), nnueComplexityMult);
TUNE(SetRange(324, 524), nnueComplexityOptOffset);
TUNE(SetRange(172, 372), evalOptComplexityOffset);
TUNE(SetRange(648, 848), evalOptScaleOffset);

// search.cpp
int searchOptBase = 120;
int searchOptDenom = 161;
TUNE(SetRange(20, 220), searchOptBase);
TUNE(SetRange(111, 211), searchOptDenom);
```

Passed STC:
https://tests.stockfishchess.org/tests/view/644dda8accf5e93df5e50cbe
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 136800 W: 36682 L: 36237 D: 63881
Ptnml(0-2): 353, 14910, 37492, 15229, 416

Passed LTC:
https://tests.stockfishchess.org/tests/view/644eaedb3f31c3bbe4a3d345
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 64548 W: 17624 L: 17272 D: 29652
Ptnml(0-2): 33, 6112, 19631, 6466, 32

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

bench 3670343

18 months agoUpdate default net to nn-e1fb1ade4432.nnue
Linmiao Xu [Fri, 21 Apr 2023 13:37:29 +0000 (09:37 -0400)]
Update default net to nn-e1fb1ade4432.nnue

Created by retraining nn-dabb1ed23026.nnue with a dataset composed of:

* The previous best dataset (nn-1ceb1a57d117.nnue dataset)
* Adding de-duplicated T80 data from feb2023 and the last 10 days of jan2023, filtered with v6-dd

Initially trained with the same options as the recent master net (nn-1ceb1a57d117.nnue).
Around epoch 890, training was manually stopped and max epoch increased to 1000.

```
python3 easy_train.py \
  --experiment-name leela96-dfrc99-T60novdec-v2-T80augsep-v6-T80junjuloctnovjanfebT79aprmayT78jantosepT77dec-v6dd \
  --training-dataset /data/leela96-dfrc99-T60novdec-v2-T80augsep-v6-T80junjuloctnovjanfebT79aprmayT78jantosepT77dec-v6dd.binpack \
  --nnue-pytorch-branch linrock/nnue-pytorch/misc-fixes \
  --start-from-engine-test-net True \
  --early-fen-skipping 30 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --max_epoch 900 \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --tui False \
  --gpus "0," \
  --seed $RANDOM
```

The same v6-dd filtering and binpack minimizer was used for preparing the recent nn-1ceb1a57d117.nnue dataset.

```
python3 interleave_binpacks.py \
  leela96-filt-v2.binpack \
  dfrc99-filt-v2.binpack \
  T60-nov2021-12tb7p-eval-filt-v2.binpack \
  T60-dec2021-12tb7p-eval-filt-v2.binpack \
  filt-v6/test80-aug2022-16tb7p-filter-v6.min-mar2023.binpack \
  filt-v6/test80-sep2022-16tb7p-filter-v6.min-mar2023.binpack \
  filt-v6-dd/test80-jun2022-16tb7p-filter-v6-dd.min-mar2023.binpack \
  filt-v6-dd/test80-jul2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test80-oct2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test80-nov2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test80-jan2022-3of3-16tb7p-filter-v6-dd.min-mar2023.binpack \
  filt-v6-dd/test80-feb2023-16tb7p-filter-v6-dd.min-mar2023.binpack \
  filt-v6-dd/test79-apr2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test79-may2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test78-jantomay2022-16tb7p-filter-v6-dd.min-mar2023.binpack \
  filt-v6-dd/test78-juntosep2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test77-dec2021-16tb7p-filter-v6-dd.binpack \
  /data/leela96-dfrc99-T60novdec-v2-T80augsep-v6-T80junjuloctnovjanfebT79aprmayT78jantosepT77dec-v6dd.binpack
```

Links for downloading the training data components can be found at:
https://robotmoon.com/nnue-training-data/

Local elo at 25k nodes per move:
nn-epoch919.nnue : 2.6 +/- 2.8

Passed STC vs. nn-dabb1ed23026.nnue
https://tests.stockfishchess.org/tests/view/644420df94ff3db5625f2af5
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 125960 W: 33898 L: 33464 D: 58598
Ptnml(0-2): 351, 13920, 34021, 14320, 368

Passed LTC vs. nn-1ceb1a57d117.nnue
https://tests.stockfishchess.org/tests/view/64469f128d30316529b3dc46
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 24544 W: 6817 L: 6542 D: 11185
Ptnml(0-2): 8, 2252, 7488, 2505, 19

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

bench 3714847

18 months agoCreated by retraining the master net with these changes to the dataset:
Linmiao Xu [Sat, 15 Apr 2023 13:51:01 +0000 (09:51 -0400)]
Created by retraining the master net with these changes to the dataset:

* Extending v6 filtering to data from T77 dec2021, T79 may2022, and T80 nov2022
* Reducing the number of duplicate positions, prioritizing position scores seen later in time
* Using a binpack minimizer to reduce the overall data size

Trained the same way as the previous master net, aside from the dataset changes:

```
python3 easy_train.py \
  --experiment-name leela96-dfrc99-T60novdec-v2-T80augsep-v6-T80junjuloctnovT79aprmayT78jantosepT77dec-v6dd \
  --training-dataset /data/leela96-dfrc99-T60novdec-v2-T80augsep-v6-T80junjuloctnovT79aprmayT78jantosepT77dec-v6dd.binpack \
  --nnue-pytorch-branch linrock/nnue-pytorch/misc-fixes \
  --start-from-engine-test-net True \
  --early-fen-skipping 30 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --max_epoch 900 \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --tui False \
  --gpus "0," \
  --seed $RANDOM
```

The new v6-dd filtering reduces duplicate positions by iterating over hourly data files within leela test runs, starting with the most recent, then keeping positions the first time they're seen and ignoring positions that are seen again. This ordering was done with the assumption that position scores seen later in time are generally more accurate than scores seen earlier in the test run. Positions are de-duplicated based on piece orientations, the first token in fen strings.

The binpack minimizer was run with default settings after first merging monthly data into single binpacks.

```
python3 interleave_binpacks.py \
  leela96-filt-v2.binpack \
  dfrc99-filt-v2.binpack \
  T60-nov2021-12tb7p-eval-filt-v2.binpack \
  T60-dec2021-12tb7p-eval-filt-v2.binpack \
  filt-v6/test80-aug2022-16tb7p-filter-v6.min-mar2023.binpack \
  filt-v6/test80-sep2022-16tb7p-filter-v6.min-mar2023.binpack \
  filt-v6-dd/test80-jun2022-16tb7p-filter-v6-dd.min-mar2023.binpack \
  filt-v6-dd/test80-jul2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test80-oct2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test80-nov2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test79-apr2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test79-may2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test78-jantomay2022-16tb7p-filter-v6-dd.min-mar2023.binpack \
  filt-v6-dd/test78-juntosep2022-16tb7p-filter-v6-dd.binpack \
  filt-v6-dd/test77-dec2021-16tb7p-filter-v6-dd.binpack \
  /data/leela96-dfrc99-T60novdec-v2-T80augsep-v6-T80junjuloctnovT79aprmayT78jantosepT77dec-v6dd.binpack
```

The code for v6-dd filtering is available along with training data preparation scripts at:
https://github.com/linrock/nnue-data

Links for downloading the training data components:
https://robotmoon.com/nnue-training-data/

The binpack minimizer is from: #4447

Local elo at 25k nodes per move:
nn-epoch859.nnue : 1.2 +/- 2.6

Passed STC:
https://tests.stockfishchess.org/tests/view/643aad7db08900ff1bc5a832
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 565040 W: 150225 L: 149162 D: 265653
Ptnml(0-2): 1875, 62137, 153229, 63608, 1671

Passed LTC:
https://tests.stockfishchess.org/tests/view/643ecf2fa43cf30e719d2042
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 1014840 W: 274645 L: 272456 D: 467739
Ptnml(0-2): 515, 98565, 306970, 100956, 414

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

bench 3476305

18 months agoUpdate AUTHORS
Boštjan Mejak [Tue, 11 Apr 2023 11:55:14 +0000 (13:55 +0200)]
Update AUTHORS

Improved some comments in the AUTHORS file, sort contributors

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

No functional change

18 months agoLess reduction for tt move.
Stefan Geschwentner [Fri, 21 Apr 2023 14:22:55 +0000 (16:22 +0200)]
Less reduction for tt move.

This idea is a result of my second condition combination tuning for reductions:
https://tests.stockfishchess.org/tests/view/643ed5573806eca398f06d61

There were used two parameters per combination: one for the 'sign' of the first and the second condition in a combination. Values >= 50 indicate using a condition directly and values <= -50 means use the negation of a condition.

Each condition pair (X,Y) had two occurances dependent of the order of the two conditions:
- if X < Y the parameters used for more reduction
- if X > Y the parameters used for less reduction
- if X = Y then only one condition is present and A[X][X][0]/A[X][X][1] stands for using more/less reduction for only this condition.

The parameter pair A[7][2][0] (value = -94.70) and A[7][2][1] (value = 93.60) was one of the strongest signals with values near 100/-100.
Here condition nr. 7 was '(ss+1)->cutoffCnt > 3' and condition nr. 2 'move == ttMove'. For condition nr. 7 the negation is used because A[7][2][0] is negative.

This translates finally to less reduction (because 7 > 2) for tt moves if child cutoffs <= 3.

STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 65728 W: 17704 L: 17358 D: 30666
Ptnml(0-2): 184, 7092, 18008, 7354, 226
https://tests.stockfishchess.org/tests/view/643ff767ef2529086a7ed042

LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 139200 W: 37776 L: 37282 D: 64142
Ptnml(0-2): 58, 13241, 42509, 13733, 59
https://tests.stockfishchess.org/tests/view/6440bfa9ef2529086a7edbc7

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

Bench: 3548023

18 months agoSimplify away depth condition for aspiration window adjust
Muzhen Gaming [Fri, 14 Apr 2023 12:33:33 +0000 (20:33 +0800)]
Simplify away depth condition for aspiration window adjust

Simplification STC:
https://tests.stockfishchess.org/tests/view/64351654596a20f264276ded
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 374664 W: 98942 L: 99089 D: 176633
Ptnml(0-2): 1049, 41767, 101878, 41558, 1080

Simplification LTC:
https://tests.stockfishchess.org/tests/view/6439499f605991a801b4f684
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 457880 W: 123021 L: 123233 D: 211626
Ptnml(0-2): 166, 44739, 139335, 44541, 159

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

Bench: 3879281

18 months agoSimplification of SEE verification logic
Guenther Demetz [Mon, 17 Apr 2023 09:38:26 +0000 (11:38 +0200)]
Simplification of SEE verification logic

Use same logic for all handled pieces.
Don't prune the move if opponent King, Queen, Rook gets a discovered
attack while or after the exchanges.

remove an obsolete comment in position.cpp

Passed STC non regression:
https://tests.stockfishchess.org/tests/view/6437907594daa91835c290d0
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 107432 W: 28359 L: 28221 D: 50852
Ptnml(0-2): 298, 11724, 29524, 11882, 288

Passed LTC non-regression:
https://tests.stockfishchess.org/tests/view/6438ed2ebd1a5470263c51e8
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 236288 W: 63656 L: 63656 D: 108976
Ptnml(0-2): 99, 22960, 72011, 22990, 84

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

bench: 3741125

18 months agoSimplify away complexity in evaluation
Muzhen Gaming [Fri, 14 Apr 2023 12:48:22 +0000 (20:48 +0800)]
Simplify away complexity in evaluation

Simplification STC: https://tests.stockfishchess.org/tests/view/64394bc0605991a801b4f6f0
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 72360 W: 19313 L: 19138 D: 33909
Ptnml(0-2): 206, 7883, 19800, 8112, 179

Simplification LTC: https://tests.stockfishchess.org/tests/view/6439e788c233ce943b6bdac1
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 224992 W: 60665 L: 60654 D: 103673
Ptnml(0-2): 96, 21875, 68526, 21920, 79

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

Bench: 3709369

18 months agoSet the length of GIT_SHA to 8 characters
Torom [Thu, 13 Apr 2023 19:55:13 +0000 (21:55 +0200)]
Set the length of GIT_SHA to 8 characters

Previously, the length of git commit hashes could vary depending on the git environment.

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

No functional change

18 months agoRemove some conditions at PV improvement reduction
MinetaS [Fri, 7 Apr 2023 14:49:05 +0000 (14:49 +0000)]
Remove some conditions at PV improvement reduction

Non-regression STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 63664 W: 17007 L: 16823 D: 29834
Ptnml(0-2): 163, 6998, 17336, 7162, 173
https://tests.stockfishchess.org/tests/view/6430b124028b029b01ac99f2

Non-regression LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 90016 W: 24399 L: 24258 D: 41359
Ptnml(0-2): 52, 8672, 27405, 8841, 38
https://tests.stockfishchess.org/tests/view/64310e74028b029b01ad3131

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

Bench: 3661938

18 months agoSimplify stats assignment for Pv nodes
Michael Chaly [Tue, 11 Apr 2023 16:53:36 +0000 (19:53 +0300)]
Simplify stats assignment for Pv nodes

This patch is a simplification of my recent elo gainer.
Logically the Elo gainer didn't make much sense and this patch simplifies it into smth more logical.
Instead of assigning negative bonuses to all non-first moves that enter PV nodes
we assign positive bonuses in full depth search after LMR only for moves that
will result in a fail high - thus not assigning positive bonuses
for moves that will go to pv search - so doing "almost" the same as we do in master now for them.
Logic differs for some other moves, though, but this removes some lines of code.

Passed STC:
https://tests.stockfishchess.org/tests/view/642cf5cf77ff3301150dc5ec
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 409320 W: 109124 L: 109308 D: 190888
Ptnml(0-2): 1149, 45385, 111751, 45251, 1124

Passed LTC:
https://tests.stockfishchess.org/tests/view/642fe75d20eb941419bde200
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 260336 W: 70280 L: 70303 D: 119753
Ptnml(0-2): 99, 25236, 79528, 25199, 106

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

Bench:  4286815

18 months agoRemove good killer reduction rule.
Stefan Geschwentner [Mon, 10 Apr 2023 23:20:29 +0000 (01:20 +0200)]
Remove good killer reduction rule.

STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 246544 W: 65646 L: 65657 D: 115241
Ptnml(0-2): 706, 27350, 67138, 27405, 673
https://tests.stockfishchess.org/tests/view/642e253277ff3301150e9aa2

LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 165136 W: 44878 L: 44809 D: 75449
Ptnml(0-2): 64, 15991, 50378, 16082, 53
https://tests.stockfishchess.org/tests/view/6430db07028b029b01acd87f

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

Bench: 3746080

18 months agoRemove nmpColor
Dubslow [Thu, 6 Apr 2023 01:30:01 +0000 (20:30 -0500)]
Remove nmpColor

no benefit seen, neither in game play nor for zugzwang test positions

STC: https://tests.stockfishchess.org/tests/view/642e293977ff3301150e9b55
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 161848 W: 43332 L: 43254 D: 75262
Ptnml(0-2): 418, 16987, 46058, 17021, 440

LTC: https://tests.stockfishchess.org/tests/view/642fea9420eb941419bde296
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 120208 W: 32529 L: 32418 D: 55261
Ptnml(0-2): 35, 11424, 37080, 11525, 40

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

bench 3979409

18 months agoFix capturing underpromotions issue
peregrineshahin [Thu, 16 Mar 2023 21:04:41 +0000 (00:04 +0300)]
Fix capturing underpromotions issue

Fix underpromotion captures are generated amongst quiets although dealt with as a capture_stage in search, this makes not skipping them when move count pruning kicks-in consistent with updating their histories amongst captures.

Passed STC:
https://tests.stockfishchess.org/tests/view/6415579f65775d3b539e7537
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 118896 W: 31678 L: 31553 D: 55665
Ptnml(0-2): 356, 12911, 32793, 13028, 360

Passed LTC:
https://tests.stockfishchess.org/tests/view/641633b965775d3b539e9e95
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 126800 W: 34255 L: 34148 D: 58397
Ptnml(0-2): 57, 12216, 38763, 12291, 73

see also discussion in https://github.com/official-stockfish/Stockfish/pull/4436
closes https://github.com/official-stockfish/Stockfish/pull/4452

bench: 3979409

18 months agoSimplify away nnue scale pawn count multiplier
Linmiao Xu [Fri, 7 Apr 2023 16:33:28 +0000 (12:33 -0400)]
Simplify away nnue scale pawn count multiplier

Removes 2x multipliers in nnue scale calculation along with the pawn count term that was recently reintroduced.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/64305bc720eb941419bdf72e
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 38008 W: 10234 L: 10021 D: 17753
Ptnml(0-2): 96, 4151, 10323, 4312, 122

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/6430b76a028b029b01ac9bfd
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 91232 W: 24686 L: 24547 D: 41999
Ptnml(0-2): 30, 8721, 27986, 8838, 41

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

bench 4017320

18 months agoDo no initialize TM in all cases
Maxim Masiutin [Sat, 1 Apr 2023 20:49:03 +0000 (23:49 +0300)]
Do no initialize TM in all cases

Avoid doing full TM initialization if it won't be used, avoids division by zero.

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

No functional change

18 months agoReduce Position::pieces() overloads
mstembera [Wed, 5 Apr 2023 02:44:09 +0000 (19:44 -0700)]
Reduce Position::pieces() overloads

Reduce the number of overloads for pieces() by using a more general template implementation.
Secondly simplify some code in search.cpp using the new general functionality.

TC https://tests.stockfishchess.org/tests/view/642ce27877ff3301150dc193
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 269640 W: 71775 L: 71809 D: 126056
Ptnml(0-2): 687, 27294, 78885, 27274, 680

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

No functional change.

18 months agoMade two specializations for affine transform easier to understand.
Maxim Masiutin [Thu, 6 Apr 2023 11:08:50 +0000 (14:08 +0300)]
Made two specializations for affine transform easier to understand.

Added AVX-512 for the specialization for small inputs

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

No functional change

18 months agoRemove extraReduction
MinetaS [Fri, 7 Apr 2023 14:30:59 +0000 (14:30 +0000)]
Remove extraReduction

Since bestValue becomes value and beta - alpha is always non-negative,
extraReduction is always false, hence it has no effect.

This patch includes small changes to improve readability.

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

No functional change

18 months agoUse int conversion for Option class
MinetaS [Fri, 7 Apr 2023 15:23:04 +0000 (15:23 +0000)]
Use int conversion for Option class

The current implementation generates warnings on MSVC. However, we have
no real use cases for double-typed UCI option values now. Also parameter
tuning only accepts following three types:

  int, Value, Score

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

No functional change

18 months agoFix linking / character types of windows API calls
Maxim Masiutin [Sat, 1 Apr 2023 17:14:41 +0000 (20:14 +0300)]
Fix linking / character types of windows API calls

ensures large pages can be allocated again.

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

No functional change

18 months agoFix rootComplexity calculation
Joost VandeVondele [Sun, 9 Apr 2023 07:18:29 +0000 (09:18 +0200)]
Fix rootComplexity calculation

The calculation of rootComplexity can't call eval when in check.
Doing so triggers an assert if compiled in debug mode when
the rootpos is evaluated using classical eval.

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

Passed STC:
https://tests.stockfishchess.org/tests/view/6432697431feee5c6d306876
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 41096 W: 11017 L: 10815 D: 19264
Ptnml(0-2): 113, 4172, 11780, 4366, 117

Running LTC:
https://tests.stockfishchess.org/tests/view/6432974d31feee5c6d306fc0
LLR: 1.76 (-2.94,2.94) <-1.75,0.25>
Total: 73200 W: 19792 L: 19728 D: 33680
Ptnml(0-2): 24, 6659, 23182, 6699, 36

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

No functional change

18 months agoDepth Tweak and tuning
FauziAkram [Wed, 5 Apr 2023 21:35:05 +0000 (00:35 +0300)]
Depth Tweak and tuning

tunes reduction related parameters, and introduces more reduction on found good moves.

credit for this patch goes also to candirufish Yoshie2000 dubslow peregrineshahin Vizvezdenec

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 38424 W: 10346 L: 10040 D: 18038
Ptnml(0-2): 103, 4111, 10473, 4427, 98
https://tests.stockfishchess.org/tests/view/642ca74277ff3301150db511

Passed LTC:
LLR: 2.97 (-2.94,2.94) <0.50,2.50>
Total: 136968 W: 37151 L: 36660 D: 63157
Ptnml(0-2): 43, 13052, 41808, 13533, 48
https://tests.stockfishchess.org/tests/view/642d632377ff3301150dddbe

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

bench: 3672914

18 months agoAssign negative stat bonuses for quiet moves at Pv nodes
Michael Chaly [Wed, 5 Apr 2023 02:48:34 +0000 (05:48 +0300)]
Assign negative stat bonuses for quiet moves at Pv nodes

This patch assigns negative stat bonuses for quiet moves
at pv nodes which are searched at depth greater than
this node assumes, so are extended.

Passed STC:
https://tests.stockfishchess.org/tests/view/6426198bdb43ab2ba6f9cfa2
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 548944 W: 147287 L: 146254 D: 255403
Ptnml(0-2): 1662, 59772, 150671, 60605, 1762

Passed LTC:
https://tests.stockfishchess.org/tests/view/642be4f177ff3301150d892d
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 93352 W: 25400 L: 24994 D: 42958
Ptnml(0-2): 44, 8817, 28547, 9225, 43

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

bench 5044536

18 months agoSimplify away piece count condition for useClassical
Muzhen Gaming [Tue, 4 Apr 2023 23:25:00 +0000 (07:25 +0800)]
Simplify away piece count condition for useClassical

Simplify away the piece count condition for useClassical. In compensation, the psq requirement is increased by 15%.

Also updated the Elo estimate for useClassical, based on recent testing.

Simplification STC:
https://tests.stockfishchess.org/tests/view/642acbb577ff3301150d3ef5
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 51984 W: 13906 L: 13707 D: 24371
Ptnml(0-2): 150, 5638, 14227, 5817, 160

Simplification LTC:
https://tests.stockfishchess.org/tests/view/642b9c5777ff3301150d778a
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 119696 W: 32412 L: 32300 D: 54984
Ptnml(0-2): 53, 11529, 36567, 11651, 48

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

Bench: 5089321

18 months agoParameters Tweak
FauziAkram [Tue, 4 Apr 2023 11:26:29 +0000 (14:26 +0300)]
Parameters Tweak

Passed STC
LLR: 3.22 (-2.94,2.94) <0.00,2.00>
Total: 664048 W: 177526 L: 176301 D: 310221
Ptnml(0-2): 2002, 72968, 180891, 74129, 2034
https://tests.stockfishchess.org/tests/view/64219901db43ab2ba6f901fa

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 77576 W: 21125 L: 20750 D: 35701
Ptnml(0-2): 24, 7350, 23669, 7717, 28
https://tests.stockfishchess.org/tests/view/642abe3377ff3301150d3a16

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

bench: 4522076

18 months agoSimplifiy TM's root complexity
Dubslow [Sat, 1 Apr 2023 23:48:31 +0000 (18:48 -0500)]
Simplifiy TM's root complexity

Also requires moving optimism initialization, this is a very early `evaluate()` call.

STC: https://tests.stockfishchess.org/tests/view/6428c39677ff3301150ca0d7
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 51256 W: 13805 L: 13612 D: 23839
Ptnml(0-2): 145, 5283, 14592, 5450, 158

LTC: https://tests.stockfishchess.org/tests/view/64296ff377ff3301150cc519
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 106968 W: 28951 L: 28830 D: 49187
Ptnml(0-2): 47, 9746, 33789, 9843, 59

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

no functional change

18 months agoRemove unneeded bitboard from MP
Miguel Lahoz [Sun, 2 Apr 2023 09:28:39 +0000 (17:28 +0800)]
Remove unneeded bitboard from MP

Recent simplification has removed the need for an extra bitboard in MP struct.
Use a local variable instead.

STC: Passed Non-regression test
https://tests.stockfishchess.org/tests/view/64294ae677ff3301150cba16
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 64872 W: 17383 L: 17203 D: 30286
Ptnml(0-2): 179, 6675, 18546, 6859, 177

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

No functional change.

19 months agoDecrease Depth more for positions not in TT.
FauziAkram [Sat, 1 Apr 2023 12:22:53 +0000 (15:22 +0300)]
Decrease Depth more for positions not in TT.

If the position is not in TT, decrease depth by 2
or by 4 if the TT entry for the current position was hit
and the stored depth is greater than or equal to the current depth.

Many thanks to Vizvezdenec as the main idea was his.

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 70664 W: 18995 L: 18639 D: 33030
Ptnml(0-2): 228, 7712, 19090, 8080, 222
https://tests.stockfishchess.org/tests/view/64258a8bdb43ab2ba6f9b682

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 85040 W: 23227 L: 22836 D: 38977
Ptnml(0-2): 26, 8115, 25867, 8466, 46
https://tests.stockfishchess.org/tests/view/64262057db43ab2ba6f9d0e7

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

bench: 4380438

19 months agoReplace deprecated icc with icx
Maxim Masiutin [Fri, 31 Mar 2023 15:16:50 +0000 (18:16 +0300)]
Replace deprecated icc with icx

Replace the deprecated Intel compiler icc with its newer icx variant.
This newer compiler is based on clang, and yields good performance.
As before, currently only linux is supported.

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

No functional change

19 months agoSimplify away complexityAverage
MinetaS [Thu, 30 Mar 2023 11:14:30 +0000 (11:14 +0000)]
Simplify away complexityAverage

Instead of tracking the average of complexity values, calculate
complexity of root position at the beginning of the search and use it as
a scaling factor in time management.

Passed non-regression STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 58752 W: 15738 L: 15551 D: 27463
Ptnml(0-2): 164, 6194, 16478, 6371, 169
https://tests.stockfishchess.org/tests/view/6423010edb43ab2ba6f9424a

Passed non-regression LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 92872 W: 24865 L: 24729 D: 43278
Ptnml(0-2): 38, 8652, 28929, 8770, 47
https://tests.stockfishchess.org/tests/view/6423c1f0db43ab2ba6f9644f

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

No functional change

19 months agoStringify the git info passed
Joost VandeVondele [Sat, 1 Apr 2023 09:56:49 +0000 (11:56 +0200)]
Stringify the git info passed

avoid escaping the string in the Makefile.

Alternative to https://github.com/official-stockfish/Stockfish/pull/4476

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

No functional change.

19 months agoRemove reduction for moving threatened piece
Muzhen Gaming [Thu, 30 Mar 2023 09:46:15 +0000 (17:46 +0800)]
Remove reduction for moving threatened piece

Simplify away "Decrease reduction if we move a threatened piece".

Running a dbg_hit_on() shows that this line is only called ~0.12% of the time.

Simplification STC: https://tests.stockfishchess.org/tests/view/641ec2dcdb43ab2ba6f88103
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 146128 W: 39168 L: 39070 D: 67890
Ptnml(0-2): 466, 16117, 39830, 16155, 496

Simplification LTC: https://tests.stockfishchess.org/tests/view/64200689db43ab2ba6f8bca8
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 248016 W: 66703 L: 66714 D: 114599
Ptnml(0-2): 105, 24202, 75406, 24189, 106

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

Bench: 4961236

19 months agoMade advanced Windows API calls dynamically linked
Maxim Masiutin [Wed, 29 Mar 2023 09:43:36 +0000 (12:43 +0300)]
Made advanced Windows API calls dynamically linked

Made advanced Windows API calls (those from Advapi32.dll) dynamically
linked to avoid link errors when compiling using
Intel icx compiler for Windows.

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

No functional change

19 months agoImprove compatibility
Maxim Masiutin [Sun, 12 Mar 2023 13:16:51 +0000 (15:16 +0200)]
Improve compatibility

this makes it easier to compile under MSVC, even though we recommend gcc/clang for production compiles at the moment.

In Win32 API, by default, most null-terminated character strings arguments are of wchar_t (UTF16, formerly UCS16-LE) type, i.e. 2 bytes (at least) per character. So, src/misc.cpp should have proper type. Respectively, for src/syzygy/tbprobe.cpp, in Widows, file paths should be std::wstring rather than std::string. However, this requires a very big number of changes, since the config files are also keeping the 8-bit-per-character std::string strings. Therefore, just one change of using 8-byte-per-character CreateFileA make it compile under MSVC.

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

No functional change

19 months agoAllow PvNode in futility pruning for captures.
peregrineshahin [Thu, 23 Mar 2023 10:35:34 +0000 (13:35 +0300)]
Allow PvNode in futility pruning for captures.

Passed non-regression STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 148128 W: 39428 L: 39333 D: 69367
Ptnml(0-2): 492, 16326, 40315, 16457, 474
https://tests.stockfishchess.org/tests/view/641c2dbfdb43ab2ba6f804e8

Passed non-regression LTC:
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 376256 W: 100906 L: 101039 D: 174311
Ptnml(0-2): 186, 36697, 114494, 36566, 185
https://tests.stockfishchess.org/tests/view/641d33b2db43ab2ba6f83338

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

bench: 4935616

19 months agoClean up repetitive declarations for see_ge
Miguel Lahoz [Mon, 27 Mar 2023 16:06:24 +0000 (00:06 +0800)]
Clean up repetitive declarations for see_ge

The occupied bitboard is only used in one place and is otherwise thrown away.
To simplify use, see_ge function can instead be overloaded.
Repetitive declarations for occupied bitboard can be removed.

Passed non-regression test
https://tests.stockfishchess.org/tests/view/6421c286db43ab2ba6f908eb
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 48912 W: 13196 L: 13001 D: 22715
Ptnml(0-2): 146, 5003, 13967, 5190, 150

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

No functional change.

19 months agoUpdate default net to nn-dabb1ed23026.nnue
Linmiao Xu [Mon, 27 Mar 2023 05:00:54 +0000 (01:00 -0400)]
Update default net to nn-dabb1ed23026.nnue

Created by retraining the master net with these modifications:

* New filtering methods for existing data from T80 sep+oct2022, T79 apr2022, T78 jun+jul+aug+sep2022, T77 dec2021
* Adding new filtered data from T80 aug2022 and T78 apr+may2022
* Increasing early-fen-skipping from 28 to 30

```
python3 easy_train.py \
  --experiment-name leela96-dfrc99-T80novT79mayT60novdec-v2-T80augsepoctT79aprT78aprtosep-v6-T77dec-v3-sk30 \
  --training-dataset /data/leela96-dfrc99-T80novT79mayT60novdec-v2-T80augsepoctT79aprT78aprtosep-v6-T77dec-v3.binpack \
  --nnue-pytorch-branch linrock/nnue-pytorch/misc-fixes \
  --start-from-engine-test-net True \
  --early-fen-skipping 30 \
  --max_epoch 900 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --lr 4.375e-4 \
  --gamma 0.995 \
  --tui False \
  --gpus "0," \
  --seed $RANDOM
```

The v3 filtering used for data from T77dec 2021 differs from v2 filtering in that:

* To improve binpack compression, positions after ply 28 were skipped during training by setting position scores to VALUE_NONE (32002) instead of removing them entirely
* All early-game positions with ply <= 28 were removed to maximize binpack compression
* Only bestmove captures at d6pv2 search were skipped, not 2nd bestmove captures
* Binpack compression was repaired for the remaining positions by effectively replacing bestmoves with "played moves" to maintain contiguous sequences of positions in the training game data

After improving binpack compression, The T77 dec2021 data size was reduced from 95G to 19G.

The v6 filtering used for data from T80augsepoctT79aprT78aprtosep 2022 differs from v2 in that:

* All positions with only one legal move were removed
* Tighter score differences at d6pv2 search were used to remove more positions with only one good move than before
* d6pv2 search was not used to remove positions where the best 2 moves were captures

```
python3 interleave_binpacks.py \
  nn-547-dataset/leela96-eval-filt-v2.binpack \
  nn-547-dataset/dfrc99-eval-filt-v2.binpack \
  nn-547-dataset/test80-nov2022-12tb7p-eval-filt-v2-d6.binpack \
  nn-547-dataset/T79-may2022-12tb7p-eval-filt-v2.binpack \
  nn-547-dataset/T60-nov2021-12tb7p-eval-filt-v2.binpack \
  nn-547-dataset/T60-dec2021-12tb7p-eval-filt-v2.binpack \
  filt-v6/test80-aug2022-16tb7p-filter-v6.binpack \
  filt-v6/test80-sep2022-16tb7p-filter-v6.binpack \
  filt-v6/test80-oct2022-16tb7p-filter-v6.binpack \
  filt-v6/test79-apr2022-16tb7p-filter-v6.binpack \
  filt-v6/test78-aprmay2022-16tb7p-filter-v6.binpack \
  filt-v6/test78-junjulaug2022-16tb7p-filter-v6.binpack \
  filt-v6/test78-sep2022-16tb7p-filter-v6.binpack \
  filt-v3/test77-dec2021-16tb7p-filt-v3.binpack \
  /data/leela96-dfrc99-T80novT79mayT60novdec-v2-T80augsepoctT79aprT78aprtosep-v6-T77dec-v3.binpack
```

The code for the new data filtering methods is available at:
https://github.com/linrock/Stockfish/tree/nnue-data-v3/nnue-data

The code for giving hexword names to .nnue files is at:
https://github.com/linrock/nnue-namer

Links for downloading the training data components can be found at:
https://robotmoon.com/nnue-training-data/

Local elo at 25k nodes per move:
nn-epoch779.nnue : 0.6 +/- 3.1

Passed STC:
https://tests.stockfishchess.org/tests/view/64212412db43ab2ba6f8efb0
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 82256 W: 22185 L: 21809 D: 38262
Ptnml(0-2): 286, 9065, 22067, 9407, 303

Passed LTC:
https://tests.stockfishchess.org/tests/view/64223726db43ab2ba6f91d6c
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 30840 W: 8437 L: 8149 D: 14254
Ptnml(0-2): 14, 2891, 9323, 3177, 15

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

bench 5101970

19 months agoReuse existing functions to read/write array of network parameters
Sebastian Buchwald [Tue, 28 Mar 2023 17:53:43 +0000 (19:53 +0200)]
Reuse existing functions to read/write array of network parameters

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

No functional change

19 months agoRemove non_pawn_material in NNUE::evaluate
MinetaS [Wed, 22 Mar 2023 07:50:55 +0000 (16:50 +0900)]
Remove non_pawn_material in NNUE::evaluate

After "Use NNUE complexity in search, retune related parameters" commit,
the effect of non-pawn material adjustment has been nearly diminished.
This patch removes pos.non_pawn_material as a simplification, which
passed non-regression tests with both STC and LTC.

Passed non-regression STC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 75152 W: 20030 L: 19856 D: 35266
Ptnml(0-2): 215, 8281, 20459, 8357, 264
https://tests.stockfishchess.org/tests/view/641ab471db43ab2ba6f7bc58

Passed non-regression LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 193864 W: 51870 L: 51829 D: 90165
Ptnml(0-2): 86, 18968, 58794, 18987, 97
https://tests.stockfishchess.org/tests/view/641b4fe6db43ab2ba6f7db96

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

Bench: 5020718

19 months agoSimplify statScore initialization
Michael Chaly [Fri, 24 Mar 2023 04:45:22 +0000 (07:45 +0300)]
Simplify statScore initialization

This patch simplifies initialization of statScore to "always set it up to 0" instead of setting it up to 0 two plies deeper.
Reason for why it was done in previous way partially was because of LMR usage of previous statScore which was simplified long time ago so it makes sense to make in more simple there.

Passed STC:
https://tests.stockfishchess.org/tests/view/641a86d1db43ab2ba6f7b31d
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 115648 W: 30895 L: 30764 D: 53989
Ptnml(0-2): 368, 12741, 31473, 12876, 366

Passed LTC:
https://tests.stockfishchess.org/tests/view/641b1c31db43ab2ba6f7d17a
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 175576 W: 47122 L: 47062 D: 81392
Ptnml(0-2): 91, 17077, 53390, 17141, 89

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

bench 5081969

19 months agoUpdate Elo estimates for terms in search
FauziAkram [Tue, 21 Mar 2023 20:58:25 +0000 (23:58 +0300)]
Update Elo estimates for terms in search

Setting the Elo value of some functions which were not set before.
All tests run at 10+0.1 (STC), 25000 games (Same as #4294).
Book used: UHO_XXL_+0.90_+1.19.epd

Values are rounded to the nearest non-negative integer.

Test links:
https://tests.stockfishchess.org/tests/view/6419ab5b65775d3b539f46c6
https://tests.stockfishchess.org/tests/view/6419adb465775d3b539f4730
https://tests.stockfishchess.org/tests/view/6419ae9c65775d3b539f4756
https://tests.stockfishchess.org/tests/view/6419b03f65775d3b539f47a8
https://tests.stockfishchess.org/tests/view/6419b35d65775d3b539f4860
https://tests.stockfishchess.org/tests/view/6419b6b965775d3b539f48e6
https://tests.stockfishchess.org/tests/view/6419cade65775d3b539f4cd5
https://tests.stockfishchess.org/tests/view/6419cbb565775d3b539f4d01
https://tests.stockfishchess.org/tests/view/6419cc6965775d3b539f4d1e

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

No functional change

19 months agoVerified SEE pruning for capturing and checking moves.
pb00067 [Mon, 20 Mar 2023 07:56:44 +0000 (08:56 +0100)]
Verified SEE pruning for capturing and checking moves.

Patch analyzes field after SEE exchanges concluded with a recapture by
the opponent:
if opponent Queen/Rook/King results under attack after the exchanges, we
consider the move sharp and don't prune it.

Important note:
By accident I forgot to adjust 'occupied' when the king takes part in
the exchanges.
As result of this a move is considered sharp too, when opponent king
apparently can evade check by recapturing.
Surprisingly this seems contribute to patch's strength.

STC:
https://tests.stockfishchess.org/tests/view/640b16132644b62c33947397
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 116400 W: 31239 L: 30817 D: 54344
Ptnml(0-2): 350, 12742, 31618, 13116, 374

LTC:
https://tests.stockfishchess.org/tests/view/640c88092644b62c3394c1c5
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 177600 W: 47988 L: 47421 D: 82191
Ptnml(0-2): 62, 16905, 54317, 17436, 80

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

bench: 5012145

19 months agoRemove 'si' StateInfo variable/parameter.
pb00067 [Mon, 13 Mar 2023 17:32:40 +0000 (18:32 +0100)]
Remove 'si' StateInfo variable/parameter.

Since st is a member of position we don't need to pass it separately as
parameter.

While being there also remove some line in pos_is_ok, where
a copy of StateInfo was made by using default copy constructor and
then verified it's correctedness by doing a memcmp.
There is no point in doing that.

Passed non-regression test
https://tests.stockfishchess.org/tests/view/64098d562644b62c33942b35
LLR: 3.24 (-2.94,2.94) <-1.75,0.25>
Total: 548960 W: 145834 L: 146134 D: 256992
Ptnml(0-2): 1617, 57652, 156261, 57314, 1636

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

No functional change

19 months agoNNUE namespace cleanup
disservin [Mon, 13 Mar 2023 18:35:27 +0000 (19:35 +0100)]
NNUE namespace cleanup

This patch moves the nnue namespace in the appropiate header that correspondes with the definition.
It also makes navigation a bit easier.

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

No functional change

19 months agoFix null move issue
peregrineshahin [Sat, 11 Mar 2023 22:22:55 +0000 (01:22 +0300)]
Fix null move issue

Fix altering for stats landing on B1 Square after a null move and fix considering counter-moves on A1 for root node.

fixes https://github.com/official-stockfish/Stockfish/issues/4333 by preventing calls to from_sq and to_sq functions over null-moves and none-moves.

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

bench: 4980082

19 months agoSmall cleanups
pb00067 [Wed, 1 Mar 2023 09:29:51 +0000 (10:29 +0100)]
Small cleanups

remove some unneeded assignments, typos, incorrect comments, add authors entry.

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

no functional change

19 months agoRemove redundant condition from capture_stage()
mstembera [Sat, 11 Mar 2023 19:51:08 +0000 (11:51 -0800)]
Remove redundant condition from capture_stage()

Change a non functional promotion check to an assert.

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

No functional change

19 months agoFix Makefile for clang 16
Sebastian Buchwald [Sat, 11 Mar 2023 21:08:35 +0000 (22:08 +0100)]
Fix Makefile for clang 16

The clang 16 release will remove the -fexperimental-new-pass-manager
flag (see https://github.com/llvm/llvm-project/commit/69b2b7282e92a1b576b7bd26f3b16716a5027e8e).
Thus, the commit adapts the Makefile to use this flag only for older
clang versions.

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

No functional change

19 months agoChange mode of incbin.h
Alfredo Menezes [Mon, 13 Mar 2023 01:29:07 +0000 (22:29 -0300)]
Change mode of incbin.h

Keep incbin.h with the same mode as the other source files.

A mode diff might show up when working with patch files or sending the source code between devices.
This patch should fix such behaviour.

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

No functional change

19 months agoDo more singular extensions
Michael Chaly [Mon, 13 Mar 2023 12:57:58 +0000 (15:57 +0300)]
Do more singular extensions

This patch continues trend of last VLTC tuning - as measured by dubslow
most of it gains was in lowering marging in calculation of singularBeta.
This patch is a manual adjustment on top of it - it lowers multiplier
of depth in calculation of singularBeta even further, from 2/3 to 1,5/2,5.

Was negative at STC:
https://tests.stockfishchess.org/tests/view/64089c632644b62c3393fc12
Elo: -2.49 +-1.7 (95%) LOS: 0.2%
Total: 40000 W: 10601 L: 10888 D: 18511
Ptnml(0-2): 123, 4580, 10875, 4305, 117
nElo: -5.03 +-3.4 (95%) PairsRatio: 0.94

Passed 180+1.8 SPRT:
https://tests.stockfishchess.org/tests/view/640096dae74a12625bcf3b33
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 160952 W: 43753 L: 43342 D: 73857
Ptnml(0-2): 25, 13984, 52039, 14411, 17

Passed 60+0.6 8 threads SPRT:
https://tests.stockfishchess.org/tests/view/640dca8e65775d3b539cb7f6
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 38824 W: 10825 L: 10554 D: 17445
Ptnml(0-2): 0, 2939, 13268, 3200, 5

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

bench 4776866

19 months agoMore negative extensions on nonsingular nonpv nodes.
Dubslow [Fri, 10 Mar 2023 00:33:13 +0000 (18:33 -0600)]
More negative extensions on nonsingular nonpv nodes.

Following up the previous gainer also in this nonsingular node
section of code. Credit shared with @FauziAkram for realizing
this nonsingular node stuff had some potential, and @XInTheDark
for reminding us that !PvNodes better handle extensions/reductions
than Pv.

Passed STC: https://tests.stockfishchess.org/tests/view/640a7bb32644b62c339457c3
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 136776 W: 36598 L: 36149 D: 64029
Ptnml(0-2): 439, 14834, 37384, 15301, 430

Passed LTC: https://tests.stockfishchess.org/tests/view/640c43a02644b62c3394b23c
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 79536 W: 21363 L: 20984 D: 37189
Ptnml(0-2): 28, 7525, 24285, 7900, 30

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

Bench: 4444953

19 months agoDo more negative extensions
Michael Chaly [Mon, 6 Mar 2023 22:54:20 +0000 (01:54 +0300)]
Do more negative extensions

This patch does negatively extend transposition table move if singular search failed and tt value is not bigger than alpha.
Logic is close to what we had before recent simplification of negative extensions but uses or condition instead of and condition.

Passed STC:
https://tests.stockfishchess.org/tests/view/6404c8102644b62c33934607
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 119040 W: 31841 L: 31416 D: 55783
Ptnml(0-2): 356, 13070, 32292, 13397, 405

Passed LTC:
https://tests.stockfishchess.org/tests/view/6405abda2644b62c33937119
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 47216 W: 12816 L: 12496 D: 21904
Ptnml(0-2): 12, 4500, 14286, 4776, 34

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

bench 4747020

19 months agoFix TB after capture_stage fix
Joost VandeVondele [Sun, 5 Mar 2023 16:26:12 +0000 (17:26 +0100)]
Fix TB after capture_stage fix

https://github.com/official-stockfish/Stockfish/commit/5c75c1c2fbb7bb4f0bf7c44fb855c415b788cbf7
introduced a capture_stage() function, but TB usage needs a pure capture() function.

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

No functional change.

19 months agoClarify the description of the x86-64-vnni256 and x86-64-avxvnni architectures
Maxim Masiutin [Sun, 5 Mar 2023 15:10:52 +0000 (17:10 +0200)]
Clarify the description of the x86-64-vnni256 and x86-64-avxvnni architectures

Now it is clearly explained that "x86-64-vnni256" requires full
support of AVX512-VNNI, but only 256-bit operands are used.

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

No functional change

19 months agoAdd CITATION.cff file
Joost VandeVondele [Sat, 4 Mar 2023 17:14:23 +0000 (18:14 +0100)]
Add CITATION.cff file

Make the stockfish software more easily citable, for example in academic papers.

fixes https://github.com/official-stockfish/Stockfish/issues/4419
closes https://github.com/official-stockfish/Stockfish/pull/4422

No functional change

19 months agoUpdate README.md
dav1312 [Sat, 4 Mar 2023 12:24:35 +0000 (13:24 +0100)]
Update README.md

Update and simplify the readme, removing duplicated and outdated stuff and pointing to the new wiki

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

No functional change

19 months agoAdd wiki to artifacts
disservin [Sat, 4 Mar 2023 15:34:34 +0000 (16:34 +0100)]
Add wiki to artifacts

snapshot the wiki https://github.com/official-stockfish/stockfish/wiki as part of the artifacts generated.
This will allow future release to include the wiki pages as a form of documentation

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

No functional change

19 months agoFix duplicated moves generation in movepicker
Michael Chaly [Fri, 24 Feb 2023 09:09:45 +0000 (12:09 +0300)]
Fix duplicated moves generation in movepicker

in a some of cases movepicker returned some moves more than once which lead
to them being searched more than once. This bug was possible because of how
we use queen promotions - they are generated as a captures but are not
included in position function which checks if move is a capture. Thus if
any refutation (killer or countermove) was a queen promotion it was
searched twice - once as a capture and one as a refutation.

This patch affects various things, namely stats assignments for queen promotions
and other moves if best move is queen promotion,
also some heuristics in search and qsearch.

With this patch every queen promotion is now considered a capture.

After this patch number of found duplicated moves is 0 during normal 13 depth bench run.

Passed STC:
https://tests.stockfishchess.org/tests/view/63f77e01e74a12625bcd87d7
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 80920 W: 21455 L: 21289 D: 38176
Ptnml(0-2): 198, 8839, 22241, 8963, 219

Passed LTC:
https://tests.stockfishchess.org/tests/view/63f7e020e74a12625bcd9a76
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 89712 W: 23674 L: 23533 D: 42505
Ptnml(0-2): 24, 8737, 27202, 8860, 33

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

bench 4681731

20 months agoUpdate default net to nn-52471d67216a.nnue
Linmiao Xu [Fri, 24 Feb 2023 14:16:55 +0000 (09:16 -0500)]
Update default net to nn-52471d67216a.nnue

Created by retraining the master net with modifications to the previous best dataset:

* Improving T80 oct+nov 2022 endgame lambda accuracy by rescoring with 12-16tb of syzygy 7p tablebases
* Filtering T78 jun+jul+aug 2022 with d6pv2 search to remove positions with bestmove captures or one good move
* Adding T80 sep 2022 data, rescored with 16tb of 7p tablebases, unfiltered

Trained with max-epoch 900, end-lambda 0.7, and early-fen-skipping 28.

```
python3 easy_train.py \
  --experiment-name leela96-dfrc99-T80octnovT79aprmayT78junjulaugT60novdec-filt-v2-T78sep12tb7p-T77decT80sep16tb7p-lambda7-sk28 \
  --training-dataset /data/leela96-dfrc99-T80octnovT79aprmayT78junjulaugT60novdec-filt-v2-T78sep12tb7p-T77decT80sep16tb7p.binpack \
  --nnue-pytorch-branch linrock/nnue-pytorch/easy-train-early-fen-skipping \
  --early-fen-skipping 28 \
  --start-from-engine-test-net True \
  --gpus "0," \
  --max_epoch 900 \
  --start-lambda 1.0 \
  --end-lambda 0.7 \
  --gamma 0.995 \
  --lr 4.375e-4 \
  --tui False \
  --seed $RANDOM
```

Training data was rescored and d6pv2 filtered in the same way as recent best datasets.
For preparing the merged training dataset:

```
python3 interleave_binpacks.py \
  leela96-eval-filt-v2.binpack \
  dfrc99-eval-filt-v2.binpack \
  test80-oct2022-16tb7p-eval-filt-v2-d6.binpack \
  test80-nov2022-12tb7p-eval-filt-v2-d6.binpack \
  T79-apr2022-12tb7p-eval-filt-v2.binpack \
  T79-may2022-12tb7p-eval-filt-v2.binpack \
  test78-junjulaug2022-16tb7p-eval-filt-v2-d6.binpack \
  T60-nov2021-12tb7p-eval-filt-v2.binpack \
  T60-dec2021-12tb7p-eval-filt-v2.binpack \
  T78-sep2022-12tb7p.binpack \
  test77-dec2021-16gb7p.binpack \
  test80-sep2022-16tb7p.binpack \
  /data/leela96-dfrc99-T80octnovT79aprmayT78junjulaugT60novdec-filt-v2-T78sep12tb7p-T77decT80sep16tb7p.binpack
```

Links for downloading the training data components can be found at:
https://robotmoon.com/nnue-training-data/

Local elo at 25k nodes per move:
nn-epoch839.nnue : 0.6 +/- 1.4

Passed STC:
https://tests.stockfishchess.org/tests/view/63f9ab4be74a12625bcdf02e
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 84656 W: 22681 L: 22302 D: 39673
Ptnml(0-2): 271, 9343, 22734, 9696, 284

Passed LTC:
https://tests.stockfishchess.org/tests/view/63fa3833e74a12625bce0c0e
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 184664 W: 49933 L: 49344 D: 85387
Ptnml(0-2): 111, 17977, 55561, 18578, 105

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

bench: 4814343

20 months agoLate counter bonus: boost underestimated moves
Dubslow [Wed, 22 Feb 2023 11:45:43 +0000 (05:45 -0600)]
Late counter bonus: boost underestimated moves

The idea here is very intuitive: since we've just proven that the move is good, then if it previously had poor stats, boost those stats more than otherwise.

Passed STC: https://tests.stockfishchess.org/tests/view/63fb504ce74a12625bce4154
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 21128 W: 5763 L: 5481 D: 9884
Ptnml(0-2): 52, 2212, 5759, 2484, 57

Passed LTC: https://tests.stockfishchess.org/tests/view/63fb7825e74a12625bce491b
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 91904 W: 24764 L: 24359 D: 42781
Ptnml(0-2): 45, 8735, 27984, 9146, 42

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

bench 4318808

20 months agoUnify type alias declarations
Sebastian Buchwald [Sun, 26 Feb 2023 18:42:31 +0000 (19:42 +0100)]
Unify type alias declarations

The commit unifies the declaration of type aliases by replacing all
typedefs with corresponding using statements.

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

No functional change

20 months agoNNUE accumulator update in probcut.
Stefan Geschwentner [Sun, 26 Feb 2023 08:56:54 +0000 (09:56 +0100)]
NNUE accumulator update in probcut.

Call the recently added hint function for NNUE accumulator update after a failed probcut search.
In this case we already searched at least some captures and tt move which, however, is not sufficient for a cutoff.
So it seems we have a greater chance that the full search will also have no cutoff and hence all moves have to be searched.

STC: https://tests.stockfishchess.org/tests/view/63fa74a4e74a12625bce1823
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 70096 W: 18770 L: 18423 D: 32903
Ptnml(0-2): 191, 7342, 19654, 7651, 210

To be sure that we have no heavy interaction retest on top of #4410.

Rebased STC: https://tests.stockfishchess.org/tests/view/63fb2f62e74a12625bce3b03
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 137688 W: 36790 L: 36349 D: 64549
Ptnml(0-2): 397, 14373, 38919, 14702, 453

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

No functional change

20 months agoUse common_parent_position hint also at PVNodes TT hits.
pb00067 [Sun, 26 Feb 2023 08:59:35 +0000 (09:59 +0100)]
Use common_parent_position hint also at PVNodes TT hits.

Credits to Stefan Geschwentner (locutus2) showing that the hint
is useful on PvNodes. In contrast to his test,
this version avoids to use the hint when in check.
I believe checking positions aren't good candidates for the hint
because:
- evasion moves are rather few, so a checking pos. has much less childs
than a normal position
- if the king has to move the NNUE eval can't use incremental updates,
  so the child nodes have to do a full refresh anyway.

Passed STC:
https://tests.stockfishchess.org/tests/view/63f9c5b1e74a12625bcdf585
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 124472 W: 33268 L: 32846 D: 58358
Ptnml(0-2): 350, 12986, 35170, 13352, 378

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

no functional change

20 months agoSimplify condition in step 15
Alfredo Menezes [Mon, 27 Feb 2023 03:39:26 +0000 (00:39 -0300)]
Simplify condition in step 15

Remove 'ttValue <= alpha' check for negative extension in singular search.
Also apply some small code style changes.

STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 127888 W: 33766 L: 33651 D: 60471
Ptnml(0-2): 303, 14082, 35089, 14137, 333
https://tests.stockfishchess.org/tests/view/63f79528e74a12625bcd8c05

LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 89048 W: 23924 L: 23782 D: 41342
Ptnml(0-2): 27, 8635, 27065, 8763, 34
https://tests.stockfishchess.org/tests/view/63f82177e74a12625bcda6f4

LTC (retest):
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 196360 W: 52514 L: 52475 D: 91371
Ptnml(0-2): 103, 19066, 59780, 19151, 80
https://tests.stockfishchess.org/tests/view/63f934bfe74a12625bcdd929

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

Bench: 5310866

20 months agoSearch tuning at very long time control
Michael Chaly [Fri, 24 Feb 2023 15:25:24 +0000 (18:25 +0300)]
Search tuning at very long time control

This patch is a result of tuning session of approximately 100k games at 120+1.2.
Biggest changes are in extensions, stat bonus and depth reduction for nodes without a tt move.

Failed STC:
https://tests.stockfishchess.org/tests/view/63f72c72e74a12625bcd7938
LLR: -2.94 (-2.94,2.94) <0.00,2.00>
Total: 13872 W: 3535 L: 3769 D: 6568
Ptnml(0-2): 56, 1621, 3800, 1419, 40

Close to neutral at LTC:
https://tests.stockfishchess.org/tests/view/63f738f5e74a12625bcd7b8a
Elo: 0.80 +-1.2 (95%) LOS: 90.0%
Total: 60000 W: 16213 L: 16074 D: 27713
Ptnml(0-2): 24, 5718, 18379, 5853, 26
nElo: 1.82 +-2.8 (95%) PairsRatio: 1.02

Passed 180+1.8 VLTC:
https://tests.stockfishchess.org/tests/view/63f868f3e74a12625bcdb33e
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 15864 W: 4449 L: 4202 D: 7213
Ptnml(0-2): 1, 1301, 5083, 1544, 3

Passed 60+0.6 8 threads SMP VLTC:
https://tests.stockfishchess.org/tests/view/63f8a5d6e74a12625bcdbdb3
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 6288 W: 1821 L: 1604 D: 2863
Ptnml(0-2): 0, 402, 2123, 619, 0

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

bench 4705194

20 months agoFix typo in method name
Sebastian Buchwald [Thu, 23 Feb 2023 18:01:51 +0000 (19:01 +0100)]
Fix typo in method name

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

No functional change

20 months agoReintroduce nnue pawn scaling with lower lazy thresholds
Linmiao Xu [Tue, 21 Feb 2023 16:17:59 +0000 (11:17 -0500)]
Reintroduce nnue pawn scaling with lower lazy thresholds

Params found with the nevergrad TBPSA optimizer via nevergrad4sf modified to:

* use SPRT LLR with fishtest STC elo gainer bounds [0, 2] as the objective function
* increase the game batch size after each new optimal point is found

The params were the optimal point after TBPSA iteration 7 and 160 nevergrad evaluations with:

* initial batch size of 96 games per evaluation
* batch size increase of 64 games after each iteration
* a budget of 512 evaluations
* TC: fixed 1.5 million nodes per move, no time limit

nevergrad4sf enables optimizing stockfish params with TBPSA:
https://github.com/vondele/nevergrad4sf

Using pentanomial game results with smaller game batch sizes was inspired by:

Use of SPRT LLR calculated from pentanomial game results as the objective function was an experiment at maximizing the information from game batches to reduce the computational cost for TBPSA to converge on good parameters.

For the exact code used to find the params:
https://github.com/linrock/tuning-fork

Passed STC:
https://tests.stockfishchess.org/tests/view/63f4ef5ee74a12625bcd114a
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 66552 W: 17736 L: 17390 D: 31426
Ptnml(0-2): 164, 7229, 18166, 7531, 186

Passed LTC:
https://tests.stockfishchess.org/tests/view/63f56028e74a12625bcd2550
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 71264 W: 19150 L: 18787 D: 33327
Ptnml(0-2): 23, 6728, 21771, 7083, 27

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

bench 3687580

20 months agoIntroduce a function to compute NNUE accumulator
Joost VandeVondele [Mon, 20 Feb 2023 19:02:55 +0000 (20:02 +0100)]
Introduce a function to compute NNUE accumulator

This patch introduces `hint_common_parent_position()` to signal that potentially several child nodes will require an NNUE eval. By populating explicitly the accumulator, these subsequent evaluations can be performed more efficiently.

This was based on the observation that calculating the evaluation in an excluded move position yielded a significant Elo gain, even though the evaluation itself was already available (work by pb00067).

Sopel wrote the code to perform just the accumulator update. This PR is based on cleaned up code that

passed STC:
https://tests.stockfishchess.org/tests/view/63f62f9be74a12625bcd4aa0
 LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 110368 W: 29607 L: 29167 D: 51594
Ptnml(0-2): 41, 10551, 33572, 10967, 53

and in an the earlier (equivalent) version

passed STC:
https://tests.stockfishchess.org/tests/view/63f3c3fee74a12625bcce2a6
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 47552 W: 12786 L: 12467 D: 22299
Ptnml(0-2): 120, 5107, 12997, 5438, 114

passed LTC:
https://tests.stockfishchess.org/tests/view/63f45cc2e74a12625bccfa63
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 110368 W: 29607 L: 29167 D: 51594
Ptnml(0-2): 41, 10551, 33572, 10967, 53

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

Bench: 3726250

20 months agoRemove unused macros
Sebastian Buchwald [Sun, 19 Feb 2023 10:25:10 +0000 (11:25 +0100)]
Remove unused macros

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

No functional change

20 months agoAdd support for ARM dot product instructions
Sebastian Buchwald [Tue, 21 Feb 2023 21:18:17 +0000 (22:18 +0100)]
Add support for ARM dot product instructions

The sdot instruction computes (and accumulates) a signed dot product,
which is quite handy for Stockfish's NNUE code. The instruction is
optional for Armv8.2 and Armv8.3, and mandatory for Armv8.4 and above.

The commit adds a new 'arm-dotprod' architecture with enabled dot
product support. It also enables dot product support for the existing
'apple-silicon' architecture, which is at least Armv8.5.

The following local speed test was performed on an Apple M1 with
ARCH=apple-silicon. I had to remove CPU pinning from the benchmark
script. However, the results were still consistent: Checking both
binaries against themselves reported a speedup of +0.0000 and +0.0005,
respectively.

```
Result of 100 runs
==================
base (...ish.037ef3e1) =    1917997  +/- 7152
test (...fish.dotprod) =    2159682  +/- 9066
diff                   =    +241684  +/- 2923

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

CPU: 10 x arm
Hyperthreading: off
```

Fixes #4193

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

No functional change

20 months agoRemove one `reduction` call
Dubslow [Wed, 15 Feb 2023 00:04:17 +0000 (18:04 -0600)]
Remove one `reduction` call

even though bench is unchanged to depth 28,
due to adjusting depth in singular extensions this might be functional.

STC: https://tests.stockfishchess.org/tests/view/63ec21affe833123fef34153
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 195712 W: 51625 L: 51581 D: 92506
Ptnml(0-2): 504, 20527, 55779, 20513, 533

LTC: https://tests.stockfishchess.org/tests/view/63ed3487fe833123fef375ed
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 32176 W: 8631 L: 8442 D: 15103
Ptnml(0-2): 5, 2794, 10309, 2967, 13

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

Bench 4283297

20 months agoSimplify late countermove bonus condition
Dubslow [Mon, 23 Jan 2023 01:45:46 +0000 (19:45 -0600)]
Simplify late countermove bonus condition

STC: https://tests.stockfishchess.org/tests/view/63d53ac6a67dd929a555e1e2
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 216096 W: 56862 L: 56839 D: 102395
Ptnml(0-2): 648, 24033, 58650, 24082, 635

LTC: https://tests.stockfishchess.org/tests/view/63d7f9a6a67dd929a5565991
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 808512 W: 214060 L: 214610 D: 379842
Ptnml(0-2): 301, 79448, 245293, 78928, 286

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

Bench: 4283297

20 months agoSimplify nnueComplexity calculation.
mstembera [Mon, 13 Feb 2023 01:33:19 +0000 (17:33 -0800)]
Simplify nnueComplexity calculation.

further simplification after https://github.com/official-stockfish/Stockfish/pull/4377

STC https://tests.stockfishchess.org/tests/view/63e02a3773223e7f52ad8190
LLR: 2.97 (-2.94,2.94) <-1.75,0.25>
Total: 359072 W: 94605 L: 94733 D: 169734
Ptnml(0-2): 994, 39874, 97958, 39686, 1024

LTC https://tests.stockfishchess.org/tests/view/63e3fd12b5f425d71f77002a
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 248424 W: 66020 L: 66030 D: 116374
Ptnml(0-2): 113, 24653, 74689, 24645, 112

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

bench: 4098325

20 months agoFix overflow in add_dpbusd_epi32x2
MinetaS [Mon, 13 Feb 2023 02:54:59 +0000 (11:54 +0900)]
Fix overflow in add_dpbusd_epi32x2

This patch fixes 16bit overflow in *_add_dpbusd_epi32x2 functions,
that can be triggered in rare cases depending on the NNUE weights.

While the code leads to some slowdown on affected architectures
(most notably avx2), the fix is simpler than some of the other
options discussed in
https://github.com/official-stockfish/Stockfish/pull/4394

Code suggested by Sopel97.

Result of "bench 4096 1 30 default depth nnue":

| Architecture        | master    | patch (gcc) | patch (clang) |
|---------------------|-----------|-------------|---------------|
| x86-64-vnni512      | 762122798 | 762122798   | 762122798     |
| x86-64-avx512       | 769723503 | 762122798   | 762122798     |
| x86-64-bmi2         | 769723503 | 762122798   | 762122798     |
| x86-64-ssse3        | 769723503 | 762122798   | 762122798     |
| x86-64              | 762122798 | 762122798   | 762122798     |

Following architectures will experience ~4% slowdown due to an
additional instruction in the middle of hot path:

* x86-64-avx512
* x86-64-bmi2
* x86-64-avx2
* x86-64-sse41-popcnt (x86-64-modern)
* x86-64-ssse3
* x86-32-sse41-popcnt

This patch clearly loses Elo against master with both STC and LTC.

Failed non-regression STC (256bit fix only):
LLR: -2.95 (-2.94,2.94) <-1.75,0.25>
Total: 33528 W: 8769 L: 9049 D: 15710
Ptnml(0-2): 96, 3616, 9600, 3376, 76
https://tests.stockfishchess.org/tests/view/63e6a5b44299542b1e26a485

60+0.6 @ 30000 games:
Elo: -1.67 +-1.7 (95%) LOS: 2.8%
Total: 30000 W: 7848 L: 7992 D: 14160
Ptnml(0-2): 12, 2847, 9436, 2683, 22
nElo: -3.84 +-3.9 (95%) PairsRatio: 0.95
https://tests.stockfishchess.org/tests/view/63e7ac716d0e1db55f35a660

However, a test against nn-a3dc078bafc7.nnue, which is the latest "safe"
network not causing the bug, passed with regular bounds.

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 160456 W: 42658 L: 42175 D: 75623
Ptnml(0-2): 487, 17638, 43469, 18173, 461
https://tests.stockfishchess.org/tests/view/63e89836d62a5d02b0fa82c8

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

No functional change