]> git.sesse.net Git - stockfish/log
stockfish
2 months agoCI give creditials for the clang-format action
Joost VandeVondele [Sat, 6 Jul 2024 15:31:54 +0000 (17:31 +0200)]
CI give creditials for the clang-format action

following up from earlier changes

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

No functional change

2 months agoCorrect and extend PV lines with decisive TB score
Joost VandeVondele [Tue, 25 Jun 2024 14:54:25 +0000 (16:54 +0200)]
Correct and extend PV lines with decisive TB score

Currently (after #5407), SF has the property that any PV line with a decisive
TB score contains the corresponding TB position, with a score that correctly
identifies the depth at which TB are entered. The PV line that follows might
not preserve the game outcome, but can easily be verified and extended based on
TB information. This patch provides this functionality, simply extending the PV
lines on output, this doesn't affect search.

Indeed, if DTZ tables are available, search based PV lines that correspond to
decisive TB scores are verified to preserve game outcome, truncating the line
as needed. Subsequently, such PV lines are extended with a game outcome
preserving line until mate, as a possible continuation.  These lines are not
optimal mating lines, but are similar to what a user could produce on a website
like https://syzygy-tables.info/ clicking always the top ranked move, i.e.
minimizing or maximizing DTZ (with a simple tie-breaker for moves that have
identical DTZ), and are thus an just an illustration of how to game can be won.

A similar approach is already in established in
https://github.com/joergoster/Stockfish/tree/matefish2

This also contributes to addressing #5175 where SF can give an incorrect TB
win/loss for positions in TB with a movecounter that doesn't reflect optimal
play. While the full solution requires either TB generated differently, or a
search when ranking rootmoves, current SF will eventually find a draw in these
cases, in practice quite quickly, e.g.
`1kq5/q2r4/5K2/8/8/8/8/7Q w - - 96 1`
`8/8/6k1/3B4/3K4/4N3/8/8 w - - 54 106`

Gives the same results as master on an extended set of test positions from
https://github.com/mcostalba/Stockfish/commit/9173d29c414ddb8f4bec74e4db3ccbe664c66bf9
with the exception of the above mentioned fen where this commit improves.

With https://github.com/vondele/matetrack using 6men TB, all generated PVs verify:
```
Using ../Stockfish/src/stockfish.syzygyExtend on matetrack.epd with --nodes 1000000 --syzygyPath /chess/syzygy/3-4-5-6/WDL:/chess/syzygy/3-4-5-6/DTZ
Engine ID:     Stockfish dev-20240704-ff227954
Total FENs:    6555
Found mates:   3299
Best mates:    2582
Found TB wins: 568
```

As repeated DTZ probing could be slow a procedure (100ms+ on HDD, a few ms on
SSD), the extension is only done as long as the time taken is less than half
the `Move Overhead` parameter. For tournaments where these lines might be of
interest to the user, a suitable `Move Overhead` might be needed (e.g. TCEC has
1000ms already).

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

No functional change

2 months agoUpdate 7 stat bonus/malus params
Linmiao Xu [Mon, 1 Jul 2024 20:26:44 +0000 (16:26 -0400)]
Update 7 stat bonus/malus params

Values found around 119k / 120k spsa games at 60+0.6:
https://tests.stockfishchess.org/tests/view/6683112a192114e61f92f87a

Passed STC:
https://tests.stockfishchess.org/tests/view/66838148c4f539faa0326897
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 40928 W: 10835 L: 10508 D: 19585
Ptnml(0-2): 139, 4802, 10254, 5131, 138

Passed LTC:
https://tests.stockfishchess.org/tests/view/668448a87a1863935cee42c6
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 29208 W: 7559 L: 7253 D: 14396
Ptnml(0-2): 17, 3118, 8019, 3442, 8

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

bench 1138753

2 months agoOutput from a fix depth onward, instead of 3s.
Joost VandeVondele [Wed, 3 Jul 2024 15:39:55 +0000 (17:39 +0200)]
Output from a fix depth onward, instead of 3s.

To avoid output that depends on timing, output currmove and similar only from depth > 30
onward.  Current choice of 3s makes the output of the same search depending on
the system load, and doesn't always start at move 1. Depth 30 is nowadays
reached in a few seconds on most systems.

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

No functional change

2 months agoUse explicit action permissions in CI
Disservin [Wed, 3 Jul 2024 12:07:48 +0000 (14:07 +0200)]
Use explicit action permissions in CI

Necessary modifications according to changes in the GitHub Action settings.

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

Follow up from the report by Yaron Avital (yaronav) earlier.

No functional change

2 months agoCI: limit artifact uploads
Joost VandeVondele [Wed, 3 Jul 2024 09:14:41 +0000 (11:14 +0200)]
CI: limit artifact uploads

do not upload some unneeded intermediate directories,
disable running authenticated git commands with the checkout action.

Thanks to Yaron A for the report.

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

No functional change

2 months agoImplement dbg_extremes_of
Shawn Xu [Tue, 2 Jul 2024 22:06:37 +0000 (15:06 -0700)]
Implement dbg_extremes_of

An alternative to #5431, implements one function `dbg_extremes_of` to keep track
of min and max.

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

No functional change

2 months agoMove info strings once more
Joost VandeVondele [Tue, 2 Jul 2024 12:18:04 +0000 (14:18 +0200)]
Move info strings once more

Follow up from #5404 ... current location leads to troubles with Aquarium GUI

Fixes #5430

Now prints the information on threads and available processors at the beginning
of search, where info about the networks is already printed (and is known to
work)

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

No functional change.

2 months agoLimit has_game_cycle() to only upcoming repetition
Shahin M. Shahin [Mon, 24 Jun 2024 22:57:35 +0000 (01:57 +0300)]
Limit has_game_cycle() to only upcoming repetition

use the original algorithm according to the paper
http://web.archive.org/web/20201107002606/https://marcelk.net/2013-04-06/paper/upcoming-rep-v2.pdf,
which detects accurately if a position has an upcoming repetition. The 'no
progress' part of has_game_cycle has been removed, the function has been
renamed to upcoming_repetition to reflect this.

As a result of this fix, to the best of our knowledge, all PVs for completed
iterations that yield a mate or decisive table base score now end in mate or
contain a TB position, respectively.

passed non-regression STC:
https://tests.stockfishchess.org/tests/view/6679fa1d0c2db3fa2dcecbf2
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 63584 W: 16666 L: 16472 D: 30446
Ptnml(0-2): 186, 7552, 16146, 7698, 210

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/667ac965e439ed1c7a9ca042
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 464574 W: 117493 L: 117729 D: 229352
Ptnml(0-2): 311, 52468, 126974, 52214, 320

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

bench: 1209805

2 months agoDo Capture History Updates In Probcut
Shawn Xu [Mon, 1 Jul 2024 05:04:51 +0000 (22:04 -0700)]
Do Capture History Updates In Probcut

This patch introduces history updates to probcut. Standard depth - 3 bonus and
maluses are given to the capture that caused fail high and previously searched
captures, respectively. Similar to #5243, a negative history fill is applied to
compensate for an increase in capture history average, thus improving the
scaling of this patch.

Passed STC:
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 84832 W: 21941 L: 21556 D: 41335
Ptnml(0-2): 226, 9927, 21688, 10386, 189
https://tests.stockfishchess.org/tests/view/6682fab9389b9ee542b1d029

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 104298 W: 26469 L: 26011 D: 51818
Ptnml(0-2): 43, 11458, 28677, 11940, 31
https://tests.stockfishchess.org/tests/view/6682ff06389b9ee542b1d0a0

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

bench 1281351

2 months agoProbcut in check no matter if pv or capture
Dubslow [Sun, 30 Jun 2024 23:22:04 +0000 (19:22 -0400)]
Probcut in check no matter if pv or capture

Passed STC: https://tests.stockfishchess.org/tests/view/6681e9c8c1657e386d294cef
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 217824 W: 56149 L: 56129 D: 105546
Ptnml(0-2): 587, 25926, 55848, 25982, 569

Passed LTC: https://tests.stockfishchess.org/tests/view/6681fcb8c1657e386d294db1
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 357552 W: 90546 L: 90671 D: 176335
Ptnml(0-2): 207, 40064, 98362, 39933, 210

Each half of this also passed STC+LTC separately

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

bench 1227870

2 months agoUpdate some params for pruning at shallow depth
Linmiao Xu [Sun, 30 Jun 2024 21:00:49 +0000 (17:00 -0400)]
Update some params for pruning at shallow depth

Values found around 82k / 120k spsa games at 60+0.6:
https://tests.stockfishchess.org/tests/view/6681aca4481148df247298bd

Passed STC:
https://tests.stockfishchess.org/tests/view/6681c795c1657e386d2948fa
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 145216 W: 37595 L: 37122 D: 70499
Ptnml(0-2): 375, 17122, 37185, 17507, 419

Passed LTC:
https://tests.stockfishchess.org/tests/view/6681d4eec1657e386d2949e0
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 154062 W: 39117 L: 38557 D: 76388
Ptnml(0-2): 67, 16874, 42608, 17396, 86

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

bench 996419

2 months agoSimplify worsening deduction in futility margin
Linmiao Xu [Sun, 30 Jun 2024 15:43:36 +0000 (11:43 -0400)]
Simplify worsening deduction in futility margin

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/66817d46442423e547141226
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 345408 W: 89146 L: 89266 D: 166996
Ptnml(0-2): 954, 41317, 88286, 41189, 958

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/66818dbe1e90a146232d1f62
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 173214 W: 43821 L: 43755 D: 85638
Ptnml(0-2): 108, 19407, 47492, 19511, 89

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

bench 981017

2 months agoSimplify rm.averageScore calculation
FauziAkram [Sun, 30 Jun 2024 19:24:28 +0000 (22:24 +0300)]
Simplify rm.averageScore calculation

Passed STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 485056 W: 125222 L: 125497 D: 234337
Ptnml(0-2): 1384, 58197, 123614, 57976, 1357
https://tests.stockfishchess.org/tests/view/6681816d442423e54714133f

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 56622 W: 14301 L: 14115 D: 28206
Ptnml(0-2): 31, 6259, 15538, 6459, 24
https://tests.stockfishchess.org/tests/view/6681a9a5596d543edc677490

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

bench: 1171203

2 months agoIncrease reduction based on correct expectation
Shahin M. Shahin [Sun, 30 Jun 2024 13:32:20 +0000 (16:32 +0300)]
Increase reduction based on correct expectation

If the current node is not a cutNode then it means that the child is one in LMR
and the cutoff count is expected, so more reduction when the cutoffs are
expected

Passed STC:
https://tests.stockfishchess.org/tests/view/66815e791c5b344a34ca7090
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 64416 W: 16876 L: 16519 D: 31021
Ptnml(0-2): 150, 7670, 16264, 7921, 203

Passed LTC:
https://tests.stockfishchess.org/tests/view/668162f61c5b344a34ca725c
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 78186 W: 19905 L: 19499 D: 38782
Ptnml(0-2): 55, 8561, 21437, 9003, 37

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

bench: 1161531

2 months agoTweak multicut
Michael Chaly [Sun, 30 Jun 2024 09:47:04 +0000 (12:47 +0300)]
Tweak multicut

This patch is an original patch by author of Altair
(https://github.com/Alex2262/AltairChessEngine) chess engine.

It allows to produce more aggressive multicut compared to master by changing
condition it needs to fulfil and also returns bigger value.  Also has applied
matetrack fix on top.

Passed STC:
https://tests.stockfishchess.org/tests/view/667223ab602682471b0650e2
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 50048 W: 13200 L: 12860 D: 23988
Ptnml(0-2): 181, 5822, 12679, 6160, 182

Passed LTC:
https://tests.stockfishchess.org/tests/view/6672f777602682471b06515d
LLR: 2.97 (-2.94,2.94) <0.50,2.50>
Total: 706380 W: 179707 L: 177981 D: 348692
Ptnml(0-2): 656, 79250, 191665, 80950, 669

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

bench 1148966

2 months agoGrade countermove bonus for low statscores
Daniel Monroe [Sun, 30 Jun 2024 01:23:41 +0000 (21:23 -0400)]
Grade countermove bonus for low statscores

Passed STC:
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 338592 W: 88396 L: 87627 D: 162569
Ptnml(0-2): 1161, 40201, 85788, 41000, 1146
https://tests.stockfishchess.org/tests/view/6679d40c0c2db3fa2dcecbcc

Passed LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 83526 W: 21429 L: 21010 D: 41087
Ptnml(0-2): 54, 9173, 22913, 9546, 77
https://tests.stockfishchess.org/tests/view/667c5f2980450dba965911fc

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

bench: 1489815

2 months agoSimplify away a useless TTEntry::read()
mstembera [Sun, 30 Jun 2024 00:18:39 +0000 (17:18 -0700)]
Simplify away a useless TTEntry::read()

Not needed when we don hit an entry.

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

No functional change

2 months agoSkip futility pruning if beta is below TB loss value
Taras Vuk [Tue, 25 Jun 2024 08:48:50 +0000 (10:48 +0200)]
Skip futility pruning if beta is below TB loss value

Passed STC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 77024 W: 20122 L: 19946 D: 36956
Ptnml(0-2): 278, 8754, 20277, 8920, 283
https://tests.stockfishchess.org/tests/view/66752d59602682471b0652f3

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 93114 W: 23623 L: 23477 D: 46014
Ptnml(0-2): 77, 9839, 26566, 10011, 64
https://tests.stockfishchess.org/tests/view/6676b3e1602682471b065395

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

bench: 1003441

2 months agoFix typos in comments
Joost VandeVondele [Mon, 1 Jul 2024 17:44:00 +0000 (19:44 +0200)]
Fix typos in comments

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

No functional change

2 months agoRemove redundant inline
FauziAkram [Mon, 24 Jun 2024 14:12:07 +0000 (17:12 +0300)]
Remove redundant inline

constexpr implies inline anyway

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

No functional change

2 months agoMove info output afer uciok
Joost VandeVondele [Sun, 23 Jun 2024 19:53:25 +0000 (21:53 +0200)]
Move info output afer uciok

fixes #5393 : an incompatibility with an older GUI (Chesspartner)
fixes #5396 : an incompatibility with an older GUI (Fritz9)

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

No functional change

3 months agoInternal iterative reductions: decrease depth more
FauziAkram [Sun, 16 Jun 2024 21:03:15 +0000 (00:03 +0300)]
Internal iterative reductions: decrease depth more

For PV nodes without a ttMove, we decrease depth.
But in this patch, additionally, if the current position is found in the TT, and the stored depth in the TT is greater than or equal to
the current search depth, we decrease the search depth even further.

Passed STC:
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 84384 W: 22154 L: 21761 D: 40469
Ptnml(0-2): 292, 9972, 21315, 10277, 336
https://tests.stockfishchess.org/tests/view/666b0a4d602682471b064db6

Passed LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 92106 W: 23471 L: 23032 D: 45603
Ptnml(0-2): 79, 10155, 25154, 10578, 87
https://tests.stockfishchess.org/tests/view/666c423d602682471b064e56

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

bench: 1038234

3 months agoSimplify Bonus Formula In History Adjustment
Shawn Xu [Sun, 16 Jun 2024 23:14:22 +0000 (16:14 -0700)]
Simplify Bonus Formula In History Adjustment

Inspired by a discord message [1] from Vizvezdenec, this patch simplifies the
bonus adjustment bonus = bonus > 0 ? 2 * bonus : bonus / 2 to a constant
addition, maintaining bonus average at around 0 in regular bench. As cj5716
pointed in discord [2], the constant bonus can also be considered as factoring
tempo when calculating bonus, yielding a better value of the move.

[1] https://discord.com/channels/435943710472011776/882956631514689597/1243877089443188776
[2] https://discord.com/channels/435943710472011776/813919248455827515/1252277437249622077

Passed Non-regression STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 29984 W: 7908 L: 7677 D: 14399
Ptnml(0-2): 95, 3502, 7594, 3679, 122
https://tests.stockfishchess.org/tests/view/666f7210602682471b064fa2

Passed Non-regression LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 170136 W: 43214 L: 43145 D: 83777
Ptnml(0-2): 158, 19185, 46311, 19258, 156
https://tests.stockfishchess.org/tests/view/666fb32e602682471b064fb5

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

bench 1438375

3 months agoSimplify static exchange evaluation pruning formula
evqsx [Sun, 16 Jun 2024 04:34:24 +0000 (12:34 +0800)]
Simplify static exchange evaluation pruning formula

Passed STC: https://tests.stockfishchess.org/tests/view/666bda31602682471b064e1f
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 141696 W: 36932 L: 36826 D: 67938
Ptnml(0-2): 510, 16880, 35989, 16932, 537

Passed LTC: https://tests.stockfishchess.org/tests/view/666e6b67602682471b064f4b
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 159504 W: 40552 L: 40471 D: 78481
Ptnml(0-2): 130, 18160, 43103, 18217, 142

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

bench: 1084115

3 months agoCI/CD: play games
Joost VandeVondele [Sat, 22 Jun 2024 07:17:45 +0000 (09:17 +0200)]
CI/CD: play games

this action plays games under fast-chess with a `debug=yes` compiled binary.

It checks for triggered asserts in the code, or generally for engine disconnects.

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

No functional change

3 months agoConsider wider range of moves near leaves.
xoto10 [Fri, 14 Jun 2024 16:27:09 +0000 (17:27 +0100)]
Consider wider range of moves near leaves.

try to avoid missing good moves for opponent or engine, by updating bestMove
also when value == bestValue (i.e. value == alpha) under certain conditions.
In particular require this is at higher depth in the tree, leaving the logic
near the root unchanged, and only apply randomly. Avoid doing this near mate
scores, leaving mate PVs intact.

Passed SMP STC 6+0.06 th7 :
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 42040 W: 10930 L: 10624 D: 20486
Ptnml(0-2): 28, 4682, 11289, 4998, 23
https://tests.stockfishchess.org/tests/view/66608b00c340c8eed7757d1d

Passed SMP LTC 24+0.24 th7 :
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 73692 W: 18978 L: 18600 D: 36114
Ptnml(0-2): 9, 7421, 21614, 7787, 15
https://tests.stockfishchess.org/tests/view/666095e8c340c8eed7757d49

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

Bench 1205168

3 months agoTweak the reduction formula
FauziAkram [Wed, 12 Jun 2024 11:04:43 +0000 (14:04 +0300)]
Tweak the reduction formula

Tweak the reduction formula if position is or has been on the PV
Taking inspiration from an old Viren test.

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 78528 W: 20607 L: 20225 D: 37696
Ptnml(0-2): 262, 9297, 19785, 9637, 283
https://tests.stockfishchess.org/tests/view/666339c70ff7cb4868d1fe24

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 138630 W: 35666 L: 35132 D: 67832
Ptnml(0-2): 118, 15345, 37835, 15919, 98
https://tests.stockfishchess.org/tests/view/66645dec0612cd151f9e77b0

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

Bench: 1134281

3 months agoFix readability of TTEntry occupancy check
Dubslow [Wed, 12 Jun 2024 08:14:55 +0000 (03:14 -0500)]
Fix readability of TTEntry occupancy check

Passed STC:
https://tests.stockfishchess.org/tests/view/66695b6a602682471b064cfc
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 107520 W: 28138 L: 27998 D: 51384
Ptnml(0-2): 373, 12257, 28358, 12401, 371

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

No functional change

3 months agoFix upperbound/lowerbound output in multithreaded case
Joost VandeVondele [Wed, 12 Jun 2024 11:23:26 +0000 (13:23 +0200)]
Fix upperbound/lowerbound output in multithreaded case

In case a stop is received during multithreaded searches, the PV of the best
thread might be printed without the correct upperbound/lowerbound indicators.
This was due to the pvIdx variable being incremented after receiving the stop.

passed STC:
https://tests.stockfishchess.org/tests/view/666985da602682471b064d08
 LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 196576 W: 51039 L: 50996 D: 94541
Ptnml(0-2): 760, 22545, 51603, 22652, 728

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

Bench: 1160467

3 months agoAdd matetrack to CI
Joost VandeVondele [Thu, 13 Jun 2024 16:43:19 +0000 (18:43 +0200)]
Add matetrack to CI

verifies that all mate PVs printed for finished iterations (i.e. no lower or upper bounds),
are complete, i.e. of the expected length and ending in mate, and do not contain drawing
or illegal moves.

based on a set of 2000 positions and the code in https://github.com/vondele/matetrack

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

No functional change

3 months agoFix printing of empty info strings.
Tomasz Sobczyk [Wed, 12 Jun 2024 14:54:15 +0000 (16:54 +0200)]
Fix printing of empty info strings.

Handle printing of `info string` in a single place.

Fixes #5386

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

No functional change

3 months agoLimit depth after extensions to avoid asserts.
Joost VandeVondele [Tue, 11 Jun 2024 19:28:11 +0000 (21:28 +0200)]
Limit depth after extensions to avoid asserts.

currently extensions can cause depth to exceed MAX_PLY.

This triggers the assert near line 542 in search when running a binary compiled with `debug=yes` on a testcase like:
```
position fen 7K/P1p1p1p1/2P1P1Pk/6pP/3p2P1/1P6/3P4/8 w - - 0 1
go nodes 1000000
```

passed STC
https://tests.stockfishchess.org/tests/view/6668a56a602682471b064c8d
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 143936 W: 37338 L: 37238 D: 69360
Ptnml(0-2): 514, 16335, 38149, 16477, 493

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

Bench: 1160467

3 months agoGive positional output more weight in nnue eval
Linmiao Xu [Sat, 8 Jun 2024 21:57:09 +0000 (14:57 -0700)]
Give positional output more weight in nnue eval

This effectively reverts the removal of delta in:
https://github.com/official-stockfish/Stockfish/pull/5373

Passed STC:
https://tests.stockfishchess.org/tests/view/6664d41922234461cef58e6b
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 56448 W: 14849 L: 14500 D: 27099
Ptnml(0-2): 227, 6481, 14457, 6834, 225

Passed LTC:
https://tests.stockfishchess.org/tests/view/666587a1996b40829f4ee007
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 91686 W: 23402 L: 22963 D: 45321
Ptnml(0-2): 78, 10205, 24840, 10640, 80

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

bench 1160467

3 months agoMove options into the engine
Disservin [Tue, 4 Jun 2024 20:29:27 +0000 (22:29 +0200)]
Move options into the engine

Move the engine options into the engine class, also avoid duplicated
initializations after startup.  UCIEngine needs to register an add_listener to
listen to all option changes and print these.  Also avoid a double
initialization of the TT, which was the case with the old state.

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

No functional change

3 months agoSimplify TT interface and avoid changing TT info
Dubslow [Mon, 10 Jun 2024 23:03:36 +0000 (18:03 -0500)]
Simplify TT interface and avoid changing TT info

This commit builds on the work and ideas of #5345, #5348, and #5364.

Place as much as possible of the TT implementation in tt.cpp, rather than in the
header.  Some commentary is added to better document the public interface.

Fix the search read-TT races, or at least contain them to within TT methods only.

Passed SMP STC: https://tests.stockfishchess.org/tests/view/666134ab91e372763104b443
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 512552 W: 132387 L: 132676 D: 247489
Ptnml(0-2): 469, 58429, 138771, 58136, 471

The unmerged version has bench identical to the other PR (see also #5348) and
therefore those same-functionality tests:

SMP LTC: https://tests.stockfishchess.org/tests/view/665c7021fd45fb0f907c214a
SMP LTC: https://tests.stockfishchess.org/tests/view/665d28a7fd45fb0f907c5495

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

bench 1205675

3 months agoKeep mate PVs intact.
Joost VandeVondele [Fri, 7 Jun 2024 21:53:33 +0000 (23:53 +0200)]
Keep mate PVs intact.

do not return a cutoff value in razoring if that value is in the mate/tb range.

passed STC:
https://tests.stockfishchess.org/tests/view/666381880ff7cb4868d1fe58
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 130848 W: 34046 L: 33931 D: 62871
Ptnml(0-2): 429, 14968, 34524, 15065, 438

passed LTC:
https://tests.stockfishchess.org/tests/view/66643f120612cd151f9e7788
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 39702 W: 10157 L: 9959 D: 19586
Ptnml(0-2): 20, 4108, 11402, 4296, 25

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

Bench: 1174094

3 months agoMake repeated bench runs identical
cj5716 [Fri, 7 Jun 2024 10:30:33 +0000 (18:30 +0800)]
Make repeated bench runs identical

fixes https://github.com/official-stockfish/Stockfish/issues/5376
closes https://github.com/official-stockfish/Stockfish/pull/5377

No functional changes

3 months agoRemove the correction history bonus in null move search
evqsx [Thu, 6 Jun 2024 07:43:55 +0000 (15:43 +0800)]
Remove the correction history bonus in null move search

Passed STC:
https://tests.stockfishchess.org/tests/view/666168e191e372763104c664
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 94848 W: 24708 L: 24550 D: 45590
Ptnml(0-2): 289, 11355, 24033, 11403, 344

Passed LTC:
https://tests.stockfishchess.org/tests/view/6661e73591e372763104c751
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 70452 W: 17849 L: 17679 D: 34924
Ptnml(0-2): 27, 7707, 19596, 7861, 35

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

Bench: 1174094

3 months agoLinearize corrHist
Dubslow [Thu, 6 Jun 2024 18:10:30 +0000 (13:10 -0500)]
Linearize corrHist

Passed STC: https://tests.stockfishchess.org/tests/view/6661fff88dd8f31ed3c5d819
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 17504 W: 4651 L: 4406 D: 8447
Ptnml(0-2): 71, 1975, 4384, 2282, 40

Passed LTC: https://tests.stockfishchess.org/tests/view/666205b48dd8f31ed3c61296
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 24522 W: 6313 L: 6094 D: 12115
Ptnml(0-2): 14, 2643, 6726, 2866, 12

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

Bench: 1237729

3 months agoRemove delta from evaluation
Dubslow [Mon, 3 Jun 2024 22:47:03 +0000 (17:47 -0500)]
Remove delta from evaluation

Passed STC: https://tests.stockfishchess.org/tests/view/6660e49c6489614cdad14e29
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 188768 W: 48907 L: 48854 D: 91007
Ptnml(0-2): 584, 22571, 48005, 22656, 568

Passed LTC: https://tests.stockfishchess.org/tests/view/6660ff9791e372763104b38c
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 310680 W: 78651 L: 78727 D: 153302
Ptnml(0-2): 180, 34818, 85433, 34716, 193

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

Bench: 1214575

3 months agoNumaPolicy fixes and robustness improvements
Tomasz Sobczyk [Thu, 6 Jun 2024 10:47:24 +0000 (12:47 +0200)]
NumaPolicy fixes and robustness improvements

1. Fix GetProcessGroupAffinity still not getting properly aligned memory
   sometimes.
2. Fix a very theoretically possible heap corruption if
   GetActiveProcessorGroupCount changes between calls.
3. Fully determine affinity on Windows 11 and Windows Server 2022. It
   should only ever be indeterminate in case of an error.
4. Separate isDeterminate for old and new API, as they are &'d together
   we still can end up with a subset of processors even if one API is
   indeterminate.
5. likely_used_old_api() that is based on actual affinity that's been
   detected
6. IMPORTANT: Gather affinities at startup, so that we only later use
   the affinites set at startup. Not only does this prevent us from our
   own calls interfering with detection but it also means subsequent
   setoption NumaPolicy calls should behave as expected.
7. Fix ERROR_INSUFFICIENT_BUFFER from GetThreadSelectedCpuSetMasks being
   treated like an error.

Should resolve
https://github.com/vondele/Stockfish/commit/02ff76630b358e5f958793cc93df0009d2da65a5#commitcomment-142790025

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

Bench: 1231853

3 months agoTweak pruning formula
FauziAkram [Thu, 6 Jun 2024 10:07:45 +0000 (13:07 +0300)]
Tweak pruning formula

Tweak pruning formula, including a constant. I started from an old
yellow patch, if I'm not mistaken by Viz (Unfortunately I lost the link)
where he tried something similar.
I worked on it, trying different variations, until I came up with a good
configuration to pass.

Passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 213120 W: 55351 L: 54778 D: 102991
Ptnml(0-2): 572, 25209, 54437, 25758, 584
https://tests.stockfishchess.org/tests/view/6660c9a7c340c8eed7758195

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 315324 W: 80176 L: 79284 D: 155864
Ptnml(0-2): 155, 34711, 87030, 35619, 147
https://tests.stockfishchess.org/tests/view/6660d7bb6489614cdad13d66

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

Bench: 1231853

3 months agoSimplify razor changes
rn5f107s2 [Wed, 5 Jun 2024 16:56:25 +0000 (18:56 +0200)]
Simplify razor changes

Remove razoring changes from
https://github.com/official-stockfish/Stockfish/pull/5360

The mentioned patch introduced the usage of futility_margin into
razoring alongside a tune to futility_margin. It seems the elo gained in
this patch comes from the tune of futility_margin and not the
introduction of futility_margin to razoring, so simplify it away here.

Passed Non-regression STC:
https://tests.stockfishchess.org/tests/view/66606581c340c8eed7757bc8
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 169056 W: 43922 L: 43848 D: 81286
Ptnml(0-2): 438, 20288, 43034, 20298, 470

Passed Non-regression LTC:
https://tests.stockfishchess.org/tests/view/66607764c340c8eed7757c58
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 157134 W: 39805 L: 39723 D: 77606
Ptnml(0-2): 74, 17444, 43461, 17502, 86

Passed rebased Non-regression LTC:
https://tests.stockfishchess.org/tests/view/6660c696c340c8eed77580c0
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 135984 W: 34427 L: 34324 D: 67233
Ptnml(0-2): 67, 15063, 37615, 15194, 53

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

Bench: 1150518

3 months agoWorkaround the clang-format inconsistencies
Disservin [Fri, 7 Jun 2024 16:40:47 +0000 (18:40 +0200)]
Workaround the clang-format inconsistencies

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

No functional change

3 months agoChange PGO type for clang
R-Goc [Tue, 4 Jun 2024 16:06:14 +0000 (18:06 +0200)]
Change PGO type for clang

Change type of PGO in clang to IR which is recommended by LLVM/clang and
could result in a speedup.
https://github.com/llvm/llvm-project/issues/45668

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

No functional change

3 months agoSimplify evaluation constants
cj5716 [Fri, 31 May 2024 13:55:39 +0000 (21:55 +0800)]
Simplify evaluation constants

Passed STC (<0, 2> by accident):
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 346016 W: 89529 L: 88756 D: 167731
Ptnml(0-2): 1012, 41074, 88027, 41919, 976
https://tests.stockfishchess.org/tests/view/6659d6ecf426908fcc6b6929

Passed LTC:
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 89862 W: 22887 L: 22734 D: 44241
Ptnml(0-2): 45, 9999, 24694, 10144, 49
https://tests.stockfishchess.org/tests/view/665a6ebb062b2c3cf814fde8

Passed LTC (Rebased):
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 325500 W: 82734 L: 82826 D: 159940
Ptnml(0-2): 193, 36409, 89665, 36263, 220
https://tests.stockfishchess.org/tests/view/665bd39f44e8416a9cdc1909

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

Bench 961982

3 months agoUpdate clang-format to version 18
Disservin [Wed, 5 Jun 2024 16:31:11 +0000 (18:31 +0200)]
Update clang-format to version 18

clang-format-18 is available in ubuntu noble(24.04), if you are on
a version lower than that you can use the update script from llvm.
https://apt.llvm.org/

Windows users should be able to download and use clang-format from
their release builds https://github.com/llvm/llvm-project/releases
or get the latest from msys2
https://packages.msys2.org/package/mingw-w64-x86_64-clang.

macOS users can resort to "brew install clang-format".

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

No functional change

3 months agoUse futility margin in razoring margin
Viren6 [Wed, 5 Jun 2024 02:24:39 +0000 (03:24 +0100)]
Use futility margin in razoring margin

Uses futilityMargin * depth to set the razoring margin. This retains the
quadratic depth scaling to preserve mate finding capabilities. This patch is
nice because it increases the elo sensitivity of the futility margin
heuristics.

Passed STC:
https://tests.stockfishchess.org/tests/view/665f9892fd11ae7170b4849c
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 39392 W: 10348 L: 10030 D: 19014
Ptnml(0-2): 99, 4585, 10009, 4905, 98

Passed LTC:
https://tests.stockfishchess.org/tests/view/665f9d2dfd11ae7170b484a8
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 107910 W: 27521 L: 27053 D: 53336
Ptnml(0-2): 73, 11835, 29670, 12305, 72

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

bench 1277173

3 months agoVVLTC search tune
Muzhen Gaming [Tue, 4 Jun 2024 04:47:54 +0000 (12:47 +0800)]
VVLTC search tune

Parameters were tuned with 199k games of VVLTC: https://tests.stockfishchess.org/tests/view/665c67e73542f91ad1c54fe2

Passed VVLTC 1st sprt: https://tests.stockfishchess.org/tests/view/665e9c83fd45fb0f907c837c
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 83494 W: 21546 L: 21219 D: 40729
Ptnml(0-2): 6, 7707, 25993, 8036, 5

Passed VVLTC 2nd sprt: https://tests.stockfishchess.org/tests/view/665f650bfd45fb0f907cb360
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 151056 W: 38796 L: 38295 D: 73965
Ptnml(0-2): 5, 13742, 47536, 14237, 8

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

Bench: 1154524

3 months agoRemove m512_hadd128x16_interleave()
mstembera [Wed, 5 Jun 2024 00:59:47 +0000 (17:59 -0700)]
Remove m512_hadd128x16_interleave()

This functionality is no longer used anywhere.

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

No functional change

3 months agoAdd NumaPolicy "hardware" option that bypasses current processor affinity.
Tomasz Sobczyk [Tue, 4 Jun 2024 10:48:13 +0000 (12:48 +0200)]
Add NumaPolicy "hardware" option that bypasses current processor affinity.

Can be used in case a GUI (e.g. ChessBase 17 see #5307) sets affinity to a
single processor group, but the user would like to use the full capabilities of
the hardware.  Improves affinity handling on Windows in case of multiple
available APIs and existing affinities.

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

No functional change

3 months agoSimplify smallnet threshold
Gahtan Nahdi [Mon, 3 Jun 2024 22:31:51 +0000 (05:31 +0700)]
Simplify smallnet threshold

remove pawncount

Passed STC non-reg:
https://tests.stockfishchess.org/tests/view/665e4548fd45fb0f907c80d5
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 60896 W: 15710 L: 15518 D: 29668
Ptnml(0-2): 149, 7145, 15660, 7353, 141

Passed LTC non-reg:
https://tests.stockfishchess.org/tests/view/665e4c52fd45fb0f907c815f
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 58068 W: 14773 L: 14590 D: 28705
Ptnml(0-2): 16, 6368, 16090, 6537, 23

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

Bench: 1343156

3 months agoAccumulate nodes over all bench positions not just the last
Disservin [Tue, 4 Jun 2024 05:57:08 +0000 (07:57 +0200)]
Accumulate nodes over all bench positions not just the last

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

No functional change

3 months agoProperly initialize the TT in a multithreaded way again
Disservin [Tue, 4 Jun 2024 05:53:25 +0000 (07:53 +0200)]
Properly initialize the TT in a multithreaded way again

3 months agoNormalize some variable names and reuse existing logic
Disservin [Mon, 3 Jun 2024 17:47:34 +0000 (19:47 +0200)]
Normalize some variable names and reuse existing logic

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

No functional change

3 months agoRemove delta, adjusted, complexity from nnue code
Dubslow [Sun, 2 Jun 2024 21:55:10 +0000 (16:55 -0500)]
Remove delta, adjusted, complexity from nnue code

...rather they're the consumer's concern whether to tweak the result or not.

Passed STC:
https://tests.stockfishchess.org/tests/view/665cea9ffd45fb0f907c53bd
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 69696 W: 18101 L: 17918 D: 33677
Ptnml(0-2): 195, 8171, 17929, 8362, 191

Passed LTC:
https://tests.stockfishchess.org/tests/view/665cf761fd45fb0f907c5406
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 63720 W: 16344 L: 16165 D: 31211
Ptnml(0-2): 32, 6990, 17625, 7193, 20

Non functional except for rounding issues of OutputScale changing bench.

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

Bench: 1378596

3 months agoAdjust lowest depth constants to the natural place
Dubslow [Sun, 2 Jun 2024 21:27:58 +0000 (16:27 -0500)]
Adjust lowest depth constants to the natural place

Passed STC:
https://tests.stockfishchess.org/tests/view/665ce3f8fd45fb0f907c537f
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 282784 W: 73032 L: 73082 D: 136670
Ptnml(0-2): 680, 31845, 76364, 31851, 652

Recently when I overhauled these comments, Disservin asked why these
were so much lower: they're a relic from when we had a third QS stage at
-5. Now we don't, so fix these to the obvious place.

I was fairly sure it was nonfunctional but ran the nonreg to be double
sure.

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

Bench: 1057383

3 months agoSimplify smallnet threshold
Gahtan Nahdi [Sat, 1 Jun 2024 22:26:34 +0000 (05:26 +0700)]
Simplify smallnet threshold

Turns the quadratic threshold to a linear one

STC non-reg:
https://tests.stockfishchess.org/tests/view/665ba0b744e8416a9cdc188d
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 330432 W: 85351 L: 85454 D: 159627
Ptnml(0-2): 888, 39643, 84283, 39488, 914

LTC non-reg:
https://tests.stockfishchess.org/tests/view/665cd60ffd45fb0f907c4306
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 139146 W: 35194 L: 35093 D: 68859
Ptnml(0-2): 58, 15523, 38313, 15618, 61

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

Bench: 1057383

3 months agoSimplify recapture extension
FauziAkram [Sun, 2 Jun 2024 20:32:58 +0000 (23:32 +0300)]
Simplify recapture extension

Simplifying the extension formula by removing the move == ttMove
condition.

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 47328 W: 12324 L: 12117 D: 22887
Ptnml(0-2): 134, 5532, 12097, 5795, 106
https://tests.stockfishchess.org/tests/view/665ca5e6fd45fb0f907c41be

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 72126 W: 18378 L: 18209 D: 35539
Ptnml(0-2): 36, 7841, 20130, 8030, 26
https://tests.stockfishchess.org/tests/view/665cb276fd45fb0f907c41f9

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

Bench: 1399468

3 months agoSimplify continuation histories
FauziAkram [Sun, 2 Jun 2024 15:40:32 +0000 (18:40 +0300)]
Simplify continuation histories

Functional simplification.

Simplify continuation histories, therefore increasing the effect of
stats updates and movepicker bonuses for continuation history 3 plies
deep.

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 229184 W: 59087 L: 59080 D: 111017
Ptnml(0-2): 554, 27248, 59002, 27213, 575
https://tests.stockfishchess.org/tests/view/665c7a09fd45fb0f907c223b

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 44532 W: 11419 L: 11223 D: 21890
Ptnml(0-2): 18, 4787, 12457, 4989, 15
https://tests.stockfishchess.org/tests/view/665c8842fd45fb0f907c23ec

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

Bench: 1326444

3 months agoAdd helpers for managing aligned memory
Disservin [Fri, 31 May 2024 08:53:10 +0000 (10:53 +0200)]
Add helpers for managing aligned memory

Previously, we had two type aliases, LargePagePtr and AlignedPtr, which
required manually initializing the aligned memory for the pointer.

The new helpers:

- make_unique_aligned
- make_unique_large_page

are now available for allocating aligned memory (with large pages). They
behave similarly to std::make_unique, ensuring objects allocated with
these functions follow RAII.

The old approach had issues with initializing non-trivial types or
arrays of objects. The evaluation function of the network is now a
unique pointer to an array instead of an array of unique pointers.

Memory related functions have been moved into memory.h

Passed High Hash Pressure Test Non-Regression STC:
https://tests.stockfishchess.org/tests/view/665b2b36586058766677cfd2
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 476992 W: 122426 L: 122677 D: 231889
Ptnml(0-2): 1145, 51027, 134419, 50744, 1161

Failed Normal Non-Regression STC:
https://tests.stockfishchess.org/tests/view/665b2997586058766677cfc8
LLR: -2.94 (-2.94,2.94) <-1.75,0.25>
Total: 877312 W: 225233 L: 226395 D: 425684
Ptnml(0-2): 2110, 94642, 246239, 93630, 2035

Probably a fluke since there shouldn't be a real slowndown and it has also
passed the high hash pressure test.

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

No functional change

3 months agoFix GetProcessGroupAffinity call
Tomasz Sobczyk [Sun, 2 Jun 2024 18:39:25 +0000 (20:39 +0200)]
Fix GetProcessGroupAffinity call

`GetProcessGroupAffinity` appears to require 4 byte alignment for `GroupArray` memory.

See https://stackoverflow.com/q/78567676 for further information

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

No functional change

3 months agoRevert "Adjust return bonus from tt cutoffs at fail highs"
Joost VandeVondele [Sun, 2 Jun 2024 07:18:19 +0000 (09:18 +0200)]
Revert "Adjust return bonus from tt cutoffs at fail highs"

This reverts commit 783dfc2eb235236ff799618436d68d0c1a3f3807.

could lead to a division by zero for:

ttValue = (ttValue * tte->depth() + beta) / (tte->depth() + 1)

as other threads can overwrite the tte with a QS depth of -1.

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

Bench: 1280020

3 months agoSimplify statScore divisor into a constant
Linmiao Xu [Sat, 1 Jun 2024 15:07:08 +0000 (11:07 -0400)]
Simplify statScore divisor into a constant

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/665b392ff4a1fd0c208ea864
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 114752 W: 29628 L: 29495 D: 55629
Ptnml(0-2): 293, 13694, 29269, 13827, 293

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/665b588c11645bd3d3fac467
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 65322 W: 16549 L: 16373 D: 32400
Ptnml(0-2): 30, 7146, 18133, 7322, 30

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

bench 1241443

3 months agoSimplify tm, removing faster 1st move and 1.13 extraTime.
xoto10 [Sat, 1 Jun 2024 16:10:06 +0000 (17:10 +0100)]
Simplify tm, removing faster 1st move and 1.13 extraTime.

Passed STC 10+0.1 :
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 349760 W: 90112 L: 90231 D: 169417
Ptnml(0-2): 784, 37970, 97496, 37841, 789
https://tests.stockfishchess.org/tests/view/665aeee00223e235f05b7d21

Passed LTC 60+0.6 :
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 140082 W: 35463 L: 35370 D: 69249
Ptnml(0-2): 59, 13492, 42851, 13575, 64
https://tests.stockfishchess.org/tests/view/665b15e78da109e362924e5a

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

No functional change

3 months agoSimplify 50 move rule dampening
MinetaS [Fri, 31 May 2024 21:11:51 +0000 (06:11 +0900)]
Simplify 50 move rule dampening

Refactor the logic of 50 move rule dampening by removing a constant.

Passed non-regression STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 35232 W: 9214 L: 8992 D: 17026
Ptnml(0-2): 114, 4081, 8999, 4313, 109
https://tests.stockfishchess.org/tests/view/665a329013d08af3c1725610

Passed non-regression LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 38406 W: 9732 L: 9530 D: 19144
Ptnml(0-2): 14, 4132, 10708, 4336, 13
https://tests.stockfishchess.org/tests/view/665a370913d08af3c1725651

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

Bench: 1059739

3 months agoSimplify histories movepick formula
FauziAkram [Fri, 31 May 2024 19:29:29 +0000 (22:29 +0300)]
Simplify histories movepick formula

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 81440 W: 21100 L: 20929 D: 39411
Ptnml(0-2): 248, 9659, 20718, 9864, 231
https://tests.stockfishchess.org/tests/view/6659a8b7ea624d64ea5f3208

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 85758 W: 21763 L: 21607 D: 42388
Ptnml(0-2): 34, 9606, 23463, 9722, 54
https://tests.stockfishchess.org/tests/view/6659d7bff426908fcc6b692c

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

bench: 1280472

3 months agoAvoid changing bestvalue
Joost VandeVondele [Sat, 1 Jun 2024 13:13:41 +0000 (15:13 +0200)]
Avoid changing bestvalue

in the case the ttValue contains mate scores, do not return them as bestValue, since they are not proven.

passed STC
https://tests.stockfishchess.org/tests/view/665b1ea5586058766677cfa3
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 58912 W: 15319 L: 15130 D: 28463
Ptnml(0-2): 141, 6562, 15854, 6765, 134

passed LTC:
https://tests.stockfishchess.org/tests/view/665b2712586058766677cfc4
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 141666 W: 35976 L: 35879 D: 69811
Ptnml(0-2): 61, 15513, 39584, 15618, 57

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

Bench: 1336115

3 months agoAdjust return bonus from tt cutoffs at fail highs
Michael Chaly [Sat, 1 Jun 2024 17:44:06 +0000 (20:44 +0300)]
Adjust return bonus from tt cutoffs at fail highs

This is reintroduction of the recently simplified logic - if positive tt cutoff
occurs return not a tt value but smth between it and beta.  Difference is that
instead of static linear combination there we use basically the same formula as
we do in the main search - with the only difference being using tt depth
instead of depth, which makes a lot of sense.

Passed STC:
https://tests.stockfishchess.org/tests/view/665b3a34f4a1fd0c208ea870
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 54944 W: 14239 L: 13896 D: 26809
Ptnml(0-2): 151, 6407, 14008, 6760, 146

Passed LTC:
https://tests.stockfishchess.org/tests/view/665b520011645bd3d3fac341
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 90540 W: 23070 L: 22640 D: 44830
Ptnml(0-2): 39, 9903, 24965, 10315, 48

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

bench 1381237

3 months agoUpdate default smallnet to nn-37f18f62d772.nnue
Linmiao Xu [Mon, 27 May 2024 14:40:25 +0000 (10:40 -0400)]
Update default smallnet to nn-37f18f62d772.nnue

Created by training L1-128 from scratch with:
- skipping based on simple eval in the trainer, for compatibility with
  regular binpacks without requiring pre-filtering all binpacks
- minimum simple eval of 950, lower than 1000 previously
- usage of some hse-v1 binpacks with minimum simple eval 1000
- addition of hse-v6 binpacks with minimum simple eval 500
- permuting the FT with 10k positions from fishpack32.binpack
- torch.compile to speed up smallnet training

Training is significantly slower when using non-pre-filtered binpacks due to
the increased skipping required.

This net was reached at epoch 339.

```
experiment-name: 128--S1-hse-1k-T80-v6-unfilt-less-sf--se-gt950-no-wld-skip

training-dataset:
  /data/:
    - dfrc99-16tb7p.v2.min.binpack

  /data/hse-v1/:
    - leela96-filt-v2.min.high-simple-eval-1k.min-v2.binpack

    - test60-novdec2021-12tb7p-filter-v6-dd.min-mar2023.unmin.high-simple-eval-1k.min-v2.binpack

    - test77-nov2021-2tb7p.no-db.min.high-simple-eval-1k.min-v2.binpack
    - test77-dec2021-16tb7p.no-db.min.high-simple-eval-1k.min-v2.binpack
    - test77-jan2022-2tb7p.high-simple-eval-1k.min-v2.binpack

    - test78-jantomay2022-16tb7p-filter-v6-dd.min-mar2023.unmin.high-simple-eval-1k.min-v2.binpack
    - test78-juntosep2022-16tb7p-filter-v6-dd.min-mar2023.unmin.high-simple-eval-1k.min-v2.binpack

    - test79-apr2022-16tb7p.min.high-simple-eval-1k.min-v2.binpack
    - test79-may2022-16tb7p-filter-v6-dd.min-mar2023.unmin.high-simple-eval-1k.min-v2.binpack

    - test80-apr2022-16tb7p.min.high-simple-eval-1k.min-v2.binpack
    - test80-may2022-16tb7p.high-simple-eval-1k.min-v2.binpack
    - test80-jun2022-16tb7p-filter-v6-dd.min-mar2023.unmin.high-simple-eval-1k.min-v2.binpack
    - test80-jul2022-16tb7p.v6-dd.min.high-simple-eval-1k.min-v2.binpack
    - test80-sep2022-16tb7p-filter-v6-dd.min-mar2023.unmin.high-simple-eval-1k.min-v2.binpack
    - test80-nov2022-16tb7p-v6-dd.min.high-simple-eval-1k.min-v2.binpack

  /data/S11-mar2024/:
    - test80-2022-08-aug-16tb7p.v6-dd.min.binpack
    - test80-2022-10-oct-16tb7p.v6-dd.binpack
    - test80-2022-12-dec-16tb7p.min.binpack

    - test80-2023-01-jan-16tb7p.v6-sk20.min.binpack
    - test80-2023-02-feb-16tb7p.v6-sk20.min.binpack
    - test80-2023-03-mar-2tb7p.v6-sk16.min.binpack
    - test80-2023-04-apr-2tb7p.v6-sk16.min.binpack
    - test80-2023-05-may-2tb7p.v6.min.binpack
    - test80-2023-06-jun-2tb7p.binpack.min-v2.binpack
    - test80-2023-07-jul-2tb7p.binpack.min-v2.binpack
    - test80-2023-08-aug-2tb7p.v6.min.binpack
    - test80-2023-09-sep-2tb7p.binpack.hse-v6.binpack
    - test80-2023-10-oct-2tb7p.binpack.hse-v6.binpack
    - test80-2023-11-nov-2tb7p.binpack.hse-v6.binpack
    - test80-2023-12-dec-2tb7p.binpack.hse-v6.binpack

    - test80-2024-01-jan-2tb7p.binpack.hse-v6.binpack
    - test80-2024-02-feb-2tb7p.binpack.hse-v6.binpack
    - test80-2024-03-mar-2tb7p.binpack

wld-fen-skipping: False

nnue-pytorch-branch: linrock/nnue-pytorch/128-skipSimpleEval-lt950-torch-compile
engine-test-branch: linrock/Stockfish/L1-128-nolazy
engine-base-branch: linrock/Stockfish/L1-128
start-from-engine-test-net: False

num-epochs: 500
start-lambda: 1.0
end-lambda: 1.0
```

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

Passed STC:
https://tests.stockfishchess.org/tests/view/66549c16a86388d5e27daff5
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 196608 W: 51254 L: 50697 D: 94657
Ptnml(0-2): 722, 23244, 49796, 23839, 703

Passed LTC:
https://tests.stockfishchess.org/tests/view/6658d1aa6b0e318cefa90122
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 122538 W: 31332 L: 30835 D: 60371
Ptnml(0-2): 69, 13407, 33811, 13922, 60

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

bench

3 months agoMCP more after a bad singular search
rn5f107s2 [Thu, 30 May 2024 19:18:42 +0000 (21:18 +0200)]
MCP more after a bad singular search

The idea is, that if we have the information that the singular search failed low and therefore produced an upperbound score, we can use the score from singularsearch as approximate upperbound as to what bestValue our non ttMoves will produce. If this value is well below alpha, we assume that all non-ttMoves will score below alpha and therfore can skip more moves.
This patch also sets up variables for future patches wanting to use teh singular search result outside of singular extensions, in singularBound and singularValue, meaning further patches using this search result to affect various pruning techniques can be tried.

Passed STC:
https://tests.stockfishchess.org/tests/view/6658d13e6b0e318cefa90120
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 85632 W: 22112 L: 21725 D: 41795
Ptnml(0-2): 243, 10010, 21947, 10349, 267

Passed LTC:
https://tests.stockfishchess.org/tests/view/6658dd356b0e318cefa9016a
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 243978 W: 62014 L: 61272 D: 120692
Ptnml(0-2): 128, 26598, 67791, 27348, 124

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

bench 1397172

3 months agoQuadratic smallnet threshold with re-evaluation
Linmiao Xu [Wed, 29 May 2024 17:56:15 +0000 (13:56 -0400)]
Quadratic smallnet threshold with re-evaluation

The threshold now decreases more quickly as pawn count decreases,
using the smallnet more compared to before.

Combo of two eval patches:
https://tests.stockfishchess.org/tests/view/66576c5f6b0e318cefa8d26e
https://tests.stockfishchess.org/tests/view/664ced40830eb9f886616a77

Passed STC:
https://tests.stockfishchess.org/tests/view/66588c136b0e318cefa8ff21
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 112608 W: 29336 L: 28908 D: 54364
Ptnml(0-2): 344, 13223, 28718, 13699, 320

Passed LTC:
https://tests.stockfishchess.org/tests/view/6658c8786b0e318cefa900f5
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 108288 W: 27493 L: 27026 D: 53769
Ptnml(0-2): 54, 11821, 29930, 12282, 57

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

bench 1728074

3 months agoTweak first picked move (ttMove) reduction rule
FauziAkram [Fri, 31 May 2024 01:01:02 +0000 (04:01 +0300)]
Tweak first picked move (ttMove) reduction rule

Tweak first picked move (ttMove) reduction rule:

Instead of always resetting the reduction to 0, we now only do so if the current reduction is less than 2.
If the current reduction is 2 or more, we decrease it by 2 instead.

Passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 109504 W: 28340 L: 27919 D: 53245
Ptnml(0-2): 305, 12848, 28028, 13263, 308
https://tests.stockfishchess.org/tests/view/6658c2fa6b0e318cefa900c2

Passed LTC:
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 130410 W: 33248 L: 32738 D: 64424
Ptnml(0-2): 53, 14139, 36328, 14615, 70
https://tests.stockfishchess.org/tests/view/6658dd8a6b0e318cefa90173

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

bench: 1224588

3 months agoFix cross from Linux to Windows
Joost VandeVondele [Thu, 30 May 2024 19:42:48 +0000 (21:42 +0200)]
Fix cross from Linux to Windows

specifies Windows 7 required

https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170

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

No functional change

3 months agoOn linux use sysfs instead of lscpu
Tomasz Sobczyk [Thu, 30 May 2024 15:22:53 +0000 (17:22 +0200)]
On linux use sysfs instead of lscpu

Use sysfs (https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-devices-node)
to determine processor to NUMA node mapping.

Avoids problems on some machines with high core count where lscpu was showing high cpu utilization.

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

No functional change

3 months agoReplace std::from_chars with std::stoull
Tomasz Sobczyk [Thu, 30 May 2024 16:18:51 +0000 (18:18 +0200)]
Replace std::from_chars with std::stoull

the former was not widely supported, requiring newer compiler versions.

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

No functional change

3 months agoFix process' processor affinity determination on Windows.
Tomasz Sobczyk [Thu, 30 May 2024 10:56:44 +0000 (12:56 +0200)]
Fix process' processor affinity determination on Windows.

Specialize and privatize NumaConfig::get_process_affinity.
Only enable NUMA capability for 64-bit Windows.

Following #5307 and some more testing it was determined that the way affinity
was being determined on Windows was incorrect, based on incorrect assumptions
about GetNumaProcessorNodeEx.

This patch fixes the issue by attempting to retrieve the actual process'
processor affinity using Windows API. However one issue persists that is not
addressable due to limitations of Windows, and will have to be considered a
limitation. If affinities were set using SetThreadAffinityMask instead of
SetThreadSelectedCpuSetMasks and GetProcessGroupAffinity returns more than 1
group it is NOT POSSIBLE to determine the affinity programmatically on Windows.
In such case the implementation assumes no affinites are set and will consider
all processors available for execution.

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

No functional change

3 months agoNUMA: Fix concurrency counting for windows systems
Disservin [Thu, 30 May 2024 17:55:59 +0000 (19:55 +0200)]
NUMA: Fix concurrency counting for windows systems

If there is more than 1 processor group, std::thread::hardware_concurrency should not be used.

fixes #5307

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

No functional change

3 months agoSimplifying the malus for putting piece en prise formula
FauziAkram [Thu, 30 May 2024 17:44:21 +0000 (20:44 +0300)]
Simplifying the malus for putting piece en prise formula

Simplifying the malus for putting piece en prise
formula by merging the minor pieces and pawns
(removing the pawn exclusion from the formula).

Passed STC:
https://tests.stockfishchess.org/tests/view/66578d9c6b0e318cefa8d441
LLR: 2.99 (-2.94,2.94) <-1.75,0.25>
Total: 314272 W: 80705 L: 80786 D: 152781
Ptnml(0-2): 873, 37577, 80366, 37398, 922

Passed LTC (before rebasing):
https://tests.stockfishchess.org/tests/view/6657b5ee6b0e318cefa8d6ab
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 117000 W: 29447 L: 29324 D: 58229
Ptnml(0-2): 47, 12877, 32535, 12988, 53

Passed LTC (also after rebasing):
https://tests.stockfishchess.org/tests/view/6658803d6b0e318cefa8fd99
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 244992 W: 61807 L: 61814 D: 121371
Ptnml(0-2): 125, 27420, 67414, 27411, 126

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

Bench: 1484840

3 months agoAllow tt cutoffs for shallower depths in certain conditions
Michael Chaly [Thu, 30 May 2024 16:27:12 +0000 (19:27 +0300)]
Allow tt cutoffs for shallower depths in certain conditions

Current master allows tt cutoffs only when depth
from tt is strictly greater than current node
depth. This patch also allows them when it's equal
and if tt value is lower or equal to beta.

Passed STC:
https://tests.stockfishchess.org/tests/view/66578e2e6b0e318cefa8d447
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 26592 W: 6944 L: 6645 D: 13003
Ptnml(0-2): 67, 3039, 6795, 3318, 77

Passed LTC:
https://tests.stockfishchess.org/tests/view/6657f46b6b0e318cefa8d7e9
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 142572 W: 36315 L: 35776 D: 70481
Ptnml(0-2): 70, 15666, 39288, 16179, 83

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

Bench: 1368486

3 months agoFunctional simplification in the transposition table
FauziAkram [Sat, 18 May 2024 14:54:13 +0000 (17:54 +0300)]
Functional simplification in the transposition table

Passed STC:
LLR: 2.98 (-2.94,2.94) <-1.75,0.25>
Total: 154848 W: 39838 L: 39750 D: 75260
Ptnml(0-2): 404, 16214, 44087, 16328, 391
https://tests.stockfishchess.org/tests/view/664892b088b8c6a2bbe430fc

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 68172 W: 17296 L: 17137 D: 33739
Ptnml(0-2): 23, 6349, 21185, 6504, 25
https://tests.stockfishchess.org/tests/view/6648aabfa0781149e383e526

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

Bench: 1623228

3 months agoAdd extension condition to cutoffCnt
Viren6 [Thu, 30 May 2024 07:18:04 +0000 (08:18 +0100)]
Add extension condition to cutoffCnt

Decrease cutoffCnt increment by 1 if extension is 2 or greater.

Passed STC:
https://tests.stockfishchess.org/tests/view/66577a696b0e318cefa8d34d
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 99200 W: 25703 L: 25297 D: 48200
Ptnml(0-2): 253, 11660, 25390, 12022, 275

Passed LTC:
https://tests.stockfishchess.org/tests/view/665787ab6b0e318cefa8d411
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 124530 W: 31659 L: 31161 D: 61710
Ptnml(0-2): 58, 13578, 34489, 14088, 52

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

bench 1623228

3 months agoTweak and update the WDL model
Robert Nurnberg @ elitebook [Thu, 30 May 2024 07:05:36 +0000 (09:05 +0200)]
Tweak and update the WDL model

This PR updates the internal WDL model, using data from 2.5M games played by SF-dev (3c62ad7).
Note that the normalizing constant has increased from 329 to 368.

Changes to the fitting procedure:

* the value for --materialMin was increased from 10 to 17: including data with less material leads to less accuracy for larger material count values
* the data was filtered to only include single thread LTC games at 60+0.6
* the data was filtered to only include games from master against patches that are (approximatively) within 5 nElo of master

For more information and plots of the model see PR#5309

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

No functional change

3 months agoUpdate default main net to nn-ddcfb9224cdb.nnue
Linmiao Xu [Thu, 30 May 2024 01:18:55 +0000 (21:18 -0400)]
Update default main net to nn-ddcfb9224cdb.nnue

Created by further tuning the spsa-tuned main net `nn-c721dfca8cd3.nnue`
with the same methods described in https://github.com/official-stockfish/Stockfish/pull/5254

This net was reached at 61k / 120k spsa games at 70+0.7 th 7:
https://tests.stockfishchess.org/tests/view/665639d0a86388d5e27dd259

Passed STC:
https://tests.stockfishchess.org/tests/view/6657d44e6b0e318cefa8d771
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 114688 W: 29775 L: 29344 D: 55569
Ptnml(0-2): 274, 13633, 29149, 13964, 324

Passed LTC:
https://tests.stockfishchess.org/tests/view/6657e1e46b0e318cefa8d7a6
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 88152 W: 22412 L: 21988 D: 43752
Ptnml(0-2): 56, 9560, 24409, 10006, 45

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

Bench: 1434678

3 months agoRemove Queen threatenedByMinor
FauziAkram [Thu, 30 May 2024 00:36:38 +0000 (03:36 +0300)]
Remove Queen threatenedByMinor

Remove Queen threatenedByMinor from movepick

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 54432 W: 14053 L: 13855 D: 26524
Ptnml(0-2): 124, 6347, 14090, 6517, 138
https://tests.stockfishchess.org/tests/view/66578d036b0e318cefa8d43d

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 198168 W: 49979 L: 49940 D: 98249
Ptnml(0-2): 84, 21824, 55236, 21849, 91
https://tests.stockfishchess.org/tests/view/66579cf86b0e318cefa8d5b1

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

bench: 1342438

3 months agoSimplify blending eval with nnue complexity
Linmiao Xu [Tue, 28 May 2024 23:39:55 +0000 (19:39 -0400)]
Simplify blending eval with nnue complexity

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/66567377a86388d5e27dd89c
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 144000 W: 37443 L: 37338 D: 69219
Ptnml(0-2): 587, 17260, 36208, 17351, 594

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/66567f29a86388d5e27dd924
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 112326 W: 28550 L: 28421 D: 55355
Ptnml(0-2): 66, 12732, 30434, 12869, 62

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

bench 1554486

3 months agoSimplify Away Quadruple Extension
Shawn Xu [Fri, 24 May 2024 02:22:41 +0000 (19:22 -0700)]
Simplify Away Quadruple Extension

Passed non-regression VVLTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 90792 W: 23155 L: 23018 D: 44619
Ptnml(0-2): 6, 8406, 28432, 8549, 3
https://tests.stockfishchess.org/tests/view/664ffa4ca86388d5e27d8e7a

Passed non-regression VLTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 288136 W: 72608 L: 72659 D: 142869
Ptnml(0-2): 38, 30258, 83525, 30211, 36
https://tests.stockfishchess.org/tests/view/66551609a86388d5e27db9ae

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

bench 1501735

3 months agoAdd compensation factor to adjust extra time according to time control
xoto10 [Tue, 28 May 2024 18:40:40 +0000 (19:40 +0100)]
Add compensation factor to adjust extra time according to time control

As stockfish nets and search evolve, the existing time control appears
to give too little time at STC, roughly correct at LTC, and too little
at VLTC+.

This change adds an adjustment to the optExtra calculation. This
adjustment is easy to retune and refine, so it should be easier to keep
up-to-date than the more complex calculations used for optConstant and
optScale.

Passed STC 10+0.1:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 169568 W: 43803 L: 43295 D: 82470
Ptnml(0-2): 485, 19679, 44055, 19973, 592
https://tests.stockfishchess.org/tests/view/66531865a86388d5e27da9fa

Yellow LTC 60+0.6:
LLR: -2.94 (-2.94,2.94) <0.50,2.50>
Total: 209970 W: 53087 L: 52914 D: 103969
Ptnml(0-2): 91, 19652, 65314, 19849, 79
https://tests.stockfishchess.org/tests/view/6653e38ba86388d5e27daaa0

Passed VLTC 180+1.8 :
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 85618 W: 21735 L: 21342 D: 42541
Ptnml(0-2): 15, 8267, 25848, 8668, 11
https://tests.stockfishchess.org/tests/view/6655131da86388d5e27db95f

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

Bench: 1212167

3 months agoSimplify Fail Low Bonus Formula
Shawn Xu [Tue, 28 May 2024 21:31:56 +0000 (14:31 -0700)]
Simplify Fail Low Bonus Formula

Tested against PR #5299

Passed Non-regression STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 76352 W: 19797 L: 19619 D: 36936
Ptnml(0-2): 236, 9017, 19509, 9161, 253
https://tests.stockfishchess.org/tests/view/66564f60a86388d5e27dd307

Passed Non-regression LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 114624 W: 28946 L: 28821 D: 56857
Ptnml(0-2): 59, 12675, 31714, 12810, 54
https://tests.stockfishchess.org/tests/view/6656543da86388d5e27dd329

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

Bench: 1212167

3 months agoFix MSVC NUMA compile issues
mstembera [Tue, 28 May 2024 20:32:09 +0000 (13:32 -0700)]
Fix MSVC NUMA compile issues

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

No functional change

3 months agoTune Fail Low Bonus
Shawn Xu [Mon, 27 May 2024 08:21:32 +0000 (01:21 -0700)]
Tune Fail Low Bonus

Fractional bonus idea is from @Ergodice on
[discord](https://discord.com/channels/435943710472011776/735707599353151579/1244039134499180614).
Values are tuned for 149k games at LTC.

SPSA tune:
https://tests.stockfishchess.org/tests/view/6652d5d5a86388d5e27da9d6

Failed STC:
LLR: -2.95 (-2.94,2.94) <0.00,2.00>
Total: 67424 W: 17364 L: 17528 D: 32532
Ptnml(0-2): 238, 8043, 17299, 7909, 223
https://tests.stockfishchess.org/tests/view/66551e1ba86388d5e27db9f9

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 146910 W: 37141 L: 36695 D: 73074
Ptnml(0-2): 84, 16201, 40441, 16643, 86
https://tests.stockfishchess.org/tests/view/66559949a86388d5e27dcc5d

Passed VLTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 27248 W: 6924 L: 6633 D: 13691
Ptnml(0-2): 5, 2744, 7835, 3035, 5
https://tests.stockfishchess.org/tests/view/66563f4da86388d5e27dd27a

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

Bench: 1390709

3 months agoMerge pawn count terms using their average
Stéphane Nicolet [Mon, 27 May 2024 02:32:04 +0000 (04:32 +0200)]
Merge pawn count terms using their average

This simplification patch merges the pawn count terms in the eval
formula with the material term, updating the offset constant for
the nnue part of the formula from 34000 to 34300 because the average
pawn count in middlegame positions evaluated during search is around 8.

STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 138240 W: 35834 L: 35723 D: 66683
Ptnml(0-2): 527, 16587, 34817, 16626, 563
https://tests.stockfishchess.org/tests/view/6653f474a86388d5e27daaac

LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 454272 W: 114787 L: 115012 D: 224473
Ptnml(0-2): 246, 51168, 124553, 50903, 266
https://tests.stockfishchess.org/tests/view/6654f256a86388d5e27db131

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

Bench: 1279635

3 months agoSimplifying malus for putting piece en prise formula
FauziAkram [Wed, 29 May 2024 13:14:24 +0000 (16:14 +0300)]
Simplifying malus for putting piece en prise formula

Patch author: @ehsanrashid

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 116192 W: 30229 L: 30094 D: 55869
Ptnml(0-2): 451, 13880, 29351, 13911, 503
https://tests.stockfishchess.org/tests/view/66510a40a86388d5e27da936

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 441312 W: 111009 L: 111220 D: 219083
Ptnml(0-2): 217, 49390, 121659, 49167, 223
https://tests.stockfishchess.org/tests/view/66530696a86388d5e27da9e3

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

Bench: 1987574

3 months agoImprove performance on NUMA systems
Tomasz Sobczyk [Fri, 17 May 2024 10:10:31 +0000 (12:10 +0200)]
Improve performance on NUMA systems

Allow for NUMA memory replication for NNUE weights.  Bind threads to ensure execution on a specific NUMA node.

This patch introduces NUMA memory replication, currently only utilized for the NNUE weights. Along with it comes all machinery required to identify NUMA nodes and bind threads to specific processors/nodes. It also comes with small changes to Thread and ThreadPool to allow easier execution of custom functions on the designated thread. Old thread binding (WinProcGroup) machinery is removed because it's incompatible with this patch. Small changes to unrelated parts of the code were made to ensure correctness, like some classes being made unmovable, raw pointers replaced with unique_ptr. etc.

Windows 7 and Windows 10 is partially supported. Windows 11 is fully supported. Linux is fully supported, with explicit exclusion of Android. No additional dependencies.

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

A new UCI option `NumaPolicy` is introduced. It can take the following values:
```
system - gathers NUMA node information from the system (lscpu or windows api), for each threads binds it to a single NUMA node
none - assumes there is 1 NUMA node, never binds threads
auto - this is the default value, depends on the number of set threads and NUMA nodes, will only enable binding on multinode systems and when the number of threads reaches a threshold (dependent on node size and count)
[[custom]] -
  // ':'-separated numa nodes
  // ','-separated cpu indices
  // supports "first-last" range syntax for cpu indices,
  for example '0-15,32-47:16-31,48-63'
```

Setting `NumaPolicy` forces recreation of the threads in the ThreadPool, which in turn forces the recreation of the TT.

The threads are distributed among NUMA nodes in a round-robin fashion based on fill percentage (i.e. it will strive to fill all NUMA nodes evenly). Threads are bound to NUMA nodes, not specific processors, because that's our only requirement and the OS can schedule them better.

Special care is made that maximum memory usage on systems that do not require memory replication stays as previously, that is, unnecessary copies are avoided.

On linux the process' processor affinity is respected. This means that if you for example use taskset to restrict Stockfish to a single NUMA node then the `system` and `auto` settings will only see a single NUMA node (more precisely, the processors included in the current affinity mask) and act accordingly.

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

We can't ensure that a memory allocation takes place on a given NUMA node without using libnuma on linux, or using appropriate custom allocators on windows (https://learn.microsoft.com/en-us/windows/win32/memory/allocating-memory-from-a-numa-node), so to avoid complications the current implementation relies on first-touch policy. Due to this we also rely on the memory allocator to give us a new chunk of untouched memory from the system. This appears to work reliably on linux, but results may vary.

MacOS is not supported, because AFAIK it's not affected, and implementation would be problematic anyway.

Windows is supported since Windows 7 (https://learn.microsoft.com/en-us/windows/win32/api/processtopologyapi/nf-processtopologyapi-setthreadgroupaffinity). Until Windows 11/Server 2022 NUMA nodes are split such that they cannot span processor groups. This is because before Windows 11/Server 2022 it's not possible to set thread affinity spanning processor groups. The splitting is done manually in some cases (required after Windows 10 Build 20348). Since Windows 11/Server 2022 we can set affinites spanning processor group so this splitting is not done, so the behaviour is pretty much like on linux.

Linux is supported, **without** libnuma requirement. `lscpu` is expected.

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

Passed 60+1 @ 256t 16000MB hash: https://tests.stockfishchess.org/tests/view/6654e443a86388d5e27db0d8
```
LLR: 2.95 (-2.94,2.94) <0.00,10.00>
Total: 278 W: 110 L: 29 D: 139
Ptnml(0-2): 0, 1, 56, 82, 0
```

Passed SMP STC: https://tests.stockfishchess.org/tests/view/6654fc74a86388d5e27db1cd
```
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 67152 W: 17354 L: 17177 D: 32621
Ptnml(0-2): 64, 7428, 18408, 7619, 57
```

Passed STC: https://tests.stockfishchess.org/tests/view/6654fb27a86388d5e27db15c
```
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 131648 W: 34155 L: 34045 D: 63448
Ptnml(0-2): 426, 13878, 37096, 14008, 416
```

fixes #5253
closes https://github.com/official-stockfish/Stockfish/pull/5285

No functional change

3 months agoapply const to prefetch parameter
Disservin [Tue, 28 May 2024 16:00:22 +0000 (18:00 +0200)]
apply const to prefetch parameter

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

No functional change

3 months agoTweak return value in futility pruning
FauziAkram [Tue, 28 May 2024 10:49:30 +0000 (13:49 +0300)]
Tweak return value in futility pruning

Tweak the return value formula in futility pruning.

Passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 60544 W: 15791 L: 15440 D: 29313
Ptnml(0-2): 193, 7024, 15520, 7309, 226
https://tests.stockfishchess.org/tests/view/6654ef22a86388d5e27db122

Passed LTC:
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 126426 W: 32317 L: 31812 D: 62297
Ptnml(0-2): 55, 13871, 34869, 14350, 68
https://tests.stockfishchess.org/tests/view/66550644a86388d5e27db649

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

bench: 1856147

3 months agoSimplify Away TT Cutoff Return Value Adjustments
Shawn Xu [Sat, 25 May 2024 05:46:03 +0000 (22:46 -0700)]
Simplify Away TT Cutoff Return Value Adjustments

Passed Non-regression STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 198432 W: 51161 L: 51119 D: 96152
Ptnml(0-2): 772, 23670, 50273, 23746, 755
https://tests.stockfishchess.org/tests/view/66517b9ea86388d5e27da966

Passed Non-regression LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 234150 W: 59200 L: 59197 D: 115753
Ptnml(0-2): 126, 26200, 64404, 26235, 110
https://tests.stockfishchess.org/tests/view/6653a84da86388d5e27daa63

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

bench 1555200

3 months agoRemove rootDelta branch
Shahin M. Shahin [Thu, 23 May 2024 22:19:16 +0000 (01:19 +0300)]
Remove rootDelta branch

This makes rootDelta logic easier to understand, recalculating the value
where it belongs so removes an unnecessary branch.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/664fc147a86388d5e27d8d8e
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 206016 W: 53120 L: 53089 D: 99807
Ptnml(0-2): 591, 20928, 59888, 21061, 540

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

No functional change

3 months agoLower smallnet threshold with tuned eval params
Linmiao Xu [Fri, 24 May 2024 14:58:13 +0000 (10:58 -0400)]
Lower smallnet threshold with tuned eval params

The smallnet threshold is now below the training data range
of the current smallnet (simple eval diff > 1k, nn-baff1edelf90.nnue)
when no pawns are on the board.

Params found with spsa at 93k / 120k games at 60+06:
https://tests.stockfishchess.org/tests/view/664fa166a86388d5e27d7d6b

Tuned on top of: https://github.com/official-stockfish/Stockfish/pull/5287

Passed STC:
https://tests.stockfishchess.org/tests/view/664fc8b7a86388d5e27d8dac
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 64672 W: 16731 L: 16371 D: 31570
Ptnml(0-2): 239, 7463, 16517, 7933, 184

Passed LTC:
https://tests.stockfishchess.org/tests/view/664fd5f9a86388d5e27d8dfe
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 210648 W: 53489 L: 52813 D: 104346
Ptnml(0-2): 102, 23129, 58164, 23849, 80

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

Bench: 1717838