Commit Graph
7118 Commits
Author SHA1 Message Date
Wencey WangandJoost VandeVondele ffffe1bdb5 Add intrinsics for LSX and LASX
This adds actual intrinsics of SIMD on loongarch64, with considerable performance improvements.

Benchmark on `Loongson-3A6000-HV Not Specified CPU @ 2.5GHz`

Baseline GCC 14 (debian trixie):
```
===========================
Total time (ms) : 17816
Nodes searched  : 2336177
Nodes/second    : 131128
```

With this PR:

GCC 16 (debian sid):
```
./stockfish compiler
Stockfish dev-20260516-52e8d9ef by the Stockfish developers (see AUTHORS file)

Compiled by                : g++ (GNUC) 16.1.0 on Linux
Compilation architecture   : loongarch64-lasx
Compilation settings       : 64bit LASX LSX
Compiler __VERSION__ macro : 16.1.0
===========================
Total time (ms) : 3518
Nodes searched  : 2336177
Nodes/second    : 664063
```
```
./stockfish compiler
Stockfish dev-20260516-52e8d9ef by the Stockfish developers (see AUTHORS file)

Compiled by                : g++ (GNUC) 16.1.0 on Linux
Compilation architecture   : loongarch64-lsx
Compilation settings       : 64bit LSX
Compiler __VERSION__ macro : 16.1.0
===========================
Total time (ms) : 4944
Nodes searched  : 2336177
Nodes/second    : 472527
```

clang 22 (debian sid):
```
./stockfish compiler
Stockfish dev-20260516-52e8d9ef by the Stockfish developers (see AUTHORS file)

Compiled by                : clang++ 22.1.5 on Linux
Compilation architecture   : loongarch64-lasx
Compilation settings       : 64bit LASX LSX
Compiler __VERSION__ macro : Debian Clang 22.1.5 (1)
===========================
Total time (ms) : 3401
Nodes searched  : 2336177
Nodes/second    : 686908
```
```
./stockfish compiler
Stockfish dev-20260516-52e8d9ef by the Stockfish developers (see AUTHORS file)

Compiled by                : clang++ 22.1.5 on Linux
Compilation architecture   : loongarch64-lsx
Compilation settings       : 64bit LSX
Compiler __VERSION__ macro : Debian Clang 22.1.5 (1)
===========================
Total time (ms) : 5501
Nodes searched  : 2336177
Nodes/second    : 424682
```

GCC 14 (debian trixie):
```
./stockfish compiler
Stockfish dev-20260516-52e8d9ef by the Stockfish developers (see AUTHORS file)

Compiled by                : g++ (GNUC) 14.2.0 on Linux
Compilation architecture   : loongarch64-lasx
Compilation settings       : 64bit LASX LSX
Compiler __VERSION__ macro : 14.2.0
===========================
Total time (ms) : 3559
Nodes searched  : 2336177
Nodes/second    : 656413
```
```
./stockfish compiler
Stockfish dev-20260516-52e8d9ef by the Stockfish developers (see AUTHORS file)

Compiled by                : g++ (GNUC) 14.2.0 on Linux
Compilation architecture   : loongarch64-lsx
Compilation settings       : 64bit LSX
Compiler __VERSION__ macro : 14.2.0
===========================
Total time (ms) : 5212
Nodes searched  : 2336177
Nodes/second    : 448230
```

clang 19 (debian trixie):
```
./stockfish compiler
Stockfish dev-20260516-52e8d9ef by the Stockfish developers (see AUTHORS file)

Compiled by                : clang++ 19.1.7 on Linux
Compilation architecture   : loongarch64-lasx
Compilation settings       : 64bit LASX LSX
Compiler __VERSION__ macro : Debian Clang 19.1.7 (3+b1)
===========================
Total time (ms) : 4830
Nodes searched  : 2336177
Nodes/second    : 483680
```
```
./stockfish compiler
Stockfish dev-20260516-52e8d9ef by the Stockfish developers (see AUTHORS file)

Compiled by                : clang++ 19.1.7 on Linux
Compilation architecture   : loongarch64-lsx
Compilation settings       : 64bit LSX
Compiler __VERSION__ macro : Debian Clang 19.1.7 (3+b1)
===========================
Total time (ms) : 5568
Nodes searched  : 2336177
Nodes/second    : 419572
```

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

No functional change
2026-05-17 20:42:36 +02:00
DisservinandJoost VandeVondele 0366d092a8 Shorten Prerelease Binary Window
Only delete the prerelease once all assets have been built and only need upload.

Also fix a link in prerelease notes to the official releases.

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

No functional change
2026-05-17 20:41:36 +02:00
dd321af5df Updated main network to nn-83a0d6daf7e5.nnue
Passed STC:
https://tests.stockfishchess.org/tests/view/69f902413a3c3e525bb2b465
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 27264 W: 7199 L: 6895 D: 13170
Ptnml(0-2): 80, 3139, 6903, 3417, 93

Passed LTC:
https://tests.stockfishchess.org/tests/view/69f98b103a3c3e525bb2b4f7
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 32352 W: 8509 L: 8200 D: 15643
Ptnml(0-2): 10, 3439, 8979, 3728, 20

Nettest Run
https://gitlab.com/cscs-ci/ci-testing/webhook-ci/mirrors/5137461961076608/2926829081096545/-/pipelines/2496280249

Nettest PR:
https://github.com/vondele/nettest/pull/329

Makes quite a few changes to the trainer. In particular recipe does not use a lambda (game score + outcome blending parameter) schedule for the most part.

Accidentally dropped loss weighing parameters. Unclear how big the effect of that is

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

Bench: 2336177

Co-authored-by: Tony <Tony@secret.com>
2026-05-10 11:50:01 +02:00
FauziAkramandJoost VandeVondele a12dc6cc1f VVLTC parameter's tune
Passed 1st VVLTC test with STC-bounds:
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 78172 W: 20207 L: 19894 D: 38071
Ptnml(0-2): 2, 6871, 25032, 7174, 7
https://tests.stockfishchess.org/tests/view/69fa262f3a3c3e525bb2b5e7

Passed 2nd VVLTC test with LTC-bounds:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 44360 W: 11624 L: 11322 D: 21414
Ptnml(0-2): 0, 3931, 14022, 4221, 6
https://tests.stockfishchess.org/tests/view/69f8b30d3a3c3e525bb2b3d9

STC estimate test:
Elo: -1.50 ± 1.5 (95%) LOS: 2.3%
Total: 55742 W: 14169 L: 14409 D: 27164
Ptnml(0-2): 143, 6697, 14452, 6415, 164
nElo: -2.95 ± 2.9 (95%) PairsRatio: 0.96
https://tests.stockfishchess.org/tests/view/69fef06c9392f0c317213dca

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

Bench: 2619968
2026-05-10 11:49:00 +02:00
Jörg OsterandJoost VandeVondele 944bee7117 Fix calculation of searched nodes (effort)
by moving it back to its original place right before making the move. See the original patch https://github.com/official-stockfish/Stockfish/commit/bf2c7306ac7f83200ba4d894867e3c0c78c0802c

Only functional with active time-management.

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

No functional change
2026-05-10 11:47:50 +02:00
Robert Nurnberg @ elitebookandJoost VandeVondele bcd5b6ccb3 [CI] Add a mutiPV run for matetrack
Thanks to recent commits, we can now also trust mate(d) scores from multiPV analysis for the best move, with complete PV etc. Locally I have also tested master extensively with the help of the matetrack script in multiPV analysis, with no issues reported. So I believe we can add this to our CI.

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

No functional change
2026-05-10 11:47:09 +02:00
anematodeandJoost VandeVondele 6a50807e01 On Linux, allow shared-memory network weights to be backed by huge pages
This does require the user to have set `/sys/kernel/mm/transparent_hugepage/shmem_enabled` to something other than `never` (unfortunately the default, at least on Ubuntu).

```
Result of  50 runs
==================
base (...kfish.master) =    1814244  +/- 4396
test (./stockfish    ) =    1823756  +/- 3448
diff                   =      +9512  +/- 5496

speedup         = +0.0052
P(speedup > 0) =  0.9996
```

```
 Performance counter stats for './stockfish bench':

           237,561      dTLB-misses
     5,783,003,231      cycles

 Performance counter stats for './bins/stockfish.master bench':

         2,219,832      dTLB-misses
     5,932,779,255      cycles
```

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

No functional change
2026-05-10 11:46:31 +02:00
disservinandJoost VandeVondele c2500b1165 Add Prerelease Notes
closes https://github.com/official-stockfish/Stockfish/pull/6803

No functional change
2026-05-10 11:45:15 +02:00
Robert NurnbergandJoost VandeVondele ea48d38283 remove simple eval
No longer needed after the removal of smallnet.

Also remove declaration of `use_smallnet()`.

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

No functional change
2026-05-10 11:44:38 +02:00
Robert Nurnberg @ elitebookandJoost VandeVondele fcbd160d26 [refactor] Add helper functions and simplify thread selection
I found these changes useful and natural when working on a patch to improve mate reporting. I can revert some of the changes if maintainers would prefer that. E.g. I am not sure whether `unset_bound_flags()` is worth defining.

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

No functional change
2026-05-10 11:43:53 +02:00
Joost VandeVondele 6127bf711e [CI] Upgrade SDE action
fix Node.js version dependency, update SDE.

This upgrades to 9.58, upgrade to 10.8 failed with:
Invalid file name and base dir combination: Pin root DLL: pincrt4.dll

Also adjusts Makefile to show PGO bench output on failure

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

No functional change
2026-05-10 11:43:17 +02:00
Tony WangandJoost VandeVondele 5095cd16c9 Update main network to nn-fcf986aea78a.nnue
Passed STC:
https://tests.stockfishchess.org/tests/view/69ef80071e5788938e86a302
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 32000 W: 8549 L: 8231 D: 15220
Ptnml(0-2): 124, 3717, 8024, 3987, 148

Passed LTC:
https://tests.stockfishchess.org/tests/view/69f046ba1e5788938e86a42f
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 149646 W: 38739 L: 38186 D: 72721
Ptnml(0-2): 119, 16353, 41326, 16906, 119

New trainer:
official-stockfish/nnue-pytorch#430

Recipe:
TonyCongqianWang/nettest@104ed33

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

Bench: 2344696
2026-05-04 08:42:55 +02:00
Timothy HerchenandJoost VandeVondele 1554a2ca0b Precompute moves and use magics index as compress mask on AVX512ICL
Passed STC
https://tests.stockfishchess.org/tests/view/69f6df65b64b50e29dbed427
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 112224 W: 29195 L: 28782 D: 54247
Ptnml(0-2): 312, 12345, 30381, 12766, 308

Local speedup:
```
Result of 100 runs
base (...kfish.master) =    2050387  +/- 5497
test (./stockfish    ) =    2069598  +/- 4426
diff                   =     +19211  +/- 7468
speedup         = +0.0094
P(speedup > 0) =  1.0000
```

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

No functional change
2026-05-04 08:33:01 +02:00
anematodeandJoost VandeVondele ab8f901d25 Remove small net
Failed VVLTC non-regression
https://tests.stockfishchess.org/tests/view/69d562b84088e069540a2288
LLR: -2.96 (-2.94,2.94) <-1.75,0.25>
Total: 386998 W: 99181 L: 99760 D: 188057
Ptnml(0-2): 35, 35792, 122429, 35203, 40

Failed STC non-regression
https://tests.stockfishchess.org/tests/view/69f3c6601e5788938e86a99e
LLR: -2.93 (-2.94,2.94) <-1.75,0.25>
Total: 33696 W: 8492 L: 8795 D: 16409
Ptnml(0-2): 124, 4209, 8504, 3868, 143

Many thanks to Dubslow, Torom, ces42, Shawn, vondele, Disservin and others for discussion.

## Summary

The venerable small net has been around for quite some time now, and while the big net architecture has substantially advanced with TI, the small net has stayed with plain HalfKA. It therefore presents a few burdens: multiple net architectures to maintain, multiple nets to train, and a whole lot of templates to deal with the variable L1 size.

Locally I measure a slowdown of -2.5% in NPS with this branch – and it's probably more on non-AVX512 architectures – but a pure slowdown of that magnitude would lead to more dramatic losses (even at VVLTC) than exhibited in the above tests, suggesting that the small net's lower eval quality is deleterious.

Bonus: Shawn found this interesting PGN among the VVLTC games: https://lichess.org/study/hvo8jflc/OeTOityv  `master` seems to misevaluate the fortress because all positions go to small net (the material difference is larger than the threshold).

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

Bench: 2877007
2026-05-04 08:32:42 +02:00
anematodeandJoost VandeVondele dc1686345c Hyperbola quintessence for ARM
Passed STC

https://tests.stockfishchess.org/tests/view/69f44c1e1e5788938e86aa2a
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 27680 W: 7340 L: 7053 D: 13287
Ptnml(0-2): 72, 2862, 7683, 3153, 70

x86 is unaffected

Data from Joost's machine (Neoverse V2):

```
==== master ====
==== Bench: 2723949 ====
1 Nodes/second : 276819933
2 Nodes/second : 273971948
3 Nodes/second : 275567995
Average (over 3):  275453292
==== 5b54755db23a3de29407b805b85e7bbdef28df49 ====
==== Bench: 2723949 ====
1 Nodes/second : 282861542
2 Nodes/second : 279085277
3 Nodes/second : 279612223
Average (over 3):  280519680 (+1.8%)
```

Data from my M1 macbook

```
Result of 100 runs
==================
base (./stockfish    ) =    1474702  +/- 6169
test (...fish.rbit-pr) =    1500236  +/- 6690
diff                   =     +25533  +/- 4011

speedup        = +0.0173
P(speedup > 0) =  1.0000
```

Hyperbola quintessence works nicely on ARM because it has an efficient bit reversal instruction `rbit`. This lets us avoid the large magic bitboards lookup table. Codegen looks nice (this is for rook attacks I think):

```
0000000100001ecc <__ZN9Stockfish10attacks_bbILNS_9PieceTypeE3EEEyNS_6SquareEy>:
100001ecc: 2a0003e8     mov w8, w0
100001ed0: f002cb09     adrp x9, 0x105964000 <dyld_stub_binder+0x105964000>
100001ed4: 91200129     add x9, x9, #0x800
100001ed8: 8b081928     add x8, x9, x8, lsl #6
100001edc: a9402909     ldp x9, x10, [x8]
100001ee0: 8a01012b     and x11, x9, x1
100001ee4: dac0016c     rbit x12, x11
100001ee8: a941210d     ldp x13, x8, [x8, #0x10]
100001eec: cb08018c     sub x12, x12, x8
100001ef0: dac0018c     rbit x12, x12
100001ef4: cb0d016b     sub x11, x11, x13
100001ef8: ca0b018b     eor x11, x12, x11
100001efc: 8a090169     and x9, x11, x9
100001f00: 8a01014b     and x11, x10, x1
100001f04: dac0016c     rbit x12, x11
100001f08: cb080188     sub x8, x12, x8
100001f0c: dac00108     rbit x8, x8
100001f10: cb0d016b     sub x11, x11, x13
100001f14: ca0b0108     eor x8, x8, x11
100001f18: 8a0a0108     and x8, x8, x10
100001f1c: 8b090100     add x0, x8, x9
100001f20: d65f03c0     ret
```

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

No functional change
2026-05-04 08:32:23 +02:00
fe1d2b456c Update CI Binaries
- split into multiple jobs
- remove binaries which are already covered by the universal binary

superseeds https://github.com/official-stockfish/Stockfish/pull/6779

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

No functional change

Co-authored-by: Disservin <disservin.social@gmail.com>
2026-05-04 08:32:03 +02:00
Robert Nurnberg @ elitebookandJoost VandeVondele 7e754e17dd Simplify away completedDepth
Recent changes to this part of the code mean that the variable `completedDepth` is no longer neeeded. The only *functional* part of this patch is the effect on the thread voting formula. Basically, compared to master this patch raises the depth weight in the formula uniformly by 1. For very, very low depths this may have a tiny effect on thread selection compared to master. But in general we expect this patch to have no effect on game play at STC and LTC.

Passed STC SMP non-reg:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 284808 W: 72944 L: 72994 D: 138870
Ptnml(0-2): 351, 32192, 77370, 32138, 353
https://tests.stockfishchess.org/tests/view/69eddd011e5788938e86a075

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

No functional change
2026-05-04 08:31:44 +02:00
FauziAkramandJoost VandeVondele 4055a9fb27 Remove the limit from the formula
Passed STC:
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 364768 W: 94115 L: 94250 D: 176403
Ptnml(0-2): 1101, 40158, 99989, 40047, 1089
https://tests.stockfishchess.org/tests/view/69e7ca530e9667dd5a7655a7

Passed LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 146382 W: 37335 L: 37247 D: 71800
Ptnml(0-2): 64, 14682, 43630, 14732, 83
https://tests.stockfishchess.org/tests/view/69eeaf551e5788938e86a1e6

Passed VLTC:
LLR: 3.00 (-2.94,2.94) <-1.75,0.25>
Total: 48308 W: 12350 L: 12172 D: 23786
Ptnml(0-2): 4, 4303, 15362, 4481, 4
https://tests.stockfishchess.org/tests/view/69f25adb1e5788938e86a794

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

No functional change
2026-05-04 08:31:25 +02:00
3e3e976fdf [bugfix] Respect bound flags for searched moves in multiPV analysis
Master in `pv()` incorrectly assumes that any root move with `i != pvIdx` has an exact score. This can lead to the suppression of bound flags for (a) root moves that have been partially searched in an iteration but do not end up to be best move, or (b) when an aborted search for `pvIdx > 0` leads to a new best move. This latter case is the cause for issue #6783.

Fixes #6783.

The bug in its incarnation (a) was independently discovered by @ciekce a couple of weeks ago, and we have jointly discussed a patch that fixes it. He is therefore a co-author of the bugfix part of this patch.

While at it, we also fix three minor oversights in the PV roll-back for aborted searches with a loss score:
* We only roll back the PV if the aborted search would report an exact score.
* Master inadvertently may have reported a bound for the rolled-back score+PV.
* We ensure a final UCI info line with the correct search depth and searched nodes statistics etc.

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

No functional change

Co-Authored-By: Ciekce <44617491+Ciekce@users.noreply.github.com>
2026-05-04 08:31:06 +02:00
FauziAkramandJoost VandeVondele 2be0b2cdb4 Change ttmove reduction logic, and values
Passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 38112 W: 10024 L: 9708 D: 18380
Ptnml(0-2): 104, 4365, 9830, 4625, 132
https://tests.stockfishchess.org/tests/view/69dd25a33ca80bdf151d4b33

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 256926 W: 65744 L: 64977 D: 126205
Ptnml(0-2): 126, 27919, 71612, 28674, 132
https://tests.stockfishchess.org/tests/view/69de48645c67bee7d241ff4e

Passed VLTC non-reg:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 174386 W: 44640 L: 44578 D: 85168
Ptnml(0-2): 26, 17847, 51384, 17911, 25
https://tests.stockfishchess.org/tests/view/69e767370e9667dd5a76551b

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

Bench: 2788824
2026-05-04 08:30:47 +02:00
FauziAkramandJoost VandeVondele 7bd32a51f5 Replacing the futility margin static value with a continuous transition
Smooth the futility margin by interpolating the multiplier based on depth, replacing the previous static value with a continuous transition between depth 1 and 10.

Passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 208448 W: 53891 L: 53324 D: 101233
Ptnml(0-2): 629, 24426, 53574, 24939, 656
https://tests.stockfishchess.org/tests/view/69e232206f344a19176002f3

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 208938 W: 53432 L: 52765 D: 102741
Ptnml(0-2): 105, 22531, 58550, 23158, 125
https://tests.stockfishchess.org/tests/view/69e8b5d00e9667dd5a7656c6

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

Bench: 2661424
2026-05-04 08:30:28 +02:00
Timothy HerchenandJoost VandeVondele 04ce2c04d7 Faster movepick sorting on AVX512ICL
The core idea here is to greatly speed up the backwards insertion loop of the insertion sort. We can store up to 16 sorted moves and their values/scores in vectors. We obtain all moves with a smaller score (i.e., sorted later than the move-to-insert) as a mask, giving us something like `1111111111000000`. If we subtract one this gives us `1111111110111111` which can be can be used as an expand mask, to insert the new move.

Passed STC:
https://tests.stockfishchess.org/tests/view/69e9c9190e9667dd5a765853
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 45024 W: 11867 L: 11550 D: 21607
Ptnml(0-2): 101, 4938, 12142, 5205, 126

Local test:
```
Result of  50 runs
==================
base (...kfish.master) =    2026071  +/- 5124
test (./stockfish    ) =    2083770  +/- 5964
diff                   =     +57699  +/- 8535

speedup         = +0.0285
P(speedup > 0) =  1.0000
```

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

No functional change
2026-05-04 08:30:09 +02:00
anematodeandJoost VandeVondele 1a882efc7f Simplify out double_inc_update
Passed STC
https://tests.stockfishchess.org/tests/view/69e82e200e9667dd5a765631
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 115424 W: 29950 L: 29822 D: 55652
Ptnml(0-2): 318, 12712, 31544, 12800, 338

Passed AVX2-only STC
https://tests.stockfishchess.org/tests/view/69e953080e9667dd5a7657c0
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 134720 W: 34773 L: 34665 D: 65282
Ptnml(0-2): 344, 14958, 36694, 14974, 390

Now that our L1 size is much smaller, the overhead of tracking diffs for
`double_inc_update` is a larger share of the cost.

Interestingly ces42 measured a -0.9% slowdown locally (avxvnni build).
Meanwhile Torom and I find this branch to be 2% faster. I'm not sure exactly
what's going on but more tests may be in order

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

No functional change
2026-04-26 09:43:42 +02:00
Ryan Hirsch rhirsch123andJoost VandeVondele 0e78190b72 Speed up find_nnz on neon (Refactored)
Passed STC:
LLR: 2.97 (-2.94,2.94) <0.00,2.00>
Total: 349568 W: 90131 L: 89393 D: 170044
Ptnml(0-2): 725, 37712, 97280, 38234, 833
https://tests.stockfishchess.org/tests/view/69e470510e9667dd5a765046

This is a refactor of https://github.com/official-stockfish/Stockfish/pull/6766 so we don't have to include nnue_architecture.h
It also includes the fix in https://github.com/official-stockfish/Stockfish/pull/6769 which was needed to make this work.
mstembera made rhirsch123 the author.  credits also to anematode.

[Edit] Also fixes a bug where _mm512_packus_epi32 was being used instead of the correct _mm512_packs_epi32 for the IceLake version.

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

No functional change
2026-04-26 09:41:09 +02:00
ppigazziniandJoost VandeVondele b35a064eae ci: cancel stale workflow runs per PR or ref
Add workflow-level concurrency to the direct GitHub Actions entrypoints so a
newer run for the same pull request or repository ref cancels the older
in-progress run.

Keep the reusable workflow graph, release guards, triggers, and permissions
unchanged while documenting the concurrency policy and the official GitHub
references used for the change.

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

No functional change.
2026-04-26 09:39:38 +02:00
mstemberaandJoost VandeVondele 692d90bd74 Simplify FullThreats::append_active_indices()
Also add an else to FullThreats::append_changed_indices() because dp2removed
can't be equal to both from and to simultaneously.

passed STC
https://tests.stockfishchess.org/tests/view/69e71a490e9667dd5a76549f
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 210688 W: 54362 L: 54335 D: 101991
Ptnml(0-2): 613, 23246, 57593, 23285, 607

Thanks to ces42 for an improvement suggestion.

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

No functional change
2026-04-26 09:37:18 +02:00
FauziAkramandJoost VandeVondele c787509663 Simplify time management reduction logic
Simplify the time management reduction logic by replacing the previous sigmoid
function with the linear interpolate function introduced in #6729 , resulting
in a cleaner and more efficient calculation of move stability that avoids
unnecessary exponential operations.

Passed STC non-reg:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 161856 W: 41933 L: 41852 D: 78071
Ptnml(0-2): 418, 18137, 43792, 18108, 473
https://tests.stockfishchess.org/tests/view/69e117a46f344a1917600148

Passed LTC non-reg:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 108726 W: 27819 L: 27692 D: 53215
Ptnml(0-2): 59, 11084, 31942, 11227, 51
https://tests.stockfishchess.org/tests/view/69e563c00e9667dd5a7652ac

This is a follow-up for #6091  #6729

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

No functional change
2026-04-26 09:35:37 +02:00
mstemberaandJoost VandeVondele 767dcfe48d Fix Universal build on Windows
TRACKED_TOP previously used a shell pipeline (xargs, awk, sort) to extract
unique top-level directory/file names from SRCS and HEADERS. When invoking make
from cmd.exe on Windows, $(shell ...) uses cmd.exe rather than sh.exe, so the
pipeline fails because cmd.exe does not support Unix pipe syntax. Other MSYS2
tools (e.g. the compiler) work fine because they are invoked directly as
commands, not through a shell pipeline. This caused TRACKED_TOP to be empty, so
ln -s never ran and the per-arch temp_builds subdirectories were left without a
Makefile symlink, breaking the universal build with: "No rule to make target
'universal-object-nopgo'". Fixed by replacing the shell pipeline with pure GNU
make built-in functions (sort, foreach, firstword, subst) which have no shell
or PATH dependencies and work identically on Windows, Linux and macOS.

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

No functional change
2026-04-26 09:33:03 +02:00
anematodeandJoost VandeVondele 8f181af8fb Get universal binary working for clang on Linux
A few changes were necessary, mainly because clang LTO works a bit differently than GCC

Doesn't yet work on Windows

small Makefile cleanups

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

No functional change
2026-04-26 09:31:30 +02:00
Robert Nurnberg @ elitebookandJoost VandeVondele 86853a60ce [bugfix] Send correct search depth in final UCI info line
For quite some time SF has reported a too low final search depth in rare cases
(in multi-threaded search if a non-main thread was selected). Unfortunately,
the recent refactoring in #6704 means that this now happens for almost every
stopped search.

This PR fixes this issue, which was first spotted and reported by joergoster,
by ensuring that `rootDepth` always holds the last depth for which a search was
started.

Fixes #6756.

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

No functional change.
2026-04-26 09:28:54 +02:00
Dieter DobbelaereandJoost VandeVondele e68ca3c187 Rename Linux universal release package/binary
Rename Linux universal release package from
`stockfish-ubuntu-x86-64-universal.tar.gz`  to
`stockfish-linux-x86-64-universal.tar.gz` (and similar for the binary), as the
bundled binary should run on any Linux distro with glibc >= 2.35 (which is the
glibc version of the Ubuntu 22.04 build server).

Note that the Linux universal binary is built with static libstdc++ linkage, so
this adds no extra dependency.

This change will hopefully make it less confusing for users, and in line with
how we show it on stockfishchess.org (as Linux).

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

No functional change
2026-04-26 09:27:08 +02:00
FauziAkramandJoost VandeVondele 38d887ac64 Reuse Promotion Type Natively
Piece promotion is generated, and then type_of(promotion) is used to retrieve
the underlying type. The class Move provides .promotion_type() natively,
meaning we can cache the type directly and avoid extracting it indirectly
afterward.  By extracting pt = m.promotion_type(); up front, we don't need to
call type_of(promotion) iteratively inside the assertions or conditions below.

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

No functional change
2026-04-26 09:25:45 +02:00
Robert NurnbergandJoost VandeVondele 50e8ff1e23 multiPV: protect mated-ins and allow thread selection
This PR is a replacement for #6652 and takes into account the changes made to this part of the code since then.

In multiPV analysis master may suppress genuine proven mated-in scores, if the iteration for a secondary PV line is aborted. In very rare cases, it may also evict a proven mated-in score from the best PV line with a score from an incomplete iteration of a secondary PV line. This PR avoids both.

In addition, we allow best thread selection in multithreaded multiPV searches. This was originally disabled in #524.

Single PV searches are not affected by this patch at all.

Fixes #6642.

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

No functional change.
2026-04-26 09:24:34 +02:00
anematodeandJoost VandeVondele e17725f445 Constexpr attacks (pext only)
LLR: 2.97 (-2.94,2.94) <0.00,2.00>
Total: 38400 W: 10057 L: 9749 D: 18594
Ptnml(0-2): 93, 4110, 10498, 4394, 105
https://tests.stockfishchess.org/tests/view/69d2073261a12cebe17edc04

compile time generation leads to sharing tables through the binary, resulting
in gain on fishtest, as well as reduced memory usage. The downside is slightly
longer compilation time.

Using pdep reduces table size 4x, and gains a little outside of fishtest as well.

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

No functional change
2026-04-26 09:18:06 +02:00
FauziAkramandJoost VandeVondele ed651aab54 Replacing std::clamp with std::min
No functional change

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

No functional change
2026-04-20 17:45:03 +02:00
FauziAkramandJoost VandeVondele 7faecd75ac Combine duplicated - tb.plies subtraction logic
closes https://github.com/official-stockfish/Stockfish/pull/6752

No functional change
2026-04-20 17:44:01 +02:00
DisservinandJoost VandeVondele 583e0c1c75 cleanup feature detection code
makes the main dispatch logic more easy to follow and possibly update

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

No functional change
2026-04-20 17:42:47 +02:00
Dieter DobbelaereandJoost VandeVondele 9dd58542c9 Compress Linux universal release package
`stockfish-ubuntu-x86-64-universal.tar` goes from 94.8MiB to 67.4MiB (tar.gz)

Note that the CI code is written such that it easy to select other compression
schemes in the future (e.g. tar.xz) by simply changing the `archive_ext`
parameter.

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

No functional change
2026-04-20 17:41:06 +02:00
anematodeandJoost VandeVondele 20a8d8d3c0 Remove git dependency from Makefile
To build the universal binaries, use already defined variables with sources and
headers, as well as Makefile and incbin explicitly.

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

No functional change
2026-04-20 17:39:02 +02:00
ppigazziniandJoost VandeVondele 463f5a6ee1 ci: pin root workflow actions to immutable SHAs
Pin every external action used by the root GitHub workflow set to a full-length
commit SHA and keep the selected release tag as a same-line comment.

Update the root workflows to the latest stable tagged action versions found
during the audit while preserving existing release guards, permissions, and
reusable workflow wiring.

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

No functional change.
2026-04-20 17:37:39 +02:00
Joost VandeVondele 4a6c7e77a5 [CI] Cleanup artifact content (part 2)
removes temp_builds directory before packaging, even more.

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

No functional change
2026-04-19 13:51:09 +02:00
Joost VandeVondele edfd021257 [CI] Cleanup artifact content
removes temp_builds directory before packaging

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

No functional change
2026-04-19 12:26:47 +02:00
anematodeandJoost VandeVondele 1e333b341c Add universal binaries to prerelease page
closes https://github.com/official-stockfish/Stockfish/pull/6744

No functional change
2026-04-19 11:09:24 +02:00
FauziAkramandJoost VandeVondele ce7848f7cc Remove the Redundant ply Variables in Benchmark Calculations
In setup_benchmark, the variables evaluating the current ply simply mirror the
exact iterative progress of the string arrays loop (since ply just increments
by 1 with every pass). We can delete the separate integer assignment and
execute it securely within the loop declaration.

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

No functional change
2026-04-19 07:23:25 +02:00
FauziAkramandJoost VandeVondele c66acdac99 Restructure Futility pruning
to a simpler and cleaner version

Passed non-reg test:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 175648 W: 45156 L: 45091 D: 85401
Ptnml(0-2): 459, 19228, 48383, 19297, 457
https://tests.stockfishchess.org/tests/view/69d8d9263ca80bdf151d454a

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

No functional change
2026-04-19 07:21:27 +02:00
Maxim MasiutinandJoost VandeVondele 40ac93b8f8 Fix MultiArray::at(); use operator[] on hot paths
Fix MultiArray::at() which was marked noexcept despite delegating to
std::array::at() that throws on out-of-range. Per review feedback, at() now
keeps standard bounds-checking semantics (only noexcept removed), and
operator[] gains an assert for debug-mode safety.

All eight correction history lookups in search.cpp (correction_value and
update_correction_history) are switched from .at(us) to [us].

Passed STC:
https://tests.stockfishchess.org/tests/view/69de7a735c67bee7d241ff92
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 77536 W: 20031 L: 19860 D: 37645
Ptnml(0-2): 221, 8411, 21338, 8572, 226

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

No functional change
2026-04-19 07:19:23 +02:00
FauziAkramandJoost VandeVondele cc4637b52b Remove Redundant Cast in MovePicker
closes https://github.com/official-stockfish/Stockfish/pull/6735

No functional change
2026-04-19 07:18:02 +02:00
FauziAkramandJoost VandeVondele 95f3680080 Replace constant LMR history divisor with depth-based array
Passed STC:
LLR: 2.97 (-2.94,2.94) <0.00,2.00>
Total: 677344 W: 175301 L: 174041 D: 328002
Ptnml(0-2): 2018, 79669, 174166, 80673, 2146
https://tests.stockfishchess.org/tests/view/69cfae021668971c9da23b80

Passed LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 46470 W: 11988 L: 11651 D: 22831
Ptnml(0-2): 37, 4877, 13055, 5244, 22
https://tests.stockfishchess.org/tests/view/69dcd13c3ca80bdf151d4ab5

Passed VLTC (non-reg.):
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 58986 W: 15120 L: 14947 D: 28919
Ptnml(0-2): 7, 5835, 17636, 6008, 7
https://tests.stockfishchess.org/tests/view/69debc6c5c67bee7d241ffe9

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

Bench: 2723949
2026-04-19 07:15:43 +02:00
sscg13andJoost VandeVondele de7b0cd7a6 Update trace eval
Updates the information printed in the "eval" command. Removes piece value estimation, and adds both small and big net eval information.

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

No functional change
2026-04-19 07:10:20 +02:00
anematodeandJoost VandeVondele c3bcf74925 Universal binary for x86-64 Linux and Windows
We maintain support for quite a few x86 ISA extensions but relied on the end
user to select the binary that is best for their system.  We can detect at
runtime which architecture to use, and ship a single binary (per OS/ISA
combination). This PR does so, maintaining performance.

This is what I've landed on after quite a few iterations. Basically, we build
each arch separately, use `cpuid` to select one, and jump to that arch's main
function. Some details:

- The preprocessor macro `UNIVERSAL_BINARY` is defined when building for the universal binary.

- The Makefile target `universal-object-[no]pgo` is added, which produces a `stockfish.o` in each arch's build directory.

- To prevent symbol collisions between the multiple builds, we `#define Stockfish Stockfish_[arch]`. Furthermore we wrap the `main` function in `namespace Stockfish { }`.

- We can still get PGO data by linking to a per-arch binary, with `Stockfish_x86_64_avx2::main` as `main`, and running `bench`.
    - For arches not supported by the host we can use Intel SDE – this is what we do in CI.

- When embedding the NNUE, we use C++26/C23 `#embed` instead of `INCBIN`. The issue with `INCBIN` is that it injects assembly directives that we have no control over.
    - To ensure there's only one copy of the networks in the final binary, we define the network data as weak symbols in each per-arch build. Then, in the final link, we add a special nnue_embed.cpp which provides strong symbols.
    - This does require GCC 15. Statically linking libstdc++ allows the binary to still run on older OSes though. And latest msys2 already does static linking + is based off GCC 15.2.0

building can be as simple as

make -j profile-build ARCH=x86-64-universal

or using the sde if the host doesn't support all architectures supported in the
universal binary, and the default host compiler is not recent enough.

make -j profile-build ARCH=x86-64-universal RUN_PREFIX="/path/to/sde -future --" CXX=g++-15

This change is also integrated in CI, so universal binaries are available as
downloadable artifacts.

Next we could also do ARM64, especially Android (all Apple silicon users use
the same binary). It also might be worth getting this to work with clang.

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

No functional change
2026-04-19 07:07:11 +02:00