]> git.sesse.net Git - stockfish/log
stockfish
3 years agoUpdate Top CPU Contributors
Stéphane Nicolet [Mon, 15 Feb 2021 22:58:03 +0000 (23:58 +0100)]
Update Top CPU Contributors

No functional change

3 years agoPV-Nodes likely to fail low
Vizvezdenec [Thu, 11 Feb 2021 07:45:16 +0000 (10:45 +0300)]
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

3 years agoBetter code for hash table generation
mattginsberg [Thu, 11 Feb 2021 21:29:28 +0000 (22:29 +0100)]
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

3 years agoEnable New Pass Manager for Clang.
Gian-Carlo Pascutto [Tue, 9 Feb 2021 16:38:58 +0000 (17:38 +0100)]
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

3 years agoDisable ThinLTO when using Clang.
Gian-Carlo Pascutto [Tue, 9 Feb 2021 13:05:35 +0000 (14:05 +0100)]
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.

3 years agoFixes FreeBSD compilation when using Clang
Andy Pilate [Mon, 8 Feb 2021 21:02:42 +0000 (22:02 +0100)]
Fixes FreeBSD compilation when using Clang

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

No functional change

3 years agoSearch Parameters Tuning
bmc4 [Fri, 5 Feb 2021 00:50:22 +0000 (21:50 -0300)]
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

3 years agoPawns Tuning
FauziAkram [Sun, 7 Feb 2021 11:44:11 +0000 (13:44 +0200)]
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

3 years agoSimplify En Passant
bmc4 [Sun, 31 Jan 2021 13:12:32 +0000 (10:12 -0300)]
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.

3 years agoTune ordering of moves at internal nodes
bmc4 [Sun, 31 Jan 2021 03:05:39 +0000 (00:05 -0300)]
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

3 years agoSimplify Chess 960 castling
bmc4 [Sun, 17 Jan 2021 18:21:45 +0000 (15:21 -0300)]
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

3 years agoSpeed Up Perft Search
bmc4 [Tue, 19 Jan 2021 12:21:59 +0000 (09:21 -0300)]
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

3 years agoClean Up Castling in gives_check
bmc4 [Mon, 18 Jan 2021 20:03:43 +0000 (17:03 -0300)]
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.

3 years agoAvoid more expensive legality check
bmc4 [Sat, 16 Jan 2021 04:44:11 +0000 (01:44 -0300)]
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.

3 years agoSmall cleanups
Lolligerhans [Tue, 12 Jan 2021 13:59:51 +0000 (14:59 +0100)]
Small cleanups

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

No functional change

3 years agoImprove play for closed positions
Stéphane Nicolet [Thu, 21 Jan 2021 17:53:29 +0000 (18:53 +0100)]
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

3 years agoAdd .gitignore
Rod Johnson [Mon, 4 Jan 2021 11:59:55 +0000 (22:59 +1100)]
Add .gitignore

add files produced during the build to a newly added .gitignore

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

No functional change

3 years agoChange lock type
Krystian Kuzniarek [Thu, 31 Dec 2020 16:00:39 +0000 (17:00 +0100)]
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.

3 years agoAdd penalty for doubled pawns in agile structure
Lolligerhans [Tue, 12 Jan 2021 13:30:25 +0000 (14:30 +0100)]
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

3 years agoOptimize generate_moves
Tomasz Sobczyk [Sun, 10 Jan 2021 06:30:40 +0000 (03:30 -0300)]
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.

3 years agoBad Outpost Pawn Scale
FauziAkram [Sat, 9 Jan 2021 23:31:09 +0000 (01:31 +0200)]
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

3 years agoRefine stat based reductions
Vizvezdenec [Sat, 9 Jan 2021 14:42:58 +0000 (17:42 +0300)]
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

3 years agoRethink En Passant Evasion Capture
BM123499 [Fri, 8 Jan 2021 17:03:26 +0000 (14:03 -0300)]
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

3 years agoFix static_assert.
Dieter Dobbelaere [Sun, 10 Jan 2021 11:22:52 +0000 (12:22 +0100)]
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.

3 years agoUse correct chess terms + fix spelling.
Dieter Dobbelaere [Sat, 9 Jan 2021 15:46:06 +0000 (16:46 +0100)]
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.

3 years agoSmall code cleanup in LMR
Vizvezdenec [Sun, 10 Jan 2021 17:24:37 +0000 (20:24 +0300)]
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.

3 years agoAffine transform robust implementation
MaximMolchanov [Mon, 11 Jan 2021 05:49:41 +0000 (07:49 +0200)]
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.

3 years agoRemove Condition from Generate_Move Loop
bmc4 [Sun, 10 Jan 2021 06:30:40 +0000 (03:30 -0300)]
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

3 years agoUpdate copyright years
Joost VandeVondele [Fri, 8 Jan 2021 16:04:23 +0000 (17:04 +0100)]
Update copyright years

No functional change

3 years agoReorder conditions in LMR and pruning
Vizvezdenec [Fri, 1 Jan 2021 09:59:35 +0000 (12:59 +0300)]
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.

3 years agoAffine transform refactoring.
MaximMolchanov [Wed, 6 Jan 2021 03:29:32 +0000 (05:29 +0200)]
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

3 years agoWeakUnopposed penalty for backwards on file A or H
FauziAkram [Fri, 25 Dec 2020 14:19:04 +0000 (16:19 +0200)]
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

3 years agoRemove razoring
Unai Corzo [Sat, 26 Dec 2020 12:48:04 +0000 (13:48 +0100)]
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

3 years agoSimplify away late irreversible move extension
Unai Corzo [Sun, 27 Dec 2020 20:19:19 +0000 (21:19 +0100)]
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

3 years agoAssorted parameter tweak
Unai Corzo [Wed, 30 Dec 2020 14:38:25 +0000 (15:38 +0100)]
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

3 years agoTweak capture LMR.
Stefan Geschwentner [Thu, 31 Dec 2020 00:45:37 +0000 (01:45 +0100)]
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

3 years agoDo more LMR for captures
Vizvezdenec [Thu, 24 Dec 2020 22:11:09 +0000 (01:11 +0300)]
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

3 years agoCorrect Outflanking calculations in classical eval
Moez Jellouli [Sun, 20 Dec 2020 21:28:23 +0000 (22:28 +0100)]
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

3 years agoTweak the formulas for unsafeSquares
FauziAkram [Sun, 20 Dec 2020 15:50:34 +0000 (17:50 +0200)]
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

3 years agoSimplify condition for assigning static-eval based bonus
pb00067 [Mon, 14 Dec 2020 15:30:56 +0000 (16:30 +0100)]
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

3 years agoAdjust definition of unsafeSquares
FauziAkram [Wed, 16 Dec 2020 13:35:39 +0000 (15:35 +0200)]
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

3 years agoIncrease reduction in case of stable best move
Vizvezdenec [Mon, 14 Dec 2020 00:49:04 +0000 (03:49 +0300)]
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

3 years agoMerge static history into main history,
pb00067 [Sun, 13 Dec 2020 20:23:30 +0000 (21:23 +0100)]
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

3 years agoAVX512, AVX2 and SSSE3 speedups
mstembera [Sat, 12 Dec 2020 22:18:38 +0000 (14:18 -0800)]
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

3 years agoNew Imbalance Tables Tweak
FauziAkram [Mon, 7 Dec 2020 17:28:47 +0000 (19:28 +0200)]
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

3 years agoUse arithmetic right shift for sign extension in MMX and SSE2 paths
Fanael Linithien [Mon, 7 Dec 2020 13:46:29 +0000 (14:46 +0100)]
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.

3 years agoAdd comments to uncommented parts of code
Vizvezdenec [Tue, 1 Dec 2020 12:02:35 +0000 (15:02 +0300)]
Add comments to uncommented parts of code

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

No functional change

3 years agoIntroduce static history
Vizvezdenec [Sat, 5 Dec 2020 01:00:41 +0000 (04:00 +0300)]
Introduce static history

The idea of this patch can be described as following: we update static
history stats based on comparison of the static evaluations of the
position before and after the move. If the move increases static evaluation
it's assigned positive bonus, if it decreases static evaluation
it's assigned negative bonus. These stats are used in movepicker
to sort quiet moves.

passed STC
https://tests.stockfishchess.org/tests/view/5fca4c0842a050a89f02cd66
LLR: 3.00 (-2.94,2.94) {-0.25,1.25}
Total: 78152 W: 7409 L: 7171 D: 63572
Ptnml(0-2): 303, 5695, 26873, 5871, 334

passed LTC
https://tests.stockfishchess.org/tests/view/5fca6be442a050a89f02cd75
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 40240 W: 1602 L: 1441 D: 37197
Ptnml(0-2): 19, 1306, 17305, 1475, 15

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

bench 3845156

3 years agoUpdate default net to nn-62ef826d1a6d.nnue
SFisGOD [Sat, 28 Nov 2020 15:14:34 +0000 (23:14 +0800)]
Update default net to nn-62ef826d1a6d.nnue

Include scaling change as suggested by Dietrich Kappe,
the one who trained net for Komodo.  According to him,
some nets may require different scaling in order to utilize its full strength.

STC:
LLR: 2.93 (-2.94,2.94) {-0.25,1.25}
Total: 99856 W: 9669 L: 9401 D: 80786
Ptnml(0-2): 374, 7468, 34037, 7614, 435
https://tests.stockfishchess.org/tests/view/5fc2697642a050a89f02c8ec

LTC:
LLR: 2.96 (-2.94,2.94) {0.25,1.25}
Total: 29840 W: 1220 L: 1081 D: 27539
Ptnml(0-2): 10, 969, 12827, 1100, 14
https://tests.stockfishchess.org/tests/view/5fc2ea5142a050a89f02c957

Bench: 3561701

3 years agoReductions simplification
Unai Corzo [Sun, 29 Nov 2020 12:52:36 +0000 (13:52 +0100)]
Reductions simplification

Simplify increase reduction for captures/promotions if late move and at low depth.

STC https://tests.stockfishchess.org/tests/view/5fbff65067cbf42301d6b3ae
LLR: 2.97 (-2.94,2.94) {-1.25,0.25}
Total: 49088 W: 4607 L: 4555 D: 39926
Ptnml(0-2): 177, 3615, 16932, 3619, 201

LTC https://tests.stockfishchess.org/tests/view/5fc0902967cbf42301d6b3fc
LLR: 2.99 (-2.94,2.94) {-0.75,0.25}
Total: 160944 W: 6153 L: 6193 D: 148598
Ptnml(0-2): 90, 5525, 69294, 5461, 102

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

bench: 3834568

3 years agoRemove piece lists
syzygy1 [Sun, 29 Nov 2020 11:05:26 +0000 (12:05 +0100)]
Remove piece lists

This patch removes the incrementally updated piece lists from the Position object.

This has been tried before but always failed. My reasons for trying again are:

* 32-bit systems (including phones) are now much less important than they were some years ago (and are absent from fishtest);
* NNUE may have made SF less finely tuned to the order in which moves were generated.

STC:
LLR: 2.94 (-2.94,2.94) {-1.25,0.25}
Total: 55272 W: 5260 L: 5216 D: 44796
Ptnml(0-2): 208, 4147, 18898, 4159, 224
https://tests.stockfishchess.org/tests/view/5fc2986a42a050a89f02c926

LTC:
LLR: 2.96 (-2.94,2.94) {-0.75,0.25}
Total: 16600 W: 673 L: 608 D: 15319
Ptnml(0-2): 14, 533, 7138, 604, 11
https://tests.stockfishchess.org/tests/view/5fc2f98342a050a89f02c95c

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

Bench: 3940967

3 years agoUpdate README.md
Unai Corzo [Sun, 29 Nov 2020 08:07:31 +0000 (09:07 +0100)]
Update README.md

fix a few typos

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

No functional change

3 years agoSearch simplification
Unai Corzo [Sat, 28 Nov 2020 15:32:52 +0000 (16:32 +0100)]
Search simplification

STC https://tests.stockfishchess.org/tests/view/5fc2083942a050a89f02c8bb
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 23200 W: 2251 L: 2160 D: 18789
Ptnml(0-2): 86, 1726, 7895, 1797, 96

LTC https://tests.stockfishchess.org/tests/view/5fc22d7b42a050a89f02c8d0
LLR: 2.92 (-2.94,2.94) {-0.75,0.25}
Total: 15832 W: 653 L: 590 D: 14589
Ptnml(0-2): 7, 521, 6795, 588, 5

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

bench: 3827317

Simplify search.

3 years agoRemove bonus for killers.
lonfom169 [Thu, 26 Nov 2020 12:40:54 +0000 (09:40 -0300)]
Remove bonus for killers.

Passed non-regression STC:
LLR: 2.94 (-2.94,2.94) {-1.25,0.25}
Total: 14712 W: 1416 L: 1315 D: 11981
Ptnml(0-2): 59, 1029, 5082, 1124, 62
https://tests.stockfishchess.org/tests/view/5fbfa31f67cbf42301d6b36e

Passed non-regression LTC:
LLR: 2.95 (-2.94,2.94) {-0.75,0.25}
Total: 27536 W: 1099 L: 1044 D: 25393
Ptnml(0-2): 11, 929, 11838, 974, 16
https://tests.stockfishchess.org/tests/view/5fbfac9167cbf42301d6b371

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

Bench: 3887644

3 years agoRefine rook penalty on closed files
Lolligerhans [Fri, 20 Nov 2020 17:09:41 +0000 (18:09 +0100)]
Refine rook penalty on closed files

+-----------------+
| . . . . . . . . | All files are closed. Some files are
| . . . . . o o . | more valuable for rooks, because
| . . . . o . . o | they might open in the future.
| . . . o x . . x |
| o . o x . x x . |
| x o x . . . . . | x  our pawns
| . x . . . . . . | o  their pawns
| . . . . . . . . | ^  rooks are scored higher on these files
+-----------------+
            ^ ^

Files containing none of our own pawns are open or half-open (otherwise
they are closed). Rooks on (half-)open files recieve a bonus for the
future potential to act along all ranks.

This commit refines the (relative) penalty of rooks on closed files.
Files that contain one of our blocked pawns are considered less likely
to open in the future; rooks on these files are now penalized stronger.

This bonus does not generally correlate with mobility. If the condition
is sufficiently refined in the future, it may be beneficial to adjust or
override mobility scores in some cases.

LTC
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 494384 W: 71565 L: 70231 D: 352588
Ptnml(0-2): 3907, 48050, 142118, 49036, 4081
https://tests.stockfishchess.org/tests/view/5fb9312e67cbf42301d6afb9

LTC (non-regression w/ book noob_3moves.epd)
LLR: 2.95 (-2.94,2.94) {-0.75,0.25}
Total: 208520 W: 27044 L: 26937 D: 154539
Ptnml(0-2): 1557, 19850, 61391, 19853, 1609
https://tests.stockfishchess.org/tests/view/5fc01ced67cbf42301d6b3df

STC
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 98392 W: 20269 L: 19868 D: 58255
Ptnml(0-2): 1804, 11297, 22589, 11706, 1800
https://tests.stockfishchess.org/tests/view/5fb7f88a67cbf42301d6af10

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

Bench: 3682630

3 years agoCleaned up MakeIndex()
mstembera [Tue, 17 Nov 2020 23:58:25 +0000 (15:58 -0800)]
Cleaned up MakeIndex()

The index order in kpp_board_index[][] is reversed to be more optimal for the access pattern

STC https://tests.stockfishchess.org/tests/view/5fbd74f967cbf42301d6b24f
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 27504 W: 2686 L: 2607 D: 22211
Ptnml(0-2): 84, 2001, 9526, 2034, 107

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

No functional change

3 years agouse classical for certain endgames.
Vizvezdenec [Thu, 26 Nov 2020 05:38:09 +0000 (06:38 +0100)]
use classical for certain endgames.

STC https://tests.stockfishchess.org/tests/view/5fbc64c067cbf42301d6b1d6
LLR: 2.97 (-2.94,2.94) {-0.25,1.25}
Total: 53360 W: 5223 L: 5024 D: 43113
Ptnml(0-2): 184, 3877, 18390, 4014, 215

LTC https://tests.stockfishchess.org/tests/view/5fbc97f267cbf42301d6b1ee
LLR: 2.96 (-2.94,2.94) {0.25,1.25}
Total: 126472 W: 5111 L: 4766 D: 116595
Ptnml(0-2): 50, 4032, 54749, 4333, 72

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

bench: 3820648

3 years agoCalculate sum from first elements
MaximMolchanov [Sat, 14 Nov 2020 00:55:29 +0000 (02:55 +0200)]
Calculate sum from first elements

in affine transform for AVX512/AVX2/SSSE3

The idea is to initialize sum with the first element instead of zero.
Reduce one add_epi32 and one set_zero SIMD instructions for each output dimension.

sum = 0; for i = 1 to n sum += a[i] ->
sum = a[1]; for i = 2 to n sum += a[i]

STC:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 69048 W: 7024 L: 6799 D: 55225
Ptnml(0-2): 260, 5175, 23458, 5342, 289
https://tests.stockfishchess.org/tests/view/5faf2cf467cbf42301d6aa06

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

No functional change.

3 years agoAssorted search and eval parameter tune
Unai Corzo [Tue, 24 Nov 2020 16:06:30 +0000 (17:06 +0100)]
Assorted search and eval parameter tune

Search and eval parameter tune.

STC https://tests.stockfishchess.org/tests/view/5fba850a67cbf42301d6b07d
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 24312 W: 2388 L: 2228 D: 19696
Ptnml(0-2): 85, 1800, 8241, 1930, 100

LTC https://tests.stockfishchess.org/tests/view/5fbad5ea67cbf42301d6b0fa
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 88376 W: 3619 L: 3351 D: 81406
Ptnml(0-2): 56, 2977, 37849, 3255, 51

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

bench: 3600361

3 years agoSmall cleanups 13
Stéphane Nicolet [Thu, 12 Nov 2020 13:05:28 +0000 (14:05 +0100)]
Small cleanups 13

No functional change

3 years agoRook Mobility Tweak
FauziAkram [Wed, 11 Nov 2020 18:56:29 +0000 (20:56 +0200)]
Rook Mobility Tweak

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 171152 W: 34715 L: 34202 D: 102235
Ptnml(0-2): 3278, 20155, 38228, 20606, 3309
https://tests.stockfishchess.org/tests/view/5fa861f467cbf42301d6a68e

Passed LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 149616 W: 20471 L: 19882 D: 109263
Ptnml(0-2): 1172, 14434, 43102, 14833, 1267
https://tests.stockfishchess.org/tests/view/5fa9c8ff67cbf42301d6a74f

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

Bench: 3597730

3 years agoIncrease reduction at root
SFisGOD [Tue, 10 Nov 2020 17:28:43 +0000 (18:28 +0100)]
Increase reduction at root

when the best move does not change frequently

STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 51320 W: 5159 L: 4956 D: 41205
Ptnml(0-2): 215, 3897, 17242, 4082, 224
https://tests.stockfishchess.org/tests/view/5faa072367cbf42301d6a767

LTC:
LLR: 2.98 (-2.94,2.94) {0.25,1.25}
Total: 15952 W: 762 L: 642 D: 14548
Ptnml(0-2): 8, 561, 6725, 667, 15
https://tests.stockfishchess.org/tests/view/5faa4c3567cbf42301d6a794

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

Bench: 3954692

3 years agoIncrease reduction based on the number of best move changes.
lonfom169 [Mon, 9 Nov 2020 02:43:32 +0000 (23:43 -0300)]
Increase reduction based on the number of best move changes.

Thanks to Vizvezdenec for the PvNode idea and also to vondele the !PvNode idea.

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 19120 W: 1998 L: 1839 D: 15283
Ptnml(0-2): 76, 1445, 6375, 1572, 92
https://tests.stockfishchess.org/tests/view/5fa8af3e67cbf42301d6a6c9

Passed LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 75584 W: 3454 L: 3205 D: 68925
Ptnml(0-2): 54, 2832, 31771, 3081, 54

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

Bench: 3595418

3 years agoQsearch pruning: follow-up
Stéphane Nicolet [Fri, 6 Nov 2020 18:20:27 +0000 (19:20 +0100)]
Qsearch pruning: follow-up

This is a follow-up of the recent qsearch pruning patch in
https://github.com/official-stockfish/Stockfish/commit/a260c9a8a24a2630a900efc3821000c3481b0c5d

We now use the same guard condition (testing that we already have a defense with
a score better  score than a TB loss) for all pruning heuristics in qsearch().
This allows some pruning when in check, but  in a controlled way to ensure that
no wrong mate scores appear.

Tested with Elo-gaining bounds:

STC:
LLR: 2.97 (-2.94,2.94) {-0.25,1.25}
Total: 22632 W: 2433 L: 2264 D: 17935
Ptnml(0-2): 98, 1744, 7487, 1865, 122
https://tests.stockfishchess.org/tests/view/5fa59405936c54e11ec99515

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 105432 W: 4965 L: 4648 D: 95819
Ptnml(0-2): 85, 4110, 44011, 4423, 87
https://tests.stockfishchess.org/tests/view/5fa5b609936c54e11ec9952a

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

Bench: 3578092

3 years agoUpdate default net to nn-c3ca321c51c9.nnue
SFisGOD [Sat, 7 Nov 2020 00:50:02 +0000 (08:50 +0800)]
Update default net to nn-c3ca321c51c9.nnue

Optimization of the net biases of the 32 x 32 layer and the output layer.

Tuning of 32 x 32 layer (200k games, 5 seconds TC)
https://tests.stockfishchess.org/tests/view/5f9aaf266a2c112b60691c68

STC:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 41848 W: 4665 L: 4461 D: 32722
Ptnml(0-2): 239, 3308, 13659, 3446, 272
https://tests.stockfishchess.org/tests/view/5fa5ef5a936c54e11ec9954f

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 88008 W: 4045 L: 3768 D: 80195
Ptnml(0-2): 69, 3339, 36908, 3622, 66
https://tests.stockfishchess.org/tests/view/5fa62a78936c54e11ec99577

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

Bench: 3649288

3 years agoAVX-512 for smaller affine and feature transforms.
Tomasz Sobczyk [Tue, 3 Nov 2020 21:49:10 +0000 (22:49 +0100)]
AVX-512 for smaller affine and feature transforms.

For the feature transformer the code is analogical to AVX2 since there was room for easy adaptation of wider simd registers.

For the smaller affine transforms that have 32 byte stride we keep 2 columns in one zmm register. We also unroll more aggressively so that in the end we have to do 16 parallel horizontal additions on ymm slices each consisting of 4 32-bit integers. The slices are embedded in 8 zmm registers.

These changes provide about 1.5% speedup for AVX-512 builds.

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

No functional change.

3 years agoIntroducing King On File
FauziAkram [Wed, 4 Nov 2020 23:54:53 +0000 (01:54 +0200)]
Introducing King On File

this new concept calculates bonuses/penalties for the king when the king is in a semiopen or open file.

Passed STC:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 44904 W: 9365 L: 9028 D: 26511
Ptnml(0-2): 857, 5309, 9841, 5530, 915
https://tests.stockfishchess.org/tests/view/5fa343625d72639a7acef72b

Passed LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 60552 W: 8449 L: 8051 D: 44052
Ptnml(0-2): 466, 5772, 17481, 6012, 545
https://tests.stockfishchess.org/tests/view/5fa40e365d72639a7acef79e

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

Bench: 3689484

3 years agoChange handling the special case of a single legal move.
Joost VandeVondele [Fri, 23 Oct 2020 05:39:35 +0000 (07:39 +0200)]
Change handling the special case of a single legal move.

Using no searching time in case of a single legal move is not beneficial from
a strength point of view, and this special case can be easily removed:

STC:
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 22472 W: 2458 L: 2357 D: 17657
Ptnml(0-2): 106, 1733, 7453, 1842, 102
https://tests.stockfishchess.org/tests/view/5f926cbc81eda81bd78cb6df

LTC:
LLR: 2.94 (-2.94,2.94) {-0.75,0.25}
Total: 37880 W: 1736 L: 1682 D: 34462
Ptnml(0-2): 22, 1392, 16057, 1448, 21
https://tests.stockfishchess.org/tests/view/5f92a26081eda81bd78cb6fe

The advantage of using the normal time management for a single legal move is that scores
reported for that move are reasonable, not searching leads to artifacts during games
(see e.g. https://tcec-chess.com/#div=sf&game=96&season=19)

The disadvantage of using normal time management of a single legal move is that thinking
times can be unnaturally long, making it 'painful to watch' in online tournaments.

This patch uses normal time management, but caps the used time to 500ms.
This should lead to reasonable scores, and be hardly perceptible.

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

variant of a patch suggested by SFisGOD

No functional change.

3 years agoManually align arrays on the stack
Tomasz Sobczyk [Tue, 3 Nov 2020 10:23:35 +0000 (11:23 +0100)]
Manually align arrays on the stack

as a workaround to issues with overaligned alignas() on stack variables in gcc < 9.3 on windows.

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

fixes #3216

No functional change

3 years agoFix incorrect pruning in qsearch
J. Oster [Sun, 1 Nov 2020 17:33:17 +0000 (18:33 +0100)]
Fix incorrect pruning in qsearch

Only do countermove based pruning in qsearch if we already have a move with a better score than a TB loss.

This patch fixes a bug (started as 843a961) that incorrectly prunes moves if in check,
and adds an assert to make sure no wrong mate scores are given in the future.
It replaces a no-op moveCount check with a check for bestValue.

Initially discussed in #3171 and later in #3199, #3198 and #3210.
This PR effectively closes #3171
It also likely fixes #3196 where this causes user visible incorrect TB scores,
which probably result from these incorrect mate scores.

Passed STC and LTC non-regression tests.
https://tests.stockfishchess.org/tests/view/5f9ef8dabca9bf35bae7f648
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 21672 W: 2339 L: 2230 D: 17103
Ptnml(0-2): 126, 1689, 7083, 1826, 112

https://tests.stockfishchess.org/tests/view/5f9f0caebca9bf35bae7f666
LLR: 2.97 (-2.94,2.94) {-0.75,0.25}
Total: 33152 W: 1551 L: 1485 D: 30116
Ptnml(0-2): 27, 1308, 13832, 1390, 19

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

Bench: 3625915

3 years agoElo Worth in King Danger
FauziAkram [Thu, 29 Oct 2020 14:33:18 +0000 (17:33 +0300)]
Elo Worth in King Danger

Adding the EloWorth for each term in King Danger.
Should be useful for simplifications, tuning patches, and new ideas.

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

non-functional change

3 years agoOptimize affine transform for SSSE3 and higher targets.
Tomasz Sobczyk [Wed, 28 Oct 2020 23:14:53 +0000 (00:14 +0100)]
Optimize affine transform for SSSE3 and higher targets.

A non-functional speedup. Unroll the loops going over
the output dimensions in the affine transform layers by
a factor of 4 and perform 4 horizontal additions at a time.
Instead of doing naive horizontal additions on each vector
separately use hadd and shuffling between vectors to reduce
the number of instructions by using all lanes for all stages
of the horizontal adds.

passed STC of the initial version:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 17808 W: 1914 L: 1756 D: 14138
Ptnml(0-2): 76, 1330, 5948, 1460, 90
https://tests.stockfishchess.org/tests/view/5f9d516f6a2c112b60691da3

passed STC of the final version after cleanup:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 16296 W: 1750 L: 1595 D: 12951
Ptnml(0-2): 72, 1192, 5479, 1319, 86
https://tests.stockfishchess.org/tests/view/5f9df5776a2c112b60691de3

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

No functional change

3 years agoUpdate default net to nn-cb26f10b1fd9.nnue
mstembera [Fri, 30 Oct 2020 20:45:40 +0000 (13:45 -0700)]
Update default net to nn-cb26f10b1fd9.nnue

Result of https://tests.stockfishchess.org/tests/view/5f9a06796a2c112b60691c0f tuning.

STC
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 53712 W: 5776 L: 5561 D: 42375
Ptnml(0-2): 253, 4282, 17604, 4431, 286
https://tests.stockfishchess.org/tests/view/5f9c7bbc6a2c112b60691d4d

LTC
LLR: 2.97 (-2.94,2.94) {0.25,1.25}
Total: 80184 W: 4007 L: 3739 D: 72438
Ptnml(0-2): 58, 3302, 33130, 3518, 84
https://tests.stockfishchess.org/tests/view/5f9d01f06a2c112b60691d87

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

bench: 3517795

3 years agoDo not skip non-recapture ttMove when in check
syzygy1 [Tue, 27 Oct 2020 18:22:41 +0000 (19:22 +0100)]
Do not skip non-recapture ttMove when in check

The qsearch() MovePicker incorrectly skips a non-recapture ttMove
when in check (if depth <= DEPTH_QS_RECAPTURES). This is clearly not
intended and can cause qsearch() to return a mate score when there
is no mate. Introduced in cad300c and 6596f0e, as observed by
joergoster in #3171 and #3198.

This PR fixes the bug by not skipping the non-recapture ttMove when in check.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/5f9867ea6a2c112b60691b10
LLR: 2.98 (-2.94,2.94) {-1.25,0.25}
Total: 27112 W: 2943 L: 2842 D: 21327
Ptnml(0-2): 127, 2170, 8878, 2237, 144

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/5f9967326a2c112b60691bb0
LLR: 2.99 (-2.94,2.94) {-0.75,0.25}
Total: 18392 W: 807 L: 738 D: 16847
Ptnml(0-2): 9, 655, 7802, 718, 12

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

Bench: 3870606

3 years agoUpdate default net to nn-2eb2e0707c2b.nnue
SFisGOD [Tue, 27 Oct 2020 20:24:55 +0000 (04:24 +0800)]
Update default net to nn-2eb2e0707c2b.nnue

Optimization of the net weights of the 32 x 32 layer (1024 parameters) and net biases of the 512 x 32 layer (32 parameters) using SPSA.

Tuning of 32 x 32 Layer (800,000 games, 5 seconds time control):
https://tests.stockfishchess.org/tests/view/5f942040d3978d7e86f1aa05

Tuning of 512 x 32 Layer (80,000 games, 20 seconds time control):
https://tests.stockfishchess.org/tests/view/5f8f926d2c92c7fe3a8c608b

STC:
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 17336 W: 1918 L: 1754 D: 13664
Ptnml(0-2): 79, 1344, 5672, 1480, 93
https://tests.stockfishchess.org/tests/view/5f9882346a2c112b60691b34

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 37304 W: 1822 L: 1651 D: 33831
Ptnml(0-2): 27, 1461, 15501, 1640, 23
https://tests.stockfishchess.org/tests/view/5f98a4b36a2c112b60691b40

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

Bench: 3403528

3 years agoBishop Pawns based on Files
FauziAkram [Fri, 23 Oct 2020 23:01:04 +0000 (02:01 +0300)]
Bishop Pawns based on Files

Passed STC:
https://tests.stockfishchess.org/tests/view/5f8cc8145a4eacb45305da3c
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 132544 W: 27795 L: 27328 D: 77421
Ptnml(0-2): 2756, 15558, 29272, 15835, 2851

Passed LTC:
https://tests.stockfishchess.org/tests/view/5f8df614bacb75a4f9a4721e
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 169608 W: 23257 L: 22622 D: 123729
Ptnml(0-2): 1408, 16316, 48758, 16877, 1445

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

Bench: 4067106

3 years agoMore incremental accumulator updates
syzygy1 [Tue, 20 Oct 2020 19:06:06 +0000 (21:06 +0200)]
More incremental accumulator updates

This patch was inspired by c065abd which updates the accumulator,
if possible, based on the accumulator of two plies back if
the accumulator of the preceding ply is not available.

With this patch we look back even further in the position history
in an attempt to reduce the number of complete recomputations.
When we find a usable accumulator for the position N plies back,
we also update the accumulator of the position N-1 plies back
because that accumulator is most likely to be helpful later
when evaluating positions in sibling branches.
By not updating all intermediate accumulators immediately,
we avoid doing too much work that is not certain to be useful.
Overall, roughly 2-3% speedup.

This patch makes the code more specific to the net architecture,
changing input features of the net will require additional changes
to the incremental update code as discussed in the PR #3193 and #3191.

Passed STC:
https://tests.stockfishchess.org/tests/view/5f9056712c92c7fe3a8c60d0
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 10040 W: 1116 L: 968 D: 7956
Ptnml(0-2): 42, 722, 3365, 828, 63

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

No functional change.

3 years agoAdd net as dependency of config
Joost VandeVondele [Sun, 18 Oct 2020 13:01:19 +0000 (15:01 +0200)]
Add net as dependency of config

cleaner output and error message if the server is down and the net is not available.

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

No functional change

3 years agoReduce big time spikes by reducing PV re-searches.
xoto10 [Wed, 21 Oct 2020 13:52:13 +0000 (14:52 +0100)]
Reduce big time spikes by reducing PV re-searches.

Save time by reducing PV re-searches above original depth. Instead use 5% extra time on every move.

STC 10+0.1 th 1 :
LLR: 2.93 (-2.94,2.94) {-0.25,1.25}
Total: 90688 W: 9702 L: 9436 D: 71550
Ptnml(0-2): 408, 7252, 29792, 7450, 442
https://tests.stockfishchess.org/tests/view/5f8df807bacb75a4f9a47223

LTC 60+0.6 th 1 :
LLR: 2.97 (-2.94,2.94) {0.25,1.25}
Total: 97856 W: 4602 L: 4303 D: 88951
Ptnml(0-2): 53, 3757, 41057, 3960, 101
https://tests.stockfishchess.org/tests/view/5f8ec4872c92c7fe3a8c602d

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

Bench 3943959

3 years agoDo more reductions for late quiet moves in case of consecutive fail highs.
Vizvezdenec [Sat, 17 Oct 2020 11:40:10 +0000 (13:40 +0200)]
Do more reductions for late quiet moves in case of consecutive fail highs.

Idea of this patch can be described as following - in case we have consecutive fail highs and we reach late enough moves at root node probability of remaining quiet moves being able to produce even bigger value than moves that produced previous cutoff (so ones that should be high in move ordering but now they fail to produce beta cutoff because we actually reached high move count) should be quiet small so we can reduce them more.

passed STC
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 53392 W: 5681 L: 5474 D: 42237
Ptnml(0-2): 214, 4104, 17894, 4229, 255
https://tests.stockfishchess.org/tests/view/5f88501adcdad978fe8c527e

passed LTC
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 59136 W: 2773 L: 2564 D: 53799
Ptnml(0-2): 30, 2117, 25078, 2300, 43
https://tests.stockfishchess.org/tests/view/5f884dbfdcdad978fe8c527a

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

Bench: 4066972

3 years agoUpdate default net to nn-eba324f53044.nnue
mstembera [Sun, 18 Oct 2020 11:23:28 +0000 (04:23 -0700)]
Update default net to nn-eba324f53044.nnue

The new net is based on the previous net 04cf2b4ed1da but with the biases
for the 1st hidden layer tuned SPSA, see the SPSA session on fishtest there:
https://tests.stockfishchess.org/tests/view/5f875213dcdad978fe8c5211

Thanks to @vondele for writing out the net, see discussion in this thread:
https://github.com/mstembera/Stockfish/commit/432da86721647dff1d9426a7cdcfd2dbada8155e

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 15000 W: 1640 L: 1483 D: 11877
Ptnml(0-2): 50, 1183, 4908, 1278, 81
https://tests.stockfishchess.org/tests/view/5f8955e20fea1a44ec4f0a5d

Passed LTC:
LLR: 2.96 (-2.94,2.94) {0.25,1.25}
Total: 81272 W: 3948 L: 3682 D: 73642
Ptnml(0-2): 64, 3194, 33856, 3456, 66
https://tests.stockfishchess.org/tests/view/5f89e8efeae8a6e60644d6e7

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

Bench: 3762411

3 years agoScale factor tweak
Unai Corzo [Mon, 12 Oct 2020 07:03:49 +0000 (09:03 +0200)]
Scale factor tweak

Add !pawnsOnBothFlanks heuristic to scale factor.

STC https://tests.stockfishchess.org/tests/view/5f8080575b3847b5d41f9134
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 250960 W: 49779 L: 49168 D: 152013
Ptnml(0-2): 4224, 28822, 58802, 29383, 4249

LTC https://tests.stockfishchess.org/tests/view/5f832f498ea73fb8ddf83ddb
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 88584 W: 11827 L: 11388 D: 65369
Ptnml(0-2): 585, 8079, 26578, 8412, 638

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

bench: 3834252

3 years agoRookOnQueenFile Removal
FauziAkram [Tue, 6 Oct 2020 19:43:48 +0000 (22:43 +0300)]
RookOnQueenFile Removal

Removing Rook On Queen File looks beneficial, and it might even bring some ELO.
I will try to reintroduce it with a different method later on.

Passed STC:
https://tests.stockfishchess.org/tests/view/5f7cea204389873867eb10cb
LLR: 2.94 (-2.94,2.94) {-1.25,0.25}
Total: 18624 W: 3800 L: 3568 D: 11256
Ptnml(0-2): 308, 2131, 4257, 2253, 363

Passed LTC:
https://tests.stockfishchess.org/tests/view/5f7d76a4e936c6892bf50598
LLR: 2.95 (-2.94,2.94) {-0.75,0.25}
Total: 117864 W: 15515 L: 15340 D: 87009
Ptnml(0-2): 926, 11127, 34671, 11262, 946

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

Bench: 3756191

3 years agoUpdate default net to nn-04cf2b4ed1da.nnue
Joost VandeVondele [Wed, 14 Oct 2020 08:23:30 +0000 (10:23 +0200)]
Update default net to nn-04cf2b4ed1da.nnue

Further tune the net parameters, now the last but one layer (32x32).
To limit the number of parameters optimized, the network layer was
decomposed using SVD, and the singular values were treated
as parameters and tuned.

Tuning branch: https://github.com/vondele/Stockfish/tree/svdTune
Tuner: https://github.com/vondele/nevergrad4sf

passed STC:
https://tests.stockfishchess.org/tests/view/5f83e82f8ea73fb8ddf83e4e
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 8488 W: 944 L: 795 D: 6749
Ptnml(0-2): 39, 609, 2811, 734, 51

passed LTC:
https://tests.stockfishchess.org/tests/view/5f83f4118ea73fb8ddf83e66
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 169016 W: 8043 L: 7589 D: 153384
Ptnml(0-2): 133, 6623, 70538, 7085, 129

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

Bench: 3945198

3 years agoPawn Tuning
FauziAkram [Fri, 2 Oct 2020 12:32:19 +0000 (15:32 +0300)]
Pawn Tuning

Tuning of pawns, for classical evaluation:

Passed STC:
https://tests.stockfishchess.org/tests/view/5f771f0e52560f5fc78559ec
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 252696 W: 50321 L: 49692 D: 152683
Ptnml(0-2): 4614, 29845, 57049, 29978, 4862

Passed LTC:
https://tests.stockfishchess.org/tests/view/5f77cfef090dcf9aaa16d38b
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 48184 W: 6556 L: 6193 D: 35435
Ptnml(0-2): 335, 4516, 14100, 4733, 408

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

bench: 4016121

3 years agoSimplify away futility pruning for captures
Unai Corzo [Fri, 2 Oct 2020 20:00:55 +0000 (22:00 +0200)]
Simplify away futility pruning for captures

Remove futility pruning for captures.

STC https://tests.stockfishchess.org/tests/view/5f749bfed930428c36d34c56
LLR: 2.94 (-2.94,2.94) {-1.25,0.25}
Total: 38064 W: 4011 L: 3929 D: 30124
Ptnml(0-2): 192, 3004, 12567, 3068, 201

LTC https://tests.stockfishchess.org/tests/view/5f74d99bf18675b1ce2f7412
LLR: 2.94 (-2.94,2.94) {-0.75,0.25}
Total: 184984 W: 8567 L: 8610 D: 167807
Ptnml(0-2): 146, 7593, 77058, 7548, 147

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

bench: 3890648

3 years agoSchedule threads fairly under valgrind
Joost VandeVondele [Wed, 30 Sep 2020 19:22:36 +0000 (21:22 +0200)]
Schedule threads fairly under valgrind

fixes a rare case that can cause CI to fail when running multithreaded under valgrind.

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

No functional change.

3 years agoInclude pawns in NNUE scaling
Stéphane Nicolet [Mon, 28 Sep 2020 20:32:55 +0000 (22:32 +0200)]
Include pawns in NNUE scaling

We now include the total pawn count in the scaling factor for the output
of the NNUE evaluation network. This should have the effect of trying to
keep more pawns when SF has the advantage, but exchange them when she
is defending.

Thanks to Alexander Pagel (Lolligerhans) for the idea of using the
value of pawns to ease the comparison with the rest of the material
estimation.

Passed STC:
LLR: 2.93 (-2.94,2.94) {-0.25,1.25}
Total: 15072 W: 1700 L: 1539 D: 11833
Ptnml(0-2): 65, 1202, 4845, 1355, 69
https://tests.stockfishchess.org/tests/view/5f7235a63b22d6afa50699b3

Passed LTC:
LLR: 2.93 (-2.94,2.94) {0.25,1.25}
Total: 25880 W: 1270 L: 1124 D: 23486
Ptnml(0-2): 23, 980, 10788, 1126, 23
https://tests.stockfishchess.org/tests/view/5f723b483b22d6afa5069a99

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

Bench: 3776081

3 years agoTweak reduction formula.
Stefan Geschwentner [Mon, 28 Sep 2020 20:21:14 +0000 (22:21 +0200)]
Tweak reduction formula.

Replace log(i) with log(i + 0.25 * log(i)). This increases especially for low values the reductions. But for bigger values there are nearly no changes.

STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 49640 W: 5505 L: 5289 D: 38846
Ptnml(0-2): 270, 4074, 15924, 4274, 278
https://tests.stockfishchess.org/tests/view/5f71f04d3b22d6afa5069478

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 43856 W: 2209 L: 2021 D: 39626
Ptnml(0-2): 32, 1776, 18128, 1956, 36
https://tests.stockfishchess.org/tests/view/5f7232ee3b22d6afa50699a2

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

Bench: 3555769

3 years agoUpdate default net to nn-baeb9ef2d183.nnue
SFisGOD [Mon, 28 Sep 2020 18:24:26 +0000 (02:24 +0800)]
Update default net to nn-baeb9ef2d183.nnue

Further optimization of Sergio's nn-03744f8d56d8.nnue
This patch is the result of collaboration with Joost VandeVondele.

STC:
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 37000 W: 4145 L: 3947 D: 28908
Ptnml(0-2): 191, 3016, 11912, 3166, 215
https://tests.stockfishchess.org/tests/view/5f71e7983b22d6afa5069475

LTC:
LLR: 2.96 (-2.94,2.94) {0.25,1.25}
Total: 60224 W: 2992 L: 2769 D: 54463
Ptnml(0-2): 48, 2420, 24956, 2637, 51
https://tests.stockfishchess.org/tests/view/5f722bb83b22d6afa506998f

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

Bench: 3720073

3 years agoTweaking Mobility and Safe Check
FauziAkram [Mon, 28 Sep 2020 19:09:43 +0000 (22:09 +0300)]
Tweaking Mobility and Safe Check

Passed STC:
https://tests.stockfishchess.org/tests/view/5f70d86d3b22d6afa50693b9
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 100368 W: 20323 L: 19914 D: 60131
Ptnml(0-2): 1927, 11641, 22605, 12118, 1893

Passed LTC:
https://tests.stockfishchess.org/tests/view/5f71bb553b22d6afa5069457
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 77648 W: 10613 L: 10181 D: 56854
Ptnml(0-2): 634, 7280, 22594, 7652, 664

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

Bench: 3861984

3 years agoAdjust null move pruning constants
Vizvezdenec [Mon, 28 Sep 2020 17:20:06 +0000 (20:20 +0300)]
Adjust null move pruning constants

Idea is that division by fraction of 2 is slightly faster than by other numbers so parameters are adjusted in a way that division in null move pruning depth reduction features dividing by 256 instead of dividing by 213.
Other than this patch is almost non-functional - difference starts to exist by depth 133.

passed STC
https://tests.stockfishchess.org/tests/view/5f70dd943b22d6afa50693c5
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 57048 W: 6616 L: 6392 D: 44040
Ptnml(0-2): 304, 4583, 18531, 4797, 309

passed LTC
https://tests.stockfishchess.org/tests/view/5f7180db3b22d6afa506941f
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 45960 W: 2419 L: 2229 D: 41312
Ptnml(0-2): 43, 1779, 19137, 1987, 34

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

bench 3789924

3 years agoUpdate default net to nn-04a843f8932e.nnue
Joost VandeVondele [Sat, 26 Sep 2020 15:47:52 +0000 (17:47 +0200)]
Update default net to nn-04a843f8932e.nnue

an optimization of Sergio's nn-03744f8d56d8.nnue tuning the output layer (33 parameters) on game play.

WIP code to make layer parameters tunable is https://github.com/vondele/Stockfish/tree/optionOutput
Optimization itself is using https://github.com/vondele/nevergrad4sf
Writing of the modified net using WIP code based on the learner code https://github.com/vondele/Stockfish/tree/evalWrite

Most parameters in the output layer are changed only little (~5 for int8_t).

passed STC:
https://tests.stockfishchess.org/tests/view/5f716f6b3b22d6afa506941a
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 15488 W: 1859 L: 1689 D: 11940
Ptnml(0-2): 79, 1260, 4917, 1388, 100

passed LTC:
https://tests.stockfishchess.org/tests/view/5f71908e3b22d6afa506942e
LLR: 2.93 (-2.94,2.94) {0.25,1.25}
Total: 8728 W: 518 L: 400 D: 7810
Ptnml(0-2): 7, 338, 3556, 456, 7

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

Bench: 3789924

3 years agoUse incremental updates more often
noobpwnftw [Sun, 27 Sep 2020 18:29:21 +0000 (02:29 +0800)]
Use incremental updates more often

Use incremental updates for accumulators for up to 2 plies.
Do not copy accumulator. About 2% speedup.

Passed STC:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 21752 W: 2583 L: 2403 D: 16766
Ptnml(0-2): 128, 1761, 6923, 1931, 133
https://tests.stockfishchess.org/tests/view/5f7150cf3b22d6afa5069412

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

No functional change

3 years agoTweak nnue scaling to keep more material
Stéphane Nicolet [Sat, 26 Sep 2020 21:19:53 +0000 (23:19 +0200)]
Tweak nnue scaling to keep more material

Current master uses a constant scale factor of 5/4 = 1.25 for the output
of the NNUE network, for compatibility with search and classical evaluation.
We modify this scale factor to make it dependent on the phase of the game,
going from about 1.5 in the opening to 1.0 for pure pawn endgames.

This helps Stockfish to avoid exchanges of pieces (heavy pieces in particular)
when she has the advantage, keeping more material on the board when attacking.

Passed STC:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 14744 W: 1771 L: 1599 D: 11374
Ptnml(0-2): 87, 1184, 4664, 1344, 93
https://tests.stockfishchess.org/tests/view/5f6fb0a63b22d6afa506904f

Passed LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 8912 W: 512 L: 393 D: 8007
Ptnml(0-2): 7, 344, 3637, 459, 9
https://tests.stockfishchess.org/tests/view/5f6fcf533b22d6afa5069066

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

Bench: 3943952

3 years agoSwitch to NNUE eval probabilistically for OCB
SFisGOD [Wed, 23 Sep 2020 06:00:42 +0000 (14:00 +0800)]
Switch to NNUE eval probabilistically for OCB

Introduce a small chance of switching to NNUE if PSQ imbalance is large but we have opposite colored bishops and the classical eval is struggling to win.

STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 25304 W: 3179 L: 2983 D: 19142
Ptnml(0-2): 172, 2171, 7781, 2345, 183
https://tests.stockfishchess.org/tests/view/5f6b14dec7759d4ee307cfe3

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.25}
Total: 84680 W: 4846 L: 4556 D: 75278
Ptnml(0-2): 89, 3933, 34011, 4213, 94
https://tests.stockfishchess.org/tests/view/5f6b3fb6c7759d4ee307cff9

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

Bench: 3865413

3 years agoSuppress info strings before 'uci'
Stéphane Nicolet [Thu, 24 Sep 2020 09:38:35 +0000 (11:38 +0200)]
Suppress info strings before 'uci'

On Windows, Stockfish wouldn't launch in some GUI because we output some
info strings (about the use of large pages) before sending the 'uci'
command. It seems more robust to suppress these info strings, and instead
to add a proper section section in the Readme about large pages use.

fixes https://github.com/official-stockfish/Stockfish/issues/3052
closes https://github.com/official-stockfish/Stockfish/pull/3147

No functional change

3 years agoIncrease reductions with the number of threads
Stéphane Nicolet [Tue, 22 Sep 2020 20:43:41 +0000 (22:43 +0200)]
Increase reductions with the number of threads

Passed STC with 8 threads:
LLR: 2.92 (-2.94,2.94) {-0.25,1.25}
Total: 13520 W: 1135 L: 1012 D: 11373
Ptnml(0-2): 39, 815, 4929, 938, 39
https://tests.stockfishchess.org/tests/view/5f68e274ded68c240be73f41

Passed LTC with 8 threads:
LLR: 2.96 (-2.94,2.94) {0.25,1.25}
Total: 48384 W: 2183 L: 1994 D: 44207
Ptnml(0-2): 28, 1777, 20402, 1948, 37
https://tests.stockfishchess.org/tests/view/5f68f068ded68c240be747e9

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

No functional change (for one thread)

3 years agoSmall cleanups 12
Stéphane Nicolet [Wed, 9 Sep 2020 08:49:31 +0000 (10:49 +0200)]
Small cleanups 12

- Clean signature of functions in namespace NNUE
- Add comment for countermove based pruning
- Remove bestMoveCount variable
- Add const qualifier to kpp_board_index array
- Fix spaces in get_best_thread()
- Fix indention in capture LMR code in search.cpp
- Rename TtmemDeleter to LargePageDeleter

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

No functional change

3 years agoAdd large page support for NNUE weights and simplify TT mem management
Sami Kiminki [Sun, 30 Aug 2020 16:41:30 +0000 (19:41 +0300)]
Add large page support for NNUE weights and simplify TT mem management

Use TT memory functions to allocate memory for the NNUE weights. This
should provide a small speed-up on systems where large pages are not
automatically used, including Windows and some Linux distributions.

Further, since we now have a wrapper for std::aligned_alloc(), we can
simplify the TT memory management a bit:

- We no longer need to store separate pointers to the hash table and
  its underlying memory allocation.
- We also get to merge the Linux-specific and default implementations
  of aligned_ttmem_alloc().

Finally, we'll enable the VirtualAlloc code path with large page
support also for Win32.

STC: https://tests.stockfishchess.org/tests/view/5f66595823a84a47b9036fba
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 14896 W: 1854 L: 1686 D: 11356
Ptnml(0-2): 65, 1224, 4742, 1312, 105

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

No functional change.