]> git.sesse.net Git - stockfish/log
stockfish
10 months agoAdjust return value in qsearch after fail high
Michael Chaly [Mon, 18 Dec 2023 17:34:35 +0000 (20:34 +0300)]
Adjust return value in qsearch after fail high

Instead of returning strict fail soft fail high return value between value from
search and beta (somewhat by analogy to futility pruning and probcut).

This seems to be somewhat depth sensitive heuristic which performed much worse
at LTC while performing much better at STC if it is more aggressive, passed
version is the least aggressive one.

Passed STC:
https://tests.stockfishchess.org/tests/view/657b06414d789acf40ab1475
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 212352 W: 53900 L: 53315 D: 105137
Ptnml(0-2): 809, 25236, 53520, 25783, 828

Passed LTC:
https://tests.stockfishchess.org/tests/view/657ce36f393ac02e79120a7c
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 319362 W: 79541 L: 78630 D: 161191
Ptnml(0-2): 202, 35839, 86709, 36708, 223

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

Bench: 974739

10 months agoUse std::abs over abs
FauziAkram [Mon, 18 Dec 2023 13:20:41 +0000 (16:20 +0300)]
Use std::abs over abs

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

No functional change

Co-Authored-By: fffelix-huang <72808219+fffelix-huang@users.noreply.github.com>
10 months agoImprovement of Time Management Parameters
FauziAkram [Fri, 15 Dec 2023 11:29:44 +0000 (14:29 +0300)]
Improvement of Time Management Parameters

Passed STC:
https://tests.stockfishchess.org/tests/view/6579c5574d789acf40aaf914
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 44672 W: 11354 L: 11030 D: 22288
Ptnml(0-2): 140, 5033, 11685, 5319, 159

Passed LTC:
https://tests.stockfishchess.org/tests/view/657ad7f44d789acf40ab105e
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 40932 W: 10275 L: 9950 D: 20707
Ptnml(0-2): 21, 4316, 11473, 4629, 27

Passed non-regression Sudden death 10+0:
https://tests.stockfishchess.org/tests/view/657b9b9e393ac02e7911f1a8
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 21384 W: 5171 L: 4925 D: 11288
Ptnml(0-2): 112, 2420, 5409, 2612, 139

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

No functional change

10 months agoAdjust stand pat in qsearch on pv nodes
Michael Chaly [Thu, 14 Dec 2023 22:51:52 +0000 (01:51 +0300)]
Adjust stand pat in qsearch on pv nodes

Instead of immediately returning a fail high do this only at non-pv nodes, for
pv nodes adjust bestValue to value between alpha and beta and continue
searching. Idea is to do it the same way as it's done in search where we don't
return positive beta cutoffs after ttHits / zero window search at PvNodes and
instead fully search lines.

Passed STC:
https://tests.stockfishchess.org/tests/view/65739b0af09ce1261f122f33
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 189216 W: 48142 L: 47598 D: 93476
Ptnml(0-2): 584, 22463, 48051, 22845, 665

Passed LTC:
https://tests.stockfishchess.org/tests/view/657701214d789acf40aac194
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 82506 W: 20689 L: 20269 D: 41548
Ptnml(0-2): 56, 9236, 22268, 9618, 75

Two issues had to be resolved:
    - in rare cases it set alpha to the same value as beta and thus broke some asserts;
    - messed up with returning tb win values.

      Fix passed non-regression LTC vs this patch:
      https://tests.stockfishchess.org/tests/view/6578113b4d789acf40aad544
      LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
      Total: 277308 W: 68839 L: 68880 D: 139589
      Ptnml(0-2): 167, 31580, 75212, 31517, 178

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

Bench: 1069503

Co-Authored-By: Muzhen Gaming <61100393+XInTheDark@users.noreply.github.com>
Co-Authored-By: Shahin M. Shahin <41402573+peregrineshahin@users.noreply.github.com>
Co-Authored-By: fffelix-huang <72808219+fffelix-huang@users.noreply.github.com>
10 months agoRemove UCI_AnalyseMode Option
Muzhen Gaming [Wed, 13 Dec 2023 11:05:37 +0000 (19:05 +0800)]
Remove UCI_AnalyseMode Option

Simplify away the useless option, as documented: "An option handled by your GUI.
This currently doesn't do anything."

The option was originally added with the introduction of contempt
(https://github.com/official-stockfish/Stockfish/commit/e9aeaad05266ca557a9496b5a17b4c5f82f0e946),
but it is now no longer used.

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

No functional change

10 months agoRemove SlowMover Option
FauziAkram [Tue, 12 Dec 2023 13:38:24 +0000 (16:38 +0300)]
Remove SlowMover Option

The SlowMover option allows users to modify the timeLeft variant, impacting the
engine's time management. However, this feature, while theoretically flexible,
doesn't offer substantial benefits. Instead, it introduces the risk of
non-experienced users altering values without a clear understanding of the
effects, potentially leading to a weaker engine.

The vast majority of SF users don't use it anyway, and based on tests conducted
by fauzi several months ago suggest that changing it would only lose Elo.

Examples:
https://tests.stockfishchess.org/tests/view/651f309bac57711436726bba
https://tests.stockfishchess.org/tests/view/651fea29ac57711436727d85
https://tests.stockfishchess.org/tests/view/65257c343125598fc7eb68a1
https://tests.stockfishchess.org/tests/view/652296c83125598fc7eb2ad7
Tune:
https://tests.stockfishchess.org/tests/view/652a70313125598fc7ebd706
(keeping the value at 100, zz2)

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

No functional change

10 months agoFix action deprecation warning for dev-drprasad
Disservin [Sun, 10 Dec 2023 22:40:45 +0000 (23:40 +0100)]
Fix action deprecation warning for dev-drprasad

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

No functional change

10 months agoAdd loongarch64 support
WangXiang [Sun, 10 Dec 2023 15:04:32 +0000 (23:04 +0800)]
Add loongarch64 support

Adding support for LoongArch64 architecture. Tested on Loongson 3A6000 EVB
Board. Since Loongson's SIMD extended instruction set
([LSX](https://gcc.gnu.org/onlinedocs/gcc/LoongArch-SX-Vector-Intrinsics.html),
[LASX](https://gcc.gnu.org/onlinedocs/gcc/LoongArch-ASX-Vector-Intrinsics.html))
is already supported by GCC, more optimizations are being developed.

Here's the benchmark result for Loongson 3A6000 (4c8t, 2.5Ghz) without SIMD
optimizations.
```
Total time (ms) : 17903
Nodes searched  : 1244386
Nodes/second    : 69507
```

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

No functional change

10 months agoTrack seldepth in qsearch too
peregrineshahin [Sun, 3 Dec 2023 21:39:41 +0000 (00:39 +0300)]
Track seldepth in qsearch too

Sometimes if we count the reported PV length, it turns out to be longer than the
selective depth reported. This fixes this behavior by applying the selective
depth to qsearch since we do report PVs from it as well.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/656cf5b66980e15f69c7499d
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 223648 W: 56372 L: 56356 D: 110920
Ptnml(0-2): 710, 25580, 59231, 25590, 713

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

No functional change

10 months agoFix TB score output in UCI without using TB
Shahin M. Shahin [Fri, 17 Nov 2023 15:25:50 +0000 (18:25 +0300)]
Fix TB score output in UCI without using TB

This is a rewrite of the fix introduced for
https://github.com/official-stockfish/Stockfish/issues/4413 in
https://github.com/official-stockfish/Stockfish/pull/4591 by @windfishballad it
targets only the relevant part of this issue that returns TB scores (CP 20000)
without using TB due to the downgrading of potentially false mates from the TT
to an optimal TB score.

the difference is that it is a much clearer code that introduces a separate
TB_VALUE constant to account for a correct distance from the TB_VALUE with
MAX_PLY.

the originally posted position in the issue does not trigger the problem
anymore, so here is a new position to test:
```
position fen 3k4/8/8/8/8/8/3BN3/3K4 w - - 0 1
go infinite
```

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/65578994136acbc57353b258
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 119264 W: 29993 L: 29863 D: 59408
Ptnml(0-2): 372, 13692, 31379, 13812, 377

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/6558323f136acbc57353c1ca
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 237834 W: 58791 L: 58792 D: 120251
Ptnml(0-2): 193, 26200, 66111, 26241, 172

fixes https://github.com/official-stockfish/Stockfish/issues/4413
closes https://github.com/official-stockfish/Stockfish/pull/4591
closes https://github.com/official-stockfish/Stockfish/pull/4882

Bench: 1305821

10 months agoVLTC Search parameters tune
Muzhen Gaming [Fri, 8 Dec 2023 13:39:57 +0000 (21:39 +0800)]
VLTC Search parameters tune

The SPSA tuning was done for 44k games at 120+1.2.
https://tests.stockfishchess.org/tests/view/656ee2a76980e15f69c7767f.

Note that the tune was originally done in combination with the recent dual NNUE
idea (see #4910).

VLTC:
https://tests.stockfishchess.org/tests/view/65731ccbf09ce1261f12246e
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 52806 W: 13069 L: 12760 D: 26977
Ptnml(0-2): 19, 5498, 15056, 5815, 15

VLTC SMP:
https://tests.stockfishchess.org/tests/view/65740ffaf09ce1261f1239ba
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 27630 W: 6934 L: 6651 D: 14045
Ptnml(0-2): 1, 2643, 8243, 2928, 0

Estimated close to neutral at LTC:
https://tests.stockfishchess.org/tests/view/6575485a8ec68176cf7d9423
Elo: -0.59 ± 1.8 (95%) LOS: 26.6%
Total: 32060 W: 7859 L: 7913 D: 16288
Ptnml(0-2): 20, 3679, 8676, 3645, 10
nElo: -1.21 ± 3.8 (95%) PairsRatio: 0.99

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

Bench: 1283323

10 months agoSimplify the code to get the native flags
ppigazzini [Wed, 6 Dec 2023 17:01:58 +0000 (18:01 +0100)]
Simplify the code to get the native flags

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

No functional change

10 months agoRemove moveMalus
Taras Vuk [Tue, 5 Dec 2023 14:41:10 +0000 (15:41 +0100)]
Remove moveMalus

Passed STC:
https://tests.stockfishchess.org/tests/view/656e0bb86980e15f69c763fa
LLR: 3.15 (-2.94,2.94) <-1.75,0.25>
Total: 123008 W: 30973 L: 30831 D: 61204
Ptnml(0-2): 368, 14032, 32568, 14162, 374

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

No functional change

10 months agoRevert "Temporarily disable CI include checks"
Disservin [Tue, 5 Dec 2023 10:49:12 +0000 (11:49 +0100)]
Revert "Temporarily disable CI include checks"

This reverts commit 8f65953583a2abc34041b087120a378e22d0509d.

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

No functional change

10 months agoRemove cutNode condition
FauziAkram [Mon, 4 Dec 2023 10:31:16 +0000 (11:31 +0100)]
Remove cutNode condition

cutNode condition seems to be irrelevant.

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 24224 W: 6206 L: 5970 D: 12048
Ptnml(0-2): 69, 2818, 6122, 3014, 89
https://tests.stockfishchess.org/tests/view/65686910136acbc5735529ec

Passed LTC:
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 236538 W: 58624 L: 58622 D: 119292
Ptnml(0-2): 136, 26955, 64091, 26945, 142
https://tests.stockfishchess.org/tests/view/6568925a136acbc573552d8f

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

Bench: 1244386

10 months agoUpdate GitHub workflows
ppigazzini [Sun, 3 Dec 2023 12:39:52 +0000 (13:39 +0100)]
Update GitHub workflows

- Use the latest version of the actions
- Use commit hash for actions from little providers
- Update Intel SDE to 9.27

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

No functional change

10 months agoTemporarily disable CI include checks
Sebastian Buchwald [Sun, 3 Dec 2023 12:37:59 +0000 (13:37 +0100)]
Temporarily disable CI include checks

The include checks currently fail because of broken LLVM nightly
packages: https://github.com/llvm/llvm-project/issues/73402.

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

No functional change

10 months agoTweak return value in futility pruning
lonfom169 [Thu, 30 Nov 2023 04:12:19 +0000 (01:12 -0300)]
Tweak return value in futility pruning

In futility pruning, return the average between eval and beta.

Passed STC:
https://tests.stockfishchess.org/tests/view/65680bb6136acbc5735521d7
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 15200 W: 3926 L: 3642 D: 7632
Ptnml(0-2): 36, 1699, 3867, 1941, 57

Passed LTC:
https://tests.stockfishchess.org/tests/view/656817fc136acbc573552304
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 200376 W: 49700 L: 49036 D: 101640
Ptnml(0-2): 110, 22584, 54137, 23246, 111

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

Bench: 1403703

10 months agoRemove recaptures stage in qsearch
cj5716 [Wed, 29 Nov 2023 09:25:01 +0000 (17:25 +0800)]
Remove recaptures stage in qsearch

Simplify an old commit
https://github.com/official-stockfish/Stockfish/commit/72760c05c64d1fb2bb71c2ac54acfbeecf513b87.

Search is not stuck on the test position given
r1n1n1b1/1P1P1P1P/1N1N1N2/2RnQrRq/2pKp3/3BNQbQ/k7/4Bq2 w - - 0 1

Passed STC:
https://tests.stockfishchess.org/tests/view/6567050d136acbc573550919
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 236160 W: 59475 L: 59475 D: 117210
Ptnml(0-2): 841, 28266, 59816, 28366, 791

Passed LTC:
https://tests.stockfishchess.org/tests/view/6567d133136acbc573551c78
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 201690 W: 49630 L: 49593 D: 102467
Ptnml(0-2): 128, 23214, 54122, 23255, 126

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

Bench: 1604361

10 months agoSkip LMR for 2nd move at the root only
Taras Vuk [Wed, 29 Nov 2023 17:20:43 +0000 (18:20 +0100)]
Skip LMR for 2nd move at the root only

This patch reverts commit by Vizvezdenec:
https://github.com/official-stockfish/Stockfish/commit/27139dedac14af400f5b18e2ab50aca3f8cf0e33

Passed STC:
https://tests.stockfishchess.org/tests/view/65660b4a136acbc57354f13d
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 301952 W: 76271 L: 76344 D: 149337
Ptnml(0-2): 1053, 36293, 76348, 36238, 1044

Passed LTC:
https://tests.stockfishchess.org/tests/view/656738ab136acbc573550e39
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 25050 W: 6283 L: 6063 D: 12704
Ptnml(0-2): 10, 2756, 6775, 2972, 12

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

Bench: 1722961

10 months agoSimplify quietMoveMalus malus
FauziAkram [Wed, 29 Nov 2023 10:47:25 +0000 (13:47 +0300)]
Simplify quietMoveMalus malus

Use a simple depth instead of depth + 1 in the quietMoveMalus formula.

Passed STC:
https://tests.stockfishchess.org/tests/view/65636bf0136acbc57354b662
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 105248 W: 26680 L: 26532 D: 52036
Ptnml(0-2): 409, 12590, 26481, 12732, 412

Passed LTC:
https://tests.stockfishchess.org/tests/view/6563b5db136acbc57354bcab
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 204204 W: 50200 L: 50166 D: 103838
Ptnml(0-2): 123, 23331, 55145, 23395, 108

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

Bench: 1717495

10 months agoSimplify promotion move generation
cj5716 [Sat, 2 Dec 2023 10:37:52 +0000 (11:37 +0100)]
Simplify promotion move generation

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

No functional change

10 months agoSimplify doDeeperSearch
FauziAkram [Sat, 2 Dec 2023 10:33:11 +0000 (11:33 +0100)]
Simplify doDeeperSearch

Removing dependence on d simplifies the doDeeperSearch formula and eliminates a
variable that is not necessary in this context.

Passed STC:
https://tests.stockfishchess.org/tests/view/65647980136acbc57354c9f6
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 37440 W: 9558 L: 9334 D: 18548
Ptnml(0-2): 127, 4439, 9375, 4641, 138

Passed LTC:
https://tests.stockfishchess.org/tests/view/6564c3f0136acbc57354d126
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 113946 W: 27993 L: 27864 D: 58089
Ptnml(0-2): 67, 12975, 30783, 13058, 90

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

Bench: 1427733

10 months agoSimplify move history reduction
Muzhen Gaming [Sat, 25 Nov 2023 14:16:56 +0000 (22:16 +0800)]
Simplify move history reduction

Recent VLTC search tuning has suggested that the depth limit can be increased
by a lot. This patch simplifies away the depth-based bonus from statScore
reduction, making the divisor a constant.

Passed STC:
https://tests.stockfishchess.org/tests/view/656201f5136acbc573549791
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 91520 W: 23130 L: 22967 D: 45423
Ptnml(0-2): 282, 10947, 23141, 11106, 284

Passed LTC:
https://tests.stockfishchess.org/tests/view/6562b43a136acbc57354a581
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 352902 W: 86796 L: 86917 D: 179189
Ptnml(0-2): 190, 40227, 95741, 40100, 193

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

Bench: 1297179

10 months agoSimplify history update.
Stefan Geschwentner [Thu, 23 Nov 2023 21:13:11 +0000 (22:13 +0100)]
Simplify history update.

Removal of the slowdown factor from the history update formula with
corresponding adjustment of the stat bonus used in the search.

Passed STC:
https://tests.stockfishchess.org/tests/view/655e1079136acbc573544744
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 128096 W: 32355 L: 32235 D: 63506
Ptnml(0-2): 466, 15187, 32573, 15405, 417

Passed LTC:
https://tests.stockfishchess.org/tests/view/655f4e60136acbc573546266
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 50652 W: 12653 L: 12459 D: 25540
Ptnml(0-2): 28, 5666, 13751, 5846, 35

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

Bench: 1303857

11 months agoReformat some comments
FauziAkram [Mon, 20 Nov 2023 18:09:48 +0000 (19:09 +0100)]
Reformat some comments

Tests used to derive some Elo worth comments:

https://tests.stockfishchess.org/tests/view/653cf6b7cc309ae83956263a
https://tests.stockfishchess.org/tests/view/655250b7136acbc573534711
https://tests.stockfishchess.org/tests/view/65525767136acbc5735347b9
https://tests.stockfishchess.org/tests/view/65525aa1136acbc573534801

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

No functional change

11 months agoRemove doEvenDeeperSearch
FauziAkram [Thu, 16 Nov 2023 11:00:11 +0000 (14:00 +0300)]
Remove doEvenDeeperSearch

Passed STC:
LLR: 2.98 (-2.94,2.94) <-1.75,0.25>
Total: 51040 W: 13014 L: 12804 D: 25222
Ptnml(0-2): 166, 6032, 12917, 6236, 169
https://tests.stockfishchess.org/tests/view/65525aa1136acbc573534801

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 165168 W: 40863 L: 40789 D: 83516
Ptnml(0-2): 73, 18783, 44792, 18869, 67
https://tests.stockfishchess.org/tests/view/65535af5136acbc573535c84

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

Bench: 1477007

11 months agoChange depth - 1 to newDepth
FauziAkram [Mon, 20 Nov 2023 17:56:34 +0000 (18:56 +0100)]
Change depth - 1 to newDepth

Replacing 'depth - 1' with 'newDepth' in the singularbeta formula
utilizes existing variables more succinctly.

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

No functional change

11 months agoFix undefined behavior in search.
Stefan Geschwentner [Thu, 16 Nov 2023 07:40:25 +0000 (08:40 +0100)]
Fix undefined behavior in search.

We use following line to clamp the search depth in some range:
Depth d = std::clamp(newDepth - r, 1, newDepth + 1);

Through negative extension its possible that the maximum value becomes smaller than the minimum value but then the behavior is undefined (see https://en.cppreference.com/w/cpp/algorithm/clamp). So replace this line with a safe implementation.

Remark:
We have in recent master already one line where up to 3 negative extensions are possible which could trigger this undefined behavior but this can only be happen for completed depth > 24 so its not discovered by our default bench. Recent negative extension tests by @fauzi shows then this undefined behavior with wrong bench numbers.

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

No functional change

11 months agoCI updates
Joost VandeVondele [Wed, 15 Nov 2023 20:00:37 +0000 (21:00 +0100)]
CI updates

- updates the SDE action to v2.2
- removes the linux x86-32 builds, which were almost unused,
  and the build process under SDE started failing recently,
  possibly related to glibc update (The futex facility returned an unexpected error code.)

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

No functional change

11 months agoSymmetrize optimism
Joost VandeVondele [Sun, 12 Nov 2023 14:51:38 +0000 (15:51 +0100)]
Symmetrize optimism

Removes some additional parameters, making the term more logical at the same
time.

Passed STC:
https://tests.stockfishchess.org/tests/view/6550e896136acbc5735328ed
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 271104 W: 68441 L: 68480 D: 134183
Ptnml(0-2): 827, 32590, 68816, 32433, 886

Passed LTC:
https://tests.stockfishchess.org/tests/view/65523858136acbc5735344f7
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 198954 W: 49250 L: 49211 D: 100493
Ptnml(0-2): 93, 22565, 54117, 22614, 88

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

Bench: 1334248

11 months agoIntroduce recapture extensions
Taras Vuk [Mon, 13 Nov 2023 13:45:36 +0000 (14:45 +0100)]
Introduce recapture extensions

When in a PV-node this patch extends ttMove if it is a recapture and has a good
history.

Passed STC:
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 83840 W: 21560 L: 21166 D: 41114
Ptnml(0-2): 343, 9905, 21027, 10305, 340
https://tests.stockfishchess.org/tests/view/654f4b02136acbc5735308ab

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 165318 W: 41068 L: 40476 D: 83774
Ptnml(0-2): 98, 18670, 44517, 19290, 84
https://tests.stockfishchess.org/tests/view/654fde04136acbc5735314e0

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

Bench: 1393911

11 months agoSimplify away optimism average score offset params
Linmiao Xu [Tue, 7 Nov 2023 18:03:05 +0000 (13:03 -0500)]
Simplify away optimism average score offset params

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/654abf6b136acbc57352ac4b
LLR: 2.97 (-2.94,2.94) <-1.75,0.25>
Total: 49664 W: 12687 L: 12477 D: 24500
Ptnml(0-2): 138, 5840, 12703, 5976, 175

Passed non-regression LTC:
https://tests.stockfishchess.org/tests/view/654b638e136acbc57352b961
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 347166 W: 85561 L: 85676 D: 175929
Ptnml(0-2): 206, 39569, 94150, 39450, 208

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

bench 1257641

11 months agoDouble weight of pawn history for quiet move ordering.
Stefan Geschwentner [Mon, 6 Nov 2023 15:12:30 +0000 (16:12 +0100)]
Double weight of pawn history for quiet move ordering.

I measured on my 1000 position bench the average additional added pawn history per depth.
This shows on average negative value with even smaller values with increaing depth.

A linear regression against depth get following formula:

-1960 - 130 * depth

For compensation add this to the used sort limit to maintain roughly the same proportion of sorted quiet moves.

Remarks:
1. using no compensation failed here https://tests.stockfishchess.org/tests/view/6547664f136acbc5735265f0
2. using only the compensation failed at LTC:
   passed STC: https://tests.stockfishchess.org/tests/view/65477457136acbc5735266f8
   failed LTC: https://tests.stockfishchess.org/tests/view/65487fc8136acbc573527d1c

STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 98528 W: 25109 L: 24699 D: 48720
Ptnml(0-2): 334, 11586, 25009, 12006, 329
https://tests.stockfishchess.org/tests/view/65475873136acbc5735264f7

LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 69726 W: 17467 L: 17073 D: 35186
Ptnml(0-2): 39, 7814, 18769, 8196, 45
https://tests.stockfishchess.org/tests/view/6547e759136acbc573527071

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

Bench: 1379422

11 months agoRemove pawn history from ProbCut constructor
Taras Vuk [Mon, 6 Nov 2023 14:00:06 +0000 (15:00 +0100)]
Remove pawn history from ProbCut constructor

use same style as other history tables

Passed STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 184672 W: 46953 L: 46896 D: 90823
Ptnml(0-2): 604, 21095, 48887, 21140, 610
https://tests.stockfishchess.org/tests/view/654766b4136acbc573526602

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

No functional change

11 months agoUse stat_malus when decreasing stats
Taras Vuk [Sun, 5 Nov 2023 15:01:52 +0000 (16:01 +0100)]
Use stat_malus when decreasing stats

This patch applies stat_bonus when increasing and stat_malus when decreasing stats.

Passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 133792 W: 34221 L: 33758 D: 65813
Ptnml(0-2): 477, 15764, 33959, 16211, 485
https://tests.stockfishchess.org/tests/view/654699f3136acbc5735256b2

Passed LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 67374 W: 16912 L: 16523 D: 33939
Ptnml(0-2): 42, 7528, 18171, 7891, 55
https://tests.stockfishchess.org/tests/view/65474558136acbc5735263ab

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

bench: 1114417

11 months agoSet reduction to 0 if the move is a TT move
FauziAkram [Sun, 5 Nov 2023 10:52:20 +0000 (13:52 +0300)]
Set reduction to 0 if the move is a TT move

The reduction formula currently decreases by 1 if the move is a TT move.
This changes this by just setting the reduction to 0 instead.

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 83136 W: 21145 L: 20758 D: 41233
Ptnml(0-2): 279, 9772, 21090, 10137, 290
https://tests.stockfishchess.org/tests/view/653c0fbacc309ae839561584

Passed LTC:
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 273150 W: 67987 L: 67171 D: 137992
Ptnml(0-2): 155, 30730, 73966, 31592, 132
https://tests.stockfishchess.org/tests/view/653d9d02cc309ae839562fdf

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

bench: 1110556

11 months agoEnhance some comments
Shahin M. Shahin [Sun, 5 Nov 2023 09:01:06 +0000 (12:01 +0300)]
Enhance some comments

This documents some code and makes some hard code easier to understand for new developers.

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

No functional change

11 months agoTweaking the futility pruning formula
FauziAkram [Sat, 4 Nov 2023 14:19:08 +0000 (17:19 +0300)]
Tweaking the futility pruning formula

Huge credit goes also to candirufish,
as the idea was first tried by him, and then tuned by me at multiple phases.

Tweaking the futility pruning formula to be a bit more selective about when pruning is applied.
Adjust the value added to the static eval based on the bestValue relative to ss->staticEval. If bestValue is significantly lower, we add a larger value.

Passed STC:
LLR: 2.98 (-2.94,2.94) <0.00,2.00>
Total: 37120 W: 9590 L: 9266 D: 18264
Ptnml(0-2): 130, 4301, 9385, 4603, 141
https://tests.stockfishchess.org/tests/view/6544cf90136acbc573523247

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 49632 W: 12381 L: 12033 D: 25218
Ptnml(0-2): 30, 5429, 13549, 5779, 29
https://tests.stockfishchess.org/tests/view/65453bc1136acbc573523a3c

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

bench: 1107118

11 months agoUpdate pawn history based on static eval difference
Michael Chaly [Fri, 3 Nov 2023 11:03:12 +0000 (14:03 +0300)]
Update pawn history based on static eval difference

Use the same logic as in main history but with 1/4 multiplier.

Passed STC:
https://tests.stockfishchess.org/tests/view/653c1282cc309ae8395615bf
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 306624 W: 77811 L: 77094 D: 151719
Ptnml(0-2): 975, 36411, 77830, 37114, 982

Passed LTC:
https://tests.stockfishchess.org/tests/view/654258e2cc309ae83956818d
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 99150 W: 24681 L: 24228 D: 50241
Ptnml(0-2): 56, 11107, 26792, 11568, 52

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

bench 1330590

11 months agoRemove razoring history update.
Stefan Geschwentner [Sat, 28 Oct 2023 05:43:12 +0000 (07:43 +0200)]
Remove razoring history update.

The recently commit 'Rewarding Quiet Moves that Enable Razoring' add a history update if razoring. But its contains also many tuned values all over the search. Following tests shows that the tuned values and not the added history update is responsible for the elo gain. So remove later.

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 29376 W: 7641 L: 7410 D: 14325
Ptnml(0-2): 100, 3411, 7451, 3610, 116
https://tests.stockfishchess.org/tests/view/653c9fe1cc309ae839562070

Passed LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 242922 W: 59879 L: 59885 D: 123158
Ptnml(0-2): 129, 27764, 65688, 27744, 136
https://tests.stockfishchess.org/tests/view/653d06cbcc309ae839562735

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

Bench: 1286104

11 months agoSimplifying two formulas
FauziAkram [Wed, 1 Nov 2023 10:42:06 +0000 (13:42 +0300)]
Simplifying two formulas

by eliminating two multiplication operations.

Passed STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 60000 W: 15193 L: 14996 D: 29811
Ptnml(0-2): 199, 7100, 15215, 7277, 209
https://tests.stockfishchess.org/tests/view/653beb69cc309ae83956129d

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 122910 W: 30471 L: 30353 D: 62086
Ptnml(0-2): 68, 13961, 33271, 14095, 60
https://tests.stockfishchess.org/tests/view/653c5848cc309ae839561ae7

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

bench: 1216779

11 months agoPrefetch TT entries in probcut
cj5716 [Tue, 31 Oct 2023 00:25:06 +0000 (08:25 +0800)]
Prefetch TT entries in probcut

Passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 101344 W: 25893 L: 25491 D: 49960
Ptnml(0-2): 303, 11350, 26991, 11698, 330
https://tests.stockfishchess.org/tests/view/6540daa6cc309ae83956669b

slight speedup:
```
Result of 100 runs
==================
base (./stockfish.master       ) =    1170705  +/- 3133
test (./stockfish.patch        ) =    1174545  +/- 2895
diff                             =      +3841  +/- 3196

speedup        = +0.0033
P(speedup > 0) =  0.9907
```

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

No functional change

12 months agoIntroduce asymmetric optimism
Muzhen Gaming [Sat, 28 Oct 2023 08:04:15 +0000 (16:04 +0800)]
Introduce asymmetric optimism

Introduce asymmetric optimism for both side to move and opponent. Parameter tuning was done with 200k LTC games.

STC: https://tests.stockfishchess.org/tests/view/653cc08fcc309ae8395622b3
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 98336 W: 25074 L: 24661 D: 48601
Ptnml(0-2): 339, 11612, 24890, 11951, 376

LTC: https://tests.stockfishchess.org/tests/view/653db595cc309ae839563140
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 83244 W: 20760 L: 20339 D: 42145
Ptnml(0-2): 51, 9306, 22498, 9705, 62

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

Bench: 1371690

12 months agoSmall cleanups
cj5716 [Sun, 29 Oct 2023 01:18:10 +0000 (09:18 +0800)]
Small cleanups

Corrects some incorrect or outdated comments.
Credit is shared with yaneurao (see 38e830a#commitcomment-131131500) and locutus2

closes #4852

No functional change.

12 months agoremove outdated comment
Disservin [Fri, 27 Oct 2023 16:35:52 +0000 (18:35 +0200)]
remove outdated comment

Bench: 1258079

12 months agoFormat Code
Disservin [Fri, 27 Oct 2023 15:33:41 +0000 (17:33 +0200)]
Format Code

No functional change

12 months agoRewarding Quiet Moves that Enable Razoring
FauziAkram [Fri, 27 Oct 2023 10:28:55 +0000 (13:28 +0300)]
Rewarding Quiet Moves that Enable Razoring

The main idea of the patch comes from @peregrineshahin :
https://tests.stockfishchess.org/tests/view/65205363ac57711436728781

Another small idea (tuning) comes from @Vizvezdenec
https://tests.stockfishchess.org/tests/view/652e071ade6d262d08d318f4 And a long
phases of tuning and tests was done by me in order to make the patch be able to
pass both tests.

The idea, as mentioned by Peregrine is that in our standard code, if no best
move found after searching all moves, we give a bonus to the previous move that
caused the fail high. So in razoring we assume no bestmove will be found so we
might as well do the same.

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 82336 W: 20997 L: 20610 D: 40729
Ptnml(0-2): 288, 9710, 20753, 10161, 256
https://tests.stockfishchess.org/tests/view/6538fafbcc309ae83955d8f0

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 46584 W: 11753 L: 11411 D: 23420
Ptnml(0-2): 21, 5133, 12642, 5475, 21
https://tests.stockfishchess.org/tests/view/653a3f2ccc309ae83955f223

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

Bench: 1258079

Co-Authored-By: Shahin M. Shahin <41402573+peregrineshahin@users.noreply.github.com>
12 months agoIntroduce pawn structure based history
Michael Chaly [Fri, 27 Oct 2023 15:19:31 +0000 (17:19 +0200)]
Introduce pawn structure based history

Original idea by Seer chess engine https://github.com/connormcmonigle/seer-nnue,
coding done by @Disservin, code refactoring done by @locutus2 to match the style
of other histories.

This patch introduces pawn structure based history, which assings moves values
based on last digits of pawn structure hash and piece type of moved piece and
landing square of the move. Idea is that good places for pieces are quite often
determined by pawn structure of position. Used in 3 different places
- sorting of quiet moves, sorting of quiet check evasions and in history based
pruning in search.

Passed STC:
https://tests.stockfishchess.org/tests/view/65391d08cc309ae83955dbaf
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 155488 W: 39408 L: 38913 D: 77167
Ptnml(0-2): 500, 18427, 39408, 18896, 513

Passed LTC:
https://tests.stockfishchess.org/tests/view/653a36a2cc309ae83955f181
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 70110 W: 17548 L: 17155 D: 35407
Ptnml(0-2): 33, 7859, 18889, 8230, 44

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

Bench: 1257882

Co-Authored-By: Disservin <disservin.social@gmail.com>
Co-Authored-By: Stefan Geschwentner <locutus2@users.noreply.github.com>
12 months agoSimplify futility pruning formula
Taras Vuk [Wed, 25 Oct 2023 14:00:58 +0000 (16:00 +0200)]
Simplify futility pruning formula

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

No functional change

12 months agoUpdate 5 search params for pruning at shallow depth
Linmiao Xu [Sun, 22 Oct 2023 16:59:21 +0000 (12:59 -0400)]
Update 5 search params for pruning at shallow depth

Found by spsa tuning at 45+0.45 with:

```
int fpcEvalOffset = 188;
int fpcLmrDepthMult = 206;
int histDepthMult = -3232;
int histDenom = 5793;
int fpEvalOffset = 115;
int negSeeDepthMultSq = -27;
TUNE(SetRange(0, 394), fpcEvalOffset);
TUNE(SetRange(0, 412), fpcLmrDepthMult);
TUNE(SetRange(-6464, -1616), histDepthMult);
TUNE(SetRange(2896, 11586), histDenom);
TUNE(SetRange(0, 230), fpEvalOffset);
TUNE(SetRange(-54, 0), negSeeDepthMultSq);
```

Passed STC:
https://tests.stockfishchess.org/tests/view/6535551de746e058e6c0165d
LLR: 2.98 (-2.94,2.94) <0.00,2.00>
Total: 109056 W: 28025 L: 27599 D: 53432
Ptnml(0-2): 357, 12669, 28038, 13119, 345

Passed LTC:
https://tests.stockfishchess.org/tests/view/65364c6ff127f3553505175d
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 61290 W: 15316 L: 14941 D: 31033
Ptnml(0-2): 34, 6849, 16498, 7236, 28

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

bench 1167412

12 months agoCleanup comments and some code reorg.
Joost VandeVondele [Mon, 23 Oct 2023 20:49:37 +0000 (22:49 +0200)]
Cleanup comments and some code reorg.

passed STC:
https://tests.stockfishchess.org/tests/view/6536dc7dcc309ae83955b04d
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 58048 W: 14693 L: 14501 D: 28854
Ptnml(0-2): 200, 6399, 15595, 6669, 161

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

No functional change

12 months agoSmall formatting improvements
cj5716 [Mon, 23 Oct 2023 23:43:49 +0000 (07:43 +0800)]
Small formatting improvements

Changes some C style casts to C++ style, and fixes some incorrect comments and variable names.

closes #4845

No functional change

12 months agoFollow up Makefile changes for clang-format
Joost VandeVondele [Mon, 23 Oct 2023 17:42:08 +0000 (19:42 +0200)]
Follow up Makefile changes for clang-format

as reported on various OS, these changes help portability

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

No functional change.

12 months agoTime management improvements
Muzhen Gaming [Sat, 21 Oct 2023 09:01:45 +0000 (17:01 +0800)]
Time management improvements

1. Tune time management parameters.
2. Scale the optimum time and maximum time parameters based on the amount of
   time left, using a logarithmic scale.

Many acknowledgements to @FauziAkram for tuning the parameters and for the
original idea (see
https://tests.stockfishchess.org/tests/view/652f0356de6d262d08d333c5).

STC: https://tests.stockfishchess.org/tests/view/6533938fde6d262d08d39e4d
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 44320 W: 11301 L: 10982 D: 22037
Ptnml(0-2): 146, 4810, 11920, 5147, 137

LTC: https://tests.stockfishchess.org/tests/view/653477e4de6d262d08d3ae06
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 146442 W: 37338 L: 36811 D: 72293
Ptnml(0-2): 60, 14975, 42645, 15460, 81

Verification runs:
3+0.03: https://tests.stockfishchess.org/tests/view/65364e7ef127f3553505178a
10+0: https://tests.stockfishchess.org/tests/view/65364e9ff127f3553505178f
180+1.8: https://tests.stockfishchess.org/tests/view/65364ec3f127f35535051794

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

No functional change.

Co-Authored-By: FauziAkram <11150271+FauziAkram@users.noreply.github.com>
12 months agoremove blank line between function and it's description
Disservin [Sun, 22 Oct 2023 18:20:53 +0000 (20:20 +0200)]
remove blank line between function and it's description

- remove the blank line between the declaration of the function and it's
  comment, leads to better IDE support when hovering over a function to see it's
  description
- remove the unnecessary duplication of the function name in the functions
  description
- slightly refactored code for lsb, msb in bitboard.h There are still a few
  things we can be improved later on, move the description of a function where
  it was declared (instead of implemented) and add descriptions to functions
  which are behind macros ifdefs

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

No functional change

12 months agouse expanded variables for shell commands
Disservin [Sun, 22 Oct 2023 14:43:33 +0000 (16:43 +0200)]
use expanded variables for shell commands

Performance improvement for the shell commands in the Makefile.
By using expanded variables, the shell commands are only
evaluated once, instead of every time they are used.

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

No functional change

12 months agoFix a compiler bug on Clang 15+ with AVX-512
MinetaS [Tue, 17 Oct 2023 19:03:39 +0000 (04:03 +0900)]
Fix a compiler bug on Clang 15+ with AVX-512

fixes https://github.com/official-stockfish/Stockfish/issues/4450
closes https://github.com/official-stockfish/Stockfish/pull/4830

No functional change.

12 months agoSimplify futilityBase formula
Taras Vuk [Sun, 22 Oct 2023 06:36:43 +0000 (08:36 +0200)]
Simplify futilityBase formula

This patch replaces std::min(ss->staticEval, bestValue) with ss->staticEval in the futilityBase formula.
Original idea by Vizvezdenec: https://tests.stockfishchess.org/tests/view/64ce66795b17f7c21c0d85f3

Passed STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 116928 W: 29925 L: 29793 D: 57210
Ptnml(0-2): 399, 13558, 30446, 13634, 427
https://tests.stockfishchess.org/tests/view/653285aade6d262d08d385dd

Passed LTC:
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 50868 W: 12947 L: 12757 D: 25164
Ptnml(0-2): 30, 5414, 14355, 5606, 29
https://tests.stockfishchess.org/tests/view/65336ffbde6d262d08d39ba0

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

bench: 1241996

12 months agoadd clang-format
Disservin [Sat, 21 Oct 2023 09:40:56 +0000 (11:40 +0200)]
add clang-format

This introduces clang-format to enforce a consistent code style for Stockfish.

Having a documented and consistent style across the code will make contributing easier
for new developers, and will make larger changes to the codebase easier to make.

To facilitate formatting, this PR includes a Makefile target (`make format`) to format the code,
this requires clang-format (version 17 currently) to be installed locally.

Installing clang-format is straightforward on most OS and distros
(e.g. with https://apt.llvm.org/, brew install clang-format, etc), as this is part of quite commonly
used suite of tools and compilers (llvm / clang).

Additionally, a CI action is present that will verify if the code requires formatting,
and comment on the PR as needed. Initially, correct formatting is not required, it will be
done by maintainers as part of the merge or in later commits, but obviously this is encouraged.

fixes https://github.com/official-stockfish/Stockfish/issues/3608
closes https://github.com/official-stockfish/Stockfish/pull/4790

Co-Authored-By: Joost VandeVondele <Joost.VandeVondele@gmail.com>
12 months agoScale down stat bonus
mstembera [Fri, 20 Oct 2023 09:23:46 +0000 (02:23 -0700)]
Scale down stat bonus

STC https://tests.stockfishchess.org/tests/view/652eff58de6d262d08d33353
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 88224 W: 22618 L: 22228 D: 43378
Ptnml(0-2): 282, 10177, 22783, 10609, 261

LTC https://tests.stockfishchess.org/tests/view/652fd13bde6d262d08d3481a
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 143508 W: 36674 L: 36142 D: 70692
Ptnml(0-2): 92, 15240, 40534, 15820, 68

Reduces the stat bonus by 20%. Maybe future patches can tune the actual bonus calculations for different histories.

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

bench: 1185932

12 months agoSubtract the margin from the value returned by ProbCut
Taras Vuk [Thu, 19 Oct 2023 12:31:23 +0000 (14:31 +0200)]
Subtract the margin from the value returned by ProbCut

This patch subtracts the margin from the value returned by ProbCut.

Passed STC:
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 46112 W: 11940 L: 11610 D: 22562
Ptnml(0-2): 131, 5318, 11842, 5620, 145
https://tests.stockfishchess.org/tests/view/652ea42ade6d262d08d329dd

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 86880 W: 22192 L: 21776 D: 42912
Ptnml(0-2): 43, 9213, 24510, 9633, 41
https://tests.stockfishchess.org/tests/view/652f70ffde6d262d08d33e8d

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

bench: 1135313

12 months agoRemoving history condition
FauziAkram [Thu, 19 Oct 2023 11:38:07 +0000 (14:38 +0300)]
Removing history condition

Removing the bad history condition from the skip futility pruning formula.

Passed STC:
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 142688 W: 36420 L: 36317 D: 69951
Ptnml(0-2): 481, 16653, 36970, 16762, 478
https://tests.stockfishchess.org/tests/view/65270a663125598fc7eb8c67

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 435378 W: 110723 L: 110925 D: 213730
Ptnml(0-2): 278, 47251, 122788, 47139, 233
https://tests.stockfishchess.org/tests/view/6528595f3125598fc7eba8f5

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

Bench: 1110579

12 months agoRemove outdated Tile naming.
mstembera [Thu, 19 Oct 2023 02:25:09 +0000 (19:25 -0700)]
Remove outdated Tile naming.

cleanup variable naming after  #4816

closes #4833

No functional change

12 months agoCleanup qsearch continuation histories
Shahin M. Shahin [Sat, 14 Oct 2023 15:08:51 +0000 (18:08 +0300)]
Cleanup qsearch continuation histories

Only (ss-1) and (ss-2) are used in qsearch.

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

No functional change

12 months agoStandardize Comments
FauziAkram [Wed, 4 Oct 2023 15:14:40 +0000 (18:14 +0300)]
Standardize Comments

use double slashes (//) only for comments.

closes #4820

No functional change.

12 months agoReformat some comments and conditions
Stéphane Nicolet [Sun, 1 Oct 2023 17:18:05 +0000 (19:18 +0200)]
Reformat some comments and conditions

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

No functional change

12 months agoFix greater than TB scores in null move pruning.
Shahin M. Shahin [Thu, 27 Jul 2023 03:21:54 +0000 (06:21 +0300)]
Fix greater than TB scores in null move pruning.

This patch is a simplification and a fix to dealing with null moves scores that returns proven mates or TB scores by preventing 'null move pruning' if the nullvalue is in that range.

Current solution downgrades nullValues on the non-PV node but the value can be used in a transposed PV-node to the same position afterwards (Triangulation), the later is prone to propagate a wrong score (96.05) to root that will not be refuted unless we search further.

Score of (96.05) can be obtained be two methods,

maxim static-eval returned on Pv update (mostly qSearch)
this downgrade (clamp) in NMP
and theoretically can happen with or without TBs but the second scenario is more dangerous than the first.
This fixes the reproducible case in very common scenarios with TBs as shown in the debugging at discord.

Fixes: #4699
Passed STC:
https://tests.stockfishchess.org/tests/view/64c1eca8dc56e1650abba6f9
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 670048 W: 171132 L: 171600 D: 327316
Ptnml(0-2): 2134, 75687, 179820, 75279, 2104

Passed LTC:
https://tests.stockfishchess.org/tests/view/64c5e130dc56e1650abc0438
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 92868 W: 23642 L: 23499 D: 45727
Ptnml(0-2): 52, 9509, 27171, 9648, 54

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

Bench: 1327410

12 months agoUse more continuation histories.
Michael Chaly [Sat, 14 Oct 2023 14:41:41 +0000 (17:41 +0300)]
Use more continuation histories.

This patch allows stats updates and movepicker bonuses for continuation history 3 plies deep - so counter counter move.
Updates and movepicker usage are done with 1/4 multiplier compared to other histories.

Passed STC:
https://tests.stockfishchess.org/tests/view/6528f28d3125598fc7ebb5a3
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 161344 W: 41369 L: 40868 D: 79107
Ptnml(0-2): 535, 18720, 41679, 19185, 553

Passed LTC:
https://tests.stockfishchess.org/tests/view/652a397a3125598fc7ebd1d6
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 48564 W: 12556 L: 12215 D: 23793
Ptnml(0-2): 25, 5149, 13595, 5486, 27

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

bench 1327410

12 months agoSearch parameters tune at 180+1.8
Muzhen Gaming [Tue, 10 Oct 2023 15:43:36 +0000 (17:43 +0200)]
Search parameters tune at 180+1.8

Passed VLTC: https://tests.stockfishchess.org/tests/view/65200c58ac577114367280bc
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 146180 W: 37407 L: 36988 D: 71785
Ptnml(0-2): 21, 14474, 43675, 14905, 15

Passed VLTC SMP: https://tests.stockfishchess.org/tests/view/652403da3125598fc7eb4b6d
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 57580 W: 15061 L: 14739 D: 27780
Ptnml(0-2): 2, 5001, 18460, 5327, 0

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

Bench: 1099336

12 months agoSkip futility pruning if ttMove has bad history
Taras Vuk [Sat, 7 Oct 2023 21:25:34 +0000 (23:25 +0200)]
Skip futility pruning if ttMove has bad history

Passed STC:
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 52416 W: 13465 L: 13128 D: 25823
Ptnml(0-2): 128, 6024, 13604, 6287, 165
https://tests.stockfishchess.org/tests/view/651fadd4ac577114367277bf

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 87348 W: 22234 L: 21818 D: 43296
Ptnml(0-2): 38, 9240, 24698, 9664, 34
https://tests.stockfishchess.org/tests/view/65201932ac57711436728218

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

bench: 1246560

12 months agoAvoid recomputing moveCountPruning
gabe [Fri, 6 Oct 2023 20:59:22 +0000 (22:59 +0200)]
Avoid recomputing moveCountPruning

In search, when moveCountPruning becomes true, it can never turn false again.

Passed STC https://tests.stockfishchess.org/tests/view/652075ceac57711436728aac
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 136448 W: 34923 L: 34472 D: 67053
Ptnml(0-2): 420, 15094, 36767, 15501, 442

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

Non functional change

12 months agoRazor more if ss+1 cutoffCnt > 3
candirufish [Sat, 7 Oct 2023 12:46:03 +0000 (14:46 +0200)]
Razor more if ss+1 cutoffCnt > 3

STC:
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 221760 W: 56726 L: 56144 D: 108890
Ptnml(0-2): 655, 25453, 58123, 25953, 696
https://tests.stockfishchess.org/tests/view/651d34dbcff46e538ee05d91

LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 130326 W: 33188 L: 32681 D: 64457
Ptnml(0-2): 69, 13949, 36620, 14456, 69
https://tests.stockfishchess.org/tests/view/651f844eac577114367273d5

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

bench: 1291708

12 months agoSimplify collection of bad moves for history updates.
Stefan Geschwentner [Sat, 30 Sep 2023 04:57:39 +0000 (06:57 +0200)]
Simplify collection of bad moves for history updates.

1. collect only the first 32 moves searched and ignore the rest. So late bad moves get no further negative history updates.
2. collect now for quiet moves also at most 32 bad moves

STC:
https://tests.stockfishchess.org/tests/view/6517b3aeb3e74811c8af5651
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 51168 W: 13013 L: 12810 D: 25345
Ptnml(0-2): 120, 6006, 13186, 6095, 177

LTC:
https://tests.stockfishchess.org/tests/view/651adafecff46e538ee02734
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 109866 W: 27786 L: 27656 D: 54424
Ptnml(0-2): 52, 11816, 31069, 11942, 54

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

Bench: 1338617

12 months agoOptimize the most common update accumalator cases w/o tiling
mstembera [Sun, 1 Oct 2023 06:12:02 +0000 (23:12 -0700)]
Optimize the most common update accumalator cases w/o tiling

In the most common case where we only update a single state
it's faster to not use temporary accumulation registers and tiling.
(Also includes a couple of small cleanups.)

passed STC
https://tests.stockfishchess.org/tests/view/651918e3cff46e538ee0023b
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 34944 W: 8989 L: 8687 D: 17268
Ptnml(0-2): 88, 3743, 9512, 4037, 92

A simpler version
https://tests.stockfishchess.org/tests/view/65190dfacff46e538ee00155
also passed but this version is stronger still
https://tests.stockfishchess.org/tests/view/6519b95fcff46e538ee00fa2

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

No functional change

12 months agoRemove one test in the move loop
Stéphane Nicolet [Sun, 1 Oct 2023 18:19:49 +0000 (20:19 +0200)]
Remove one test in the move loop

Simplification passed STC test:
https://tests.stockfishchess.org/tests/view/6519fc91cff46e538ee014f6
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 191264 W: 48550 L: 48501 D: 94213
Ptnml(0-2): 576, 21529, 51392, 21540, 595

closes #4815

Non functional change

12 months agoUpdate links in license
Robert Nurnberg @ elitebook [Sat, 30 Sep 2023 06:11:14 +0000 (08:11 +0200)]
Update links in license

matches https://www.gnu.org/licenses/gpl-3.0.txt

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

No functional change

12 months agoRemove handcrafted MMX code
mstembera [Sun, 24 Sep 2023 22:15:50 +0000 (15:15 -0700)]
Remove handcrafted MMX code

too small a benefit to maintain this old target

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

No functional change

13 months agoUpdate default net to nn-0000000000a0.nnue
Linmiao Xu [Thu, 28 Sep 2023 00:58:28 +0000 (20:58 -0400)]
Update default net to nn-0000000000a0.nnue

This is a later epoch from the same experiment that led to the previous
master net. In training stage 6, max-epoch was raised to 1,200 near the
end of the first 1,000 epochs.

For more details, see https://github.com/official-stockfish/Stockfish/pull/4795

Local elo at 25k nodes per move (vs. L1-2048 nn-1ee1aba5ed4c.nnue)
ep1079 : 15.6 +/- 1.2

Passed STC:
https://tests.stockfishchess.org/tests/view/651503b3b3e74811c8af1e2a
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 29408 W: 7607 L: 7304 D: 14497
Ptnml(0-2): 97, 3277, 7650, 3586, 94

Passed LTC:
https://tests.stockfishchess.org/tests/view/651585ceb3e74811c8af2a5f
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 73164 W: 18828 L: 18440 D: 35896
Ptnml(0-2): 30, 7749, 20644, 8121, 38

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

Bench: 1453057

13 months agoSkip moves-loop pruning in qsearch if we have only pawns
cj5716 [Mon, 25 Sep 2023 05:18:05 +0000 (13:18 +0800)]
Skip moves-loop pruning in qsearch if we have only pawns

At first my idea was only to cover movecount and futility pruning, but
@peregrineshahin suggested to test it on all moves-loop pruning and it worked.

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 167968 W: 42970 L: 42480 D: 82518
Ptnml(0-2): 444, 18324, 46002, 18726, 488
https://tests.stockfishchess.org/tests/view/6511181a55b420c569d0d54c

Passed LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 40794 W: 10496 L: 10182 D: 20116
Ptnml(0-2): 12, 4021, 12025, 4319, 20
https://tests.stockfishchess.org/tests/view/6512ccc4b3e74811c8aee86c

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

Bench: 1338472

13 months agoUse C++17 variable templates for type traits
Sebastian Buchwald [Mon, 25 Sep 2023 10:24:48 +0000 (12:24 +0200)]
Use C++17 variable templates for type traits

The C++17 variable templates are slightly more readable and allow us to
remove the typename keyword in a few cases.

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

No functional change

13 months agoRemove unused see_ge() code
mstembera [Mon, 25 Sep 2023 01:09:52 +0000 (18:09 -0700)]
Remove unused see_ge() code

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

No functional change

13 months agoImprove grammar of comments
FauziAkram [Fri, 29 Sep 2023 20:16:57 +0000 (22:16 +0200)]
Improve grammar of comments

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

No functional change

13 months agoSimplify pawn count in evaluation
FauziAkram [Sat, 23 Sep 2023 10:24:09 +0000 (13:24 +0300)]
Simplify pawn count in evaluation

This simplifies the evaluation by removing the unnecessary pawn count term when
combining nnue and optimism values.

Passed STC
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 61472 W: 15748 L: 15554 D: 30170
Ptnml(0-2): 191, 7123, 15933, 7279, 210
https://tests.stockfishchess.org/tests/view/650c34cf7ca0d3f7bbf264ff

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 81264 W: 20657 L: 20500 D: 40107
Ptnml(0-2): 30, 8713, 22997, 8854, 38
https://tests.stockfishchess.org/tests/view/650cc30efb151d43ae6d5987

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

Bench: 1530568

13 months agoIncrement minor section number from 3.7.1 to 3.8.1.
Jasper Shovelton [Fri, 29 Sep 2023 20:02:24 +0000 (22:02 +0200)]
Increment minor section number from 3.7.1 to 3.8.1.

Pext has nothing to do with git commit sha/date, so separate the two
sub-sections.

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

No functional change

13 months agoExplicitly invoke shell
Joost VandeVondele [Sat, 23 Sep 2023 21:26:29 +0000 (23:26 +0200)]
Explicitly invoke shell

in some cases the permission on the script might be incorrect (zip downloads?).
Explicitly invoke the shell

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

No functional change

13 months agoUpdate NNUE architecture to SFNNv8: L1-2560 nn-ac1dbea57aa3.nnue
Linmiao Xu [Fri, 12 May 2023 22:07:20 +0000 (18:07 -0400)]
Update NNUE architecture to SFNNv8: L1-2560 nn-ac1dbea57aa3.nnue

Creating this net involved:
- a 6-stage training process from scratch. The datasets used in stages 1-5 were fully minimized.
- permuting L1 weights with https://github.com/official-stockfish/nnue-pytorch/pull/254

A strong epoch after each training stage was chosen for the next. The 6 stages were:

```
1. 400 epochs, lambda 1.0, default LR and gamma
   UHOx2-wIsRight-multinet-dfrc-n5000 (135G)
     nodes5000pv2_UHO.binpack
     data_pv-2_diff-100_nodes-5000.binpack
     wrongIsRight_nodes5000pv2.binpack
     multinet_pv-2_diff-100_nodes-5000.binpack
     dfrc_n5000.binpack

2. 800 epochs, end-lambda 0.75, LR 4.375e-4, gamma 0.995, skip 12
   LeelaFarseer-T78juntoaugT79marT80dec.binpack (141G)
     T60T70wIsRightFarseerT60T74T75T76.binpack
     test78-junjulaug2022-16tb7p.no-db.min.binpack
     test79-mar2022-16tb7p.no-db.min.binpack
     test80-dec2022-16tb7p.no-db.min.binpack

3. 800 epochs, end-lambda 0.725, LR 4.375e-4, gamma 0.995, skip 20
   leela93-v1-dfrc99-v2-T78juntosepT80jan-v6dd-T78janfebT79aprT80aprmay.min.binpack
     leela93-filt-v1.min.binpack
     dfrc99-16tb7p-filt-v2.min.binpack
     test78-juntosep2022-16tb7p-filter-v6-dd.min-mar2023.binpack
     test80-jan2023-3of3-16tb7p-filter-v6-dd.min-mar2023.binpack
     test78-janfeb2022-16tb7p.min.binpack
     test79-apr2022-16tb7p.min.binpack
     test80-apr2022-16tb7p.min.binpack
     test80-may2022-16tb7p.min.binpack

4. 800 epochs, end-lambda 0.7, LR 4.375e-4, gamma 0.995, skip 24
   leela96-dfrc99-v2-T78juntosepT79mayT80junsepnovjan-v6dd-T80mar23-v6-T60novdecT77decT78aprmayT79aprT80may23.min.binpack
     leela96-filt-v2.min.binpack
     dfrc99-16tb7p-filt-v2.min.binpack
     test78-juntosep2022-16tb7p-filter-v6-dd.min-mar2023.binpack
     test79-may2022-16tb7p.filter-v6-dd.min.binpack
     test80-jun2022-16tb7p.filter-v6-dd.min.binpack
     test80-sep2022-16tb7p.filter-v6-dd.min.binpack
     test80-nov2022-16tb7p.filter-v6-dd.min.binpack
     test80-jan2023-3of3-16tb7p-filter-v6-dd.min-mar2023.binpack
     test80-mar2023-2tb7p.v6-sk16.min.binpack
     test60-novdec2021-16tb7p.min.binpack
     test77-dec2021-16tb7p.min.binpack
     test78-aprmay2022-16tb7p.min.binpack
     test79-apr2022-16tb7p.min.binpack
     test80-may2023-2tb7p.min.binpack

5. 960 epochs, end-lambda 0.7, LR 4.375e-4, gamma 0.995, skip 28
   Increased max-epoch to 960 near the end of the first 800 epochs
   5af11540bbfe dataset: https://github.com/official-stockfish/Stockfish/pull/4635

6. 1000 epochs, end-lambda 0.7, LR 4.375e-4, gamma 0.995, skip 28
   Increased max-epoch to 1000 near the end of the first 800 epochs
   1ee1aba5ed dataset: https://github.com/official-stockfish/Stockfish/pull/4782
```

L1 weights permuted with:
```bash
python3 serialize.py $nnue $nnue_permuted \
  --features=HalfKAv2_hm \
  --ft_optimize \
  --ft_optimize_data=/data/fishpack32.binpack \
  --ft_optimize_count=10000
```

Speed measurements from 100 bench runs at depth 13 with profile-build x86-64-avx2:
```
sf_base =  1329051 +/-   2224 (95%)
sf_test =  1163344 +/-   2992 (95%)
diff    =  -165706 +/-   4913 (95%)
speedup = -12.46807% +/- 0.370% (95%)
```

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

Local elo at 25k nodes per move (vs. L1-2048 nn-1ee1aba5ed4c.nnue)
ep959 : 16.2 +/- 2.3

Failed 10+0.1 STC:
https://tests.stockfishchess.org/tests/view/6501beee2cd016da89abab21
LLR: -2.92 (-2.94,2.94) <0.00,2.00>
Total: 13184 W: 3285 L: 3535 D: 6364
Ptnml(0-2): 85, 1662, 3334, 1440, 71

Failed 180+1.8 VLTC:
https://tests.stockfishchess.org/tests/view/6505cf9a72620bc881ea908e
LLR: -2.94 (-2.94,2.94) <0.00,2.00>
Total: 64248 W: 16224 L: 16374 D: 31650
Ptnml(0-2): 26, 6788, 18640, 6650, 20

Passed 60+0.6 th 8 VLTC SMP (STC bounds):
https://tests.stockfishchess.org/tests/view/65084a4618698b74c2e541dc
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 90630 W: 23372 L: 23033 D: 44225
Ptnml(0-2): 13, 8490, 27968, 8833, 11

Passed 60+0.6 th 8 VLTC SMP:
https://tests.stockfishchess.org/tests/view/6501d45d2cd016da89abacdb
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 137804 W: 35764 L: 35276 D: 66764
Ptnml(0-2): 31, 13006, 42326, 13522, 17

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

bench 1246812

13 months agoRemove VALUE_KNOWN_WIN.
Stefan Geschwentner [Tue, 19 Sep 2023 07:08:58 +0000 (09:08 +0200)]
Remove VALUE_KNOWN_WIN.

After removing classic evaluation VALUE_KNOWN_WIN is not anymore returned explicit evaluation. So remove and replace it with VALUE_TB_WIN_IN_MAX_PLY.

Measurement on my big bench (bench 16 1 16 pos1000.fen) verifies that at least with current net the calculated evaluation lies always in the open interval  (-VALUE_KNOWN_WIN, VALUE_KNOWN_WIN).
So i consider this a non-functional change. But to be safe i tested this also at LTC as requested by Stephane Nicolet.

STC:
https://tests.stockfishchess.org/tests/view/64f9db40eaf01be8259a6ed5
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 455296 W: 115981 L: 116217 D: 223098
Ptnml(0-2): 1415, 50835, 123420, 50527, 1451

LTC:
https://tests.stockfishchess.org/tests/view/650bfd867ca0d3f7bbf25feb
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 35826 W: 9170 L: 8973 D: 17683
Ptnml(0-2): 12, 3523, 10645, 3722, 11

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

Bench: 1603079

13 months agoReduce SIMD register count from 32 to 16
mstembera [Fri, 22 Sep 2023 02:26:11 +0000 (19:26 -0700)]
Reduce SIMD register count from 32 to 16

in the case of avx512 and vnni512 archs.

Up to 17% speedup, depending on the compiler, e.g.

```
AMD pro 7840u (zen4 phoenix apu 4nm)
bash bench_parallel.sh ./stockfish_avx512_gcc13 ./stockfish_avx512_pr_gcc13 20 10
sf_base =  1077737 +/-   8446 (95%)
sf_test =  1264268 +/-   8543 (95%)
diff    =   186531 +/-   4280 (95%)
speedup =  17.308% +/- 0.397% (95%)
```

Prior to this patch, it appears gcc spills registers.

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

No functional change

13 months agoMake casting styles consistent
cj5716 [Tue, 19 Sep 2023 10:06:12 +0000 (18:06 +0800)]
Make casting styles consistent

Make casting styles consistent with the rest of the code.

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

No functional change

13 months agoLet CI check C++ includes
Sebastian Buchwald [Mon, 11 Sep 2023 22:03:04 +0000 (00:03 +0200)]
Let CI check C++ includes

The commit adds a CI workflow that uses the included-what-you-use (IWYU)
tool to check for missing or superfluous includes in .cpp files and
their corresponding .h files. This means that some .h files (especially
in the nnue folder) are not checked yet.

The CI setup looks like this:
- We build IWYU from source to include some yet unreleased fixes.
  This IWYU version targets LLVM 17. Thus, we get the latest release
  candidate of LLVM 17 from LLVM's nightly packages.
- The Makefile now has an analyze target that just build the object
  files (without linking)
- The CI uses the analyze target with the IWYU tool as compiler to
  analyze the compiled .cpp file and its corresponding .h file.
- If IWYU suggests a change the build fails (-Xiwyu --error).
- To avoid false positives we use LLVM's libc++ as standard library
- We have a custom mappings file that adds some mappings that are
  missing in IWYU's default mappings

We also had to add one IWYU pragma to prevent a false positive in
movegen.h.

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

No functional change

13 months agoExport makefile ARCH in binary
Stéphane Nicolet [Thu, 14 Sep 2023 09:04:36 +0000 (11:04 +0200)]
Export makefile ARCH in binary

Example of the `./stockfish compiler` command:

Compiled by                : g++ (GNUC) 10.3.0 on Apple
Compilation architecture   : x86-64-bmi2
Compilation settings       : 64bit BMI2 AVX2 SSE41 SSSE3 SSE2 POPCNT
Compiler __VERSION__ macro : 10.3.0

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

no functional change

13 months agoEnable a default native ARCH
Joost VandeVondele [Sat, 26 Aug 2023 09:38:16 +0000 (11:38 +0200)]
Enable a default native ARCH

uses a posix compatible script to find the native arch.
(based on ppigazzini's https://github.com/ppigazzini/stockfish-downloader )
use that native arch by default, no changes if ARCH is specified explicitly.

SF can now be compiled in an optimal way simply using

make -j profile-build

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

No functional change

13 months agoSparse impl of affine_transform_non_ssse3()
mstembera [Tue, 12 Sep 2023 19:23:24 +0000 (12:23 -0700)]
Sparse impl of affine_transform_non_ssse3()

deal with the general case

About a 8.6% speedup (for general arch)

Results for 200 tests for each version:

            Base      Test      Diff
    Mean    141741    153998    -12257
    StDev   2990      3042      3742

p-value: 0.999
speedup: 0.086

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

No functional change

13 months agoReorder some lines
peregrineshahin [Thu, 14 Sep 2023 11:15:43 +0000 (14:15 +0300)]
Reorder some lines

Now that qsearch has its own repetition detection we can flip the order of lines and remove the guard of depth < 0 which is not needed after reordering (i.e. it was there to prevent checking repetition again at depth ==0).

Passed STC:
https://tests.stockfishchess.org/tests/view/6502ecbb2cd016da89abc3fb
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 69536 W: 17668 L: 17490 D: 34378
Ptnml(0-2): 190, 7652, 18929, 7784, 213

Passed LTC:
https://tests.stockfishchess.org/tests/view/6505ce9072620bc881ea9086
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 52116 W: 13294 L: 13113 D: 25709
Ptnml(0-2): 26, 5176, 15471, 5361, 24

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

No functional change

13 months agoReformat some comments
Stéphane Nicolet [Mon, 11 Sep 2023 21:19:06 +0000 (23:19 +0200)]
Reformat some comments

Also include the bench to make Continuation Integration happy on Github.

Bench: 1603079

13 months agoCleanup code after dropping ICC support in favor of ICX
Sebastian Buchwald [Thu, 31 Aug 2023 19:56:34 +0000 (21:56 +0200)]
Cleanup code after dropping ICC support in favor of ICX

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

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

No functional change

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Bench: 1603079

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

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

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

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

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

Bench: 1330793

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

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

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

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

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

Bench: 1479029