]> git.sesse.net Git - stockfish/log
stockfish
3 years agoOutput the SSE2 flag in compiler_info
Joost VandeVondele [Wed, 12 Aug 2020 15:21:12 +0000 (17:21 +0200)]
Output the SSE2 flag in compiler_info

was missing in the list of outputs, slightly reorder flags.
explicitly add -msse2 if USE_SSE2 (is implicit already, -msse -m64).

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

No functional change.

3 years agoAdd support for VNNI
mstembera [Tue, 11 Aug 2020 19:59:39 +0000 (12:59 -0700)]
Add support for VNNI

Adds support for Vector Neural Network Instructions (avx512), as available on Intel Cascade Lake

The _mm512_dpbusd_epi32() intrinsic (vpdpbusd instruction) is taylor made for NNUE.

on a cascade lake CPU (AWS C5.24x.large, gcc 10) NNUE eval is at roughly 78% nps of classical
(single core test)

bench 1024 1 24 default depth:
target  classical  NNUE  ratio
vnni  2207232  1725987  78.20
avx512  2216789  1671734  75.41
avx2  2194006  1611263  73.44
modern  2185001  1352469  61.90

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

No functional change

3 years agoUse posix_memalign for Apple Silicon instead of _mm_malloc
Daylen Yang [Tue, 11 Aug 2020 19:02:48 +0000 (12:02 -0700)]
Use posix_memalign for Apple Silicon instead of _mm_malloc

fails to build on that target, because of missing Intel Intrinsics.
macOS has posix_memalign() since ~2014 so we can simplify the code and just use that for all Apple platforms.

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

No functional change.

3 years agoRestrict avx2 hack to windows target
Joost VandeVondele [Tue, 11 Aug 2020 19:11:17 +0000 (21:11 +0200)]
Restrict avx2 hack to windows target

this workaround is possibly rather a windows & gcc specific problem. See e.g.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412#c25

on Linux with gcc 8 this patch brings roughly a 8% speedup.
However, probably needs some testing in the wild.

includes a workaround for an old msys make (3.81) installation (fixes #2984)

No functional change

3 years agoTweak castling extension
SFisGOD [Mon, 10 Aug 2020 13:13:56 +0000 (21:13 +0800)]
Tweak castling extension

Change condition from three friendly pieces to two. This now means that we only extend castling on the king side if there are no other friendly pieces aside from king and rook. For the queen side, we only extend if there is only a rook and another friendly piece or if there is only a single rook and no other friendly piece but this is very rare.

STC:
LLR: 3.20 (-2.94,2.94) {-0.50,1.50}
Total: 31144 W: 4086 L: 3903 D: 23155
Ptnml(0-2): 227, 2843, 9278, 2968, 256
https://tests.stockfishchess.org/tests/view/5f31487f9081672066537516

LTC:
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 57816 W: 3786 L: 3538 D: 50492
Ptnml(0-2): 92, 2991, 22488, 3251, 86
https://tests.stockfishchess.org/tests/view/5f3167c3908167206653753d

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

Bench: 4244812

3 years agoThis commit enables a mixed bench, to improve CI and allow for PGO (profile-build...
Guy Vreuls [Fri, 7 Aug 2020 15:07:46 +0000 (17:07 +0200)]
This commit enables a mixed bench, to improve CI and allow for PGO (profile-build) of the NNUE part of the code.

Joint work gvreuls / vondele

* Download the default NNUE net in AppVeyor
* Download net in travis CI `make net`
* Adjust tests to cover more archs, speedup instrumented testing
* Introduce 'mixed' bench as default, with further options:

classical, NNUE, mixed.

mixed (default) and NNUE require the default net to be present,
which can be obtained with

```
make net
```

Further examples (first is equivalent to `./stockfish bench`):

```
./stockfish bench 16 1 13 default depth mixed
./stockfish bench 16 1 13 default depth classical
./stockfish bench 16 1 13 default depth NNUE
```

The net is now downloaded automatically if needed for `profile-build`
(usual `build` works fine without net present)

PGO gives a nice speedup on fishtest:

passed STC:
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 3360 W: 469 L: 343 D: 2548
Ptnml(0-2): 20, 246, 1030, 356, 28
https://tests.stockfishchess.org/tests/view/5f31b5499081672066537569

passed LTC:
LLR: 2.97 (-2.94,2.94) {0.25,1.75}
Total: 8824 W: 609 L: 502 D: 7713
Ptnml(0-2): 8, 430, 3438, 519, 17
https://tests.stockfishchess.org/tests/view/5f31c87b908167206653757c

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

fixes https://github.com/official-stockfish/Stockfish/issues/2907

requires fishtest updates before commit

Bench: 4290577

3 years agoFix AVX512 build with older compilers
mstembera [Mon, 10 Aug 2020 19:52:46 +0000 (12:52 -0700)]
Fix AVX512 build with older compilers

avoids an intrinsic that is missing in gcc < 10.

For this target, might trigger another gcc bug on windows that
requires up-to-date gcc 8, 9, or 10, or usage of clang.

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

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

No functional change

3 years agoMore aligned_alloc changes to support Android
Joost VandeVondele [Mon, 10 Aug 2020 14:14:17 +0000 (16:14 +0200)]
More aligned_alloc changes to support Android

Move to posix_memalign for those platforms, in particular android,
that do not fully support c++17 std::aligned_alloc() (and are not windows)

see https://github.com/official-stockfish/Stockfish/issues/2860

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

No functional change

3 years agoFix parallel LTO issues on Windows
Guy Vreuls [Tue, 11 Aug 2020 02:38:38 +0000 (04:38 +0200)]
Fix parallel LTO issues on Windows

This adds -save-temps to the linker flags when parallel LTO is used on
MinGW/MSYS.

fixes #2977

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

No functional change.

3 years agoAdd comments to probCut code
Vizvezdenec [Sat, 18 Jul 2020 13:30:00 +0000 (16:30 +0300)]
Add comments to probCut code

and rename a variable

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

No functional change

3 years agoAssorted search parameter tune
Unai Corzo [Mon, 10 Aug 2020 13:38:44 +0000 (15:38 +0200)]
Assorted search parameter tune

STC https://tests.stockfishchess.org/tests/view/5f31219090816720665374ec
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 3376 W: 487 L: 359 D: 2530
Ptnml(0-2): 17, 253, 1042, 337, 39

LTC https://tests.stockfishchess.org/tests/view/5f3127f79081672066537502
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 8360 W: 581 L: 475 D: 7304
Ptnml(0-2): 11, 407, 3238, 513, 11

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

bench: 4733874

3 years agoProvide vectorized NNUE code for SSE2 and MMX targets
Fanael Linithien [Sun, 9 Aug 2020 14:20:45 +0000 (16:20 +0200)]
Provide vectorized NNUE code for SSE2 and MMX targets

This patch allows old x86 CPUs, from AMD K8 (which the x86-64 baseline
targets) all the way down to the Pentium MMX, to benefit from NNUE with
comparable performance hit versus hand-written eval as on more modern
processors.

NPS of the bench with NNUE enabled on a Pentium III 1.13 GHz (using the
MMX code):
  master: 38951
  this patch: 80586

NPS of the bench with NNUE enabled using baseline x86-64 arch, which is
how linux distros are likely to package stockfish, on a modern CPU
(using the SSE2 code):
  master: 882584
  this patch: 1203945

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

No functional change.

3 years agoCleanup and optimize SSE/AVX code
mstembera [Sun, 9 Aug 2020 23:23:33 +0000 (16:23 -0700)]
Cleanup and optimize SSE/AVX code

AVX512 +4% faster
AVX2 +1% faster
SSSE3 +5% faster

passed non-regression STC:
STC https://tests.stockfishchess.org/tests/view/5f31249f90816720665374f6
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 17576 W: 2344 L: 2245 D: 12987
Ptnml(0-2): 127, 1570, 5292, 1675, 124

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

No functional change

3 years agoMakefile rework/cleanup
sf-x [Sun, 9 Aug 2020 15:01:18 +0000 (18:01 +0300)]
Makefile rework/cleanup

Makefile targets x86-64-sse42, x86-sse3 are removed; x86-64-sse41
is renamed to x86-64-sse41-popcnt (it did enable popcnt).

Makefile variables sse3, sse42, their associated compilation flags
and code in misc.cpp are removed.

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

No functional change

3 years agoModify castling extension
SFisGOD [Mon, 10 Aug 2020 07:39:22 +0000 (15:39 +0800)]
Modify castling extension

Extend castling only if there are few friendly pieces on the castling side.

Inspired by silversolver1's (Rahul Dsilva) test
https://tests.stockfishchess.org/tests/view/5f0fef560640035f9d2978cf

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 7096 W: 947 L: 818 D: 5331
Ptnml(0-2): 32, 604, 2181, 665, 66
https://tests.stockfishchess.org/tests/view/5f309f729081672066537426

LTC:
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 4712 W: 300 L: 215 D: 4197
Ptnml(0-2): 2, 190, 1895, 259, 10
https://tests.stockfishchess.org/tests/view/5f30a2039081672066537430

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

Bench: 4094850

3 years agoWorkaround using unaligned loads for gcc < 9
mstembera [Mon, 10 Aug 2020 06:50:59 +0000 (23:50 -0700)]
Workaround using unaligned loads for gcc < 9

despite usage of alignas, the generated (avx2/avx512) code with older compilers needs to use
unaligned loads with older gcc (e.g. confirmed crash with gcc 7.3/mingw on abrok).

Better performance thus requires gcc >= 9 on hardware supporting avx2/avx512

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

No functional change

3 years agosimplying hybrid condition
jjoshua2 [Sun, 9 Aug 2020 20:16:04 +0000 (16:16 -0400)]
simplying hybrid condition

STC https://tests.stockfishchess.org/tests/view/5f3059d1908167206653736b:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 12520 W: 766 L: 727 D: 11027
Ptnml(0-2): 13, 624, 4949, 659, 15

LTC: https://tests.stockfishchess.org/tests/view/5f30863a90816720665373d1
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 12520 W: 766 L: 727 D: 11027
Ptnml(0-2): 13, 624, 4949, 659, 15

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

Bench: 4084753

3 years agoUpdate default net to nn-112bb1c8cdb5.nnue
Sergio Vieri [Mon, 10 Aug 2020 00:47:52 +0000 (08:47 +0800)]
Update default net to nn-112bb1c8cdb5.nnue

First trained net using search eval instead of pv leaf static eval.

Net created at: 20200810-0744

passed STC: https://tests.stockfishchess.org/tests/view/5f30995d90816720665373f8
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 15416 W: 2071 L: 1920 D: 11425
Ptnml(0-2): 123, 1376, 4563, 1519, 127

passed LTC: https://tests.stockfishchess.org/tests/view/5f30a104908167206653742b
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 29792 W: 2003 L: 1834 D: 25955
Ptnml(0-2): 50, 1541, 11550, 1700, 55

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

Bench: 4084753

3 years agoRevert "Avoid special casing for MinGW"
Joost VandeVondele [Mon, 10 Aug 2020 05:18:15 +0000 (07:18 +0200)]
Revert "Avoid special casing for MinGW"

This reverts commit a6e89293df5af35931b61d86b6de3872a981c100.

The offending setup has been found as gcc/mingw 7.3 (on Ubuntu 18.04).

fixes https://github.com/official-stockfish/Stockfish/issues/2963

closes https://github.com/official-stockfish/Stockfish/issues/2968

No functional change.

3 years agoFix a data race for NNUE
Joost VandeVondele [Sun, 9 Aug 2020 16:11:38 +0000 (18:11 +0200)]
Fix a data race for NNUE

the stateInfo at the rootPos is no longer read-only, as the NNUE accumulator is part of it.
Threads can thus not share this object and need their own copy.

tested for no regression
https://tests.stockfishchess.org/tests/view/5f3022239081672066536bce
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 52800 W: 6843 L: 6802 D: 39155
Ptnml(0-2): 336, 4646, 16399, 4679, 340

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

fixes https://github.com/official-stockfish/Stockfish/issues/2933

No functional change

3 years agoAvoid special casing for MinGW
Dariusz Orzechowski [Sun, 9 Aug 2020 21:32:24 +0000 (14:32 -0700)]
Avoid special casing for MinGW

after some testing, no version of MinGW/gcc has been found where this code is still necessary.
Probably older code (pre-c++17?)

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

No functional change

3 years agoAdjust NNUE usage based on number of pawns in position
Vizvezdenec [Sun, 9 Aug 2020 18:39:46 +0000 (21:39 +0300)]
Adjust NNUE usage based on number of pawns in position

The idea of this patch is that positions are usually more complex and hard to evaluate even if there are more pawns.
This patch adjusts NNUE threshold usage depending on number of pawns in position, if pawn count is <3 we use the
classical evaluation more often, for pawn count = 3 patch the is non-functional,
with pawn count > 3 NNUE evaluation is used more often.

passed STC
https://tests.stockfishchess.org/tests/view/5f2f02d09081672066536b1f
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 36520 W: 5011 L: 4823 D: 26686
Ptnml(0-2): 299, 3482, 10548, 3594, 337

passed LTC
https://tests.stockfishchess.org/tests/view/5f2f4c329081672066536b5c
LLR: 2.98 (-2.94,2.94) {0.25,1.75}
Total: 39272 W: 2630 L: 2433 D: 34209
Ptnml(0-2): 53, 2066, 15218, 2229, 70

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

bench 4084753

3 years agoFix aligned_alloc on MinGW
Joost VandeVondele [Sun, 9 Aug 2020 17:08:47 +0000 (19:08 +0200)]
Fix aligned_alloc on MinGW

introduced with d7a26899a973536ab9d3ce4771d8276d1a4dc55c

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

No functional change.

3 years agoImprove error message on missing net.
Joost VandeVondele [Sun, 9 Aug 2020 09:05:07 +0000 (11:05 +0200)]
Improve error message on missing net.

small rewording, but also print the download url for the default net.

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

No functional change

3 years agoUse fallback implementation for C++ aligned_alloc
Daniel Dugovic [Sat, 8 Aug 2020 20:39:29 +0000 (15:39 -0500)]
Use fallback implementation for C++ aligned_alloc

fixes https://github.com/official-stockfish/Stockfish/issues/2921

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

No functional change

3 years agoLMR search tweak
Unai Corzo [Sat, 8 Aug 2020 20:08:40 +0000 (22:08 +0200)]
LMR search tweak

All credit to Vizvezdenec, the original author of the idea.

STC https://tests.stockfishchess.org/tests/view/5f2d606a61e3b6af64881f88
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 8440 W: 1191 L: 1048 D: 6201
Ptnml(0-2): 59, 754, 2467, 865, 75

LTC https://tests.stockfishchess.org/tests/view/5f2d84ad61e3b6af64881fbd
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 21896 W: 1557 L: 1406 D: 18933
Ptnml(0-2): 33, 1185, 8378, 1302, 50

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

bench: 4084753

3 years agoSingular extension search tweak
Unai Corzo [Sat, 8 Aug 2020 20:03:37 +0000 (22:03 +0200)]
Singular extension search tweak

Tweak depth.

STC https://tests.stockfishchess.org/tests/view/5f2d22ec61e3b6af64881f40
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 17984 W: 2603 L: 2441 D: 12940
Ptnml(0-2): 133, 1751, 5094, 1849, 165

LTC https://tests.stockfishchess.org/tests/view/5f2d5a6a61e3b6af64881f7f
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 85808 W: 5956 L: 5621 D: 74231
Ptnml(0-2): 149, 4748, 32785, 5063, 159

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

fixes two README.md typos:
fixes https://github.com/official-stockfish/Stockfish/issues/2932

bench: 4022669

3 years agoParallelize Link Time Optimization for GCC, CLANG and MINGW
Guy Vreuls [Sat, 8 Aug 2020 10:45:10 +0000 (12:45 +0200)]
Parallelize Link Time Optimization for GCC, CLANG and MINGW

This patch tries to run multiple LTO threads in parallel, speeding up
the build process of optimized builds if the -j make parameter is used.
This mitigates the longer linking times of optimized builds since the
integration of the NNUE code. Roughly 2x build speedup.

I've tried a similar patch some two years ago but it ran into trouble
with old compiler versions then. Since we're on the C++17 standard now
these old compilers should be obsolete.

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

No functional change.

3 years agoDo more aggressive futility pruning for captures
Vizvezdenec [Sat, 8 Aug 2020 14:43:41 +0000 (17:43 +0300)]
Do more aggressive futility pruning for captures

This patch lines up with other patches which use better eval to produce more aggressive cutoffs based on static evaluation of position, it allows more aggressive futility pruning for captures - so now we will be producing them with bigger evaluation of position, so more often.

passed STC
https://tests.stockfishchess.org/tests/view/5f2da79e61e3b6af64881fd2
LLR: 3.87 (-2.94,2.94) {-0.50,1.50}
Total: 27256 W: 3809 L: 3593 D: 19854
Ptnml(0-2): 221, 2578, 7830, 2762, 237

passed LTC
https://tests.stockfishchess.org/tests/view/5f2df92061e3b6af64882012
LLR: 4.97 (-2.94,2.94) {0.25,1.75}
Total: 43624 W: 3095 L: 2820 D: 37709
Ptnml(0-2): 66, 2410, 16608, 2639, 89

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

Bench: 4272280

3 years agoupdate Null Move Pruning parameters
Moez Jellouli [Sat, 8 Aug 2020 10:35:34 +0000 (12:35 +0200)]
update Null Move Pruning parameters

STC: https://tests.stockfishchess.org/tests/view/5f2dc38561e3b6af64881fec
LLR: 2.99 (-2.94,2.94) {-0.50,1.50}
Total: 6120 W: 903 L: 758 D: 4459
Ptnml(0-2): 44, 535, 1775, 644, 62

LTC: https://tests.stockfishchess.org/tests/view/5f2dd55f61e3b6af64882003
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 7424 W: 577 L: 463 D: 6384
Ptnml(0-2): 16, 375, 2824, 473, 24

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

bench 4107833

3 years agoRemove unnecessay legality check
mckx00 [Sat, 8 Aug 2020 10:07:07 +0000 (03:07 -0700)]
Remove unnecessay legality check

Possible after the recent reording pos.legal(move) check

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

No functional change.

3 years agosimplified and increased threshold to switch between NNUE and classical
U-DESKTOP-3900\Mark [Fri, 7 Aug 2020 23:53:18 +0000 (19:53 -0400)]
simplified and increased threshold to switch between NNUE and classical

STC https://tests.stockfishchess.org/tests/view/5f2deb1661e3b6af6488200f
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 10376 W: 1481 L: 1359 D: 7536
Ptnml(0-2): 91, 953, 2981, 1069, 94

LTC: https://tests.stockfishchess.org/html/live_elo.html?5f2e0a0461e3b6af64882019
LLR: 2.99 (-2.94,2.94) {-1.50,0.50}
Total: 5040 W: 375 L: 315 D: 4350
Ptnml(0-2): 7, 263, 1926, 311, 13

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

Bench: 4067325

3 years agoDo more futility pruning for parent nodes.
Vizvezdenec [Sat, 8 Aug 2020 02:51:26 +0000 (05:51 +0300)]
Do more futility pruning for parent nodes.

This patch increases LMRdepth threshold for futility pruning at parent nodes so it can apply more often.
With radical change to evaluation approach it seems that search is really far from optimal state, especially it parts that use static evaluation of position.

passed STC
https://tests.stockfishchess.org/tests/view/5f2da75661e3b6af64881fd0
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 8744 W: 1305 L: 1156 D: 6283
Ptnml(0-2): 75, 789, 2500, 928, 80

passed LTC
https://tests.stockfishchess.org/tests/view/5f2dcb2a61e3b6af64881ff3
LLR: 2.98 (-2.94,2.94) {0.25,1.75}
Total: 17728 W: 1256 L: 1117 D: 15355
Ptnml(0-2): 22, 961, 6774, 1070, 37

Bench: 4067325

3 years agoReintroduce late irreversible move extension
SFisGOD [Fri, 7 Aug 2020 19:45:08 +0000 (03:45 +0800)]
Reintroduce late irreversible move extension

Reintroduce vondele's late irreversible move extension for fortress keeping.
This was removed when we only had classical eval.
Now that we have the NNUE net, it seems that this is useful again.

STC:
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 5352 W: 787 L: 653 D: 3912
Ptnml(0-2): 34, 451, 1579, 571, 41
https://tests.stockfishchess.org/tests/view/5f2dc8ad61e3b6af64881ff0

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 14416 W: 1013 L: 891 D: 12512
Ptnml(0-2): 15, 722, 5623, 822, 26
https://tests.stockfishchess.org/tests/view/5f2e0e3661e3b6af6488201e

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

Bench: 4154696

3 years agoExpand outposts to minors shielded by pawns
Lolligerhans [Fri, 7 Aug 2020 09:24:37 +0000 (11:24 +0200)]
Expand outposts to minors shielded by pawns

Allow any pawn in front of a minor piece to replace the pawn protection
requirement for outposts.

  +-------+  +-------+
  | . . o |  | o . . |    o  Their pawns
  | . o x |  | o . . |    x  Our pawns
  | o N . |  | x o B |  N,B  New (reachable) outpost
  | . . . |  | . _ . |    _  Reachable square behind a pawn
  +-------+  +-------+
  N outpost  B reaches
               outpost

  We want outposts to be secured by pawns against major pieces. If
a minor is shielded by any pawn from above, it is rarely at the same
time protected by our pawn attacks from below. However, the pawn shield
in itself offers some degree of protection.
  A pawn shield will now suffice to replace the pawn protection for the
outpost (and reachable outpost) bonus.

This effect stacks with the existing "minor behind pawn" bonus.

STC
https://tests.stockfishchess.org/tests/view/5f2bcd14b3ebe5cbfee85b2c
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 27248 W: 5353 L: 5119 D: 16776
Ptnml(0-2): 462, 3174, 6185, 3274, 529

LTC
https://tests.stockfishchess.org/tests/view/5f2bfef5b3ebe5cbfee85b5a
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 99432 W: 12580 L: 12130 D: 74722
Ptnml(0-2): 696, 8903, 30049, 9391, 677

Closes #2935

Bench: 4143673

3 years agoTweak futility pruning depth.
Unai Corzo [Sat, 8 Aug 2020 06:24:20 +0000 (08:24 +0200)]
Tweak futility pruning depth.

STC https://tests.stockfishchess.org/tests/view/5f2d237161e3b6af64881f43
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 12712 W: 1823 L: 1664 D: 9225
Ptnml(0-2): 122, 1166, 3627, 1313, 128

LTC https://tests.stockfishchess.org/tests/view/5f2d473061e3b6af64881f6f
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 12104 W: 912 L: 788 D: 10404
Ptnml(0-2): 13, 665, 4582, 769, 23

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

bench: 4271421

3 years agoUpdate default net to nn-9931db908a9b.nnue
Sergio Vieri [Fri, 7 Aug 2020 07:15:04 +0000 (15:15 +0800)]
Update default net to nn-9931db908a9b.nnue

Net created at 20200806-1802

passed STC:
https://tests.stockfishchess.org/tests/view/5f2d00b461e3b6af64881f21
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 6672 W: 1052 L: 898 D: 4722
Ptnml(0-2): 63, 600, 1868, 730, 75

passed LTC:
https://tests.stockfishchess.org/tests/view/5f2d052a61e3b6af64881f29
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 7576 W: 573 L: 463 D: 6540
Ptnml(0-2): 8, 392, 2889, 480, 19

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

Bench: 4390086

3 years agoDo move legality check before pruning.
Stefan Geschwentner [Wed, 5 Aug 2020 07:29:27 +0000 (09:29 +0200)]
Do move legality check before pruning.

This alllows to simplify the code because the move counter haven't to be
decremented later if a move isn't legal. As a side effect now illegal
pruned moves doesn't included anymore in move counter. So slightly less
pruning and reductions are done.

STC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 111016 W: 21106 L: 21077 D: 68833
Ptnml(0-2): 1830, 13083, 25736, 12946, 1913
https://tests.stockfishchess.org/tests/view/5f28816fa5abc164f05e4c26

LTC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 39264 W: 4909 L: 4843 D: 29512
Ptnml(0-2): 263, 3601, 11854, 3635, 279
https://tests.stockfishchess.org/tests/view/5f297902a5abc164f05e4c8e

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

Bench: 4390086

3 years agoRemove QueenInfiltration
UnaiCorzo [Tue, 4 Aug 2020 12:32:52 +0000 (14:32 +0200)]
Remove QueenInfiltration

STC https://tests.stockfishchess.org/tests/view/5f2955b1a5abc164f05e4c85
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 29216 W: 5560 L: 5416 D: 18240
Ptnml(0-2): 466, 3329, 6902, 3417, 494

LTC https://tests.stockfishchess.org/tests/view/5f299154a5abc164f05e4ca1
LLR: 2.92 (-2.94,2.94) {-1.50,0.50}
Total: 54144 W: 6635 L: 6594 D: 40915
Ptnml(0-2): 372, 4859, 16536, 4966, 339

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

Bench: 4609008

3 years agoTuned pawn values
FauziAkram [Fri, 7 Aug 2020 00:37:54 +0000 (17:37 -0700)]
Tuned pawn values

Passed STC:
https://tests.stockfishchess.org/tests/view/5f2aa49fa5abc164f05e4d1b
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 40888 W: 7977 L: 7726 D: 25185
Ptnml(0-2): 665, 4806, 9333, 4893, 747

Passed LTC:
https://tests.stockfishchess.org/tests/view/5f2b1059b3ebe5cbfee85ae7
LLR: 2.98 (-2.94,2.94) {0.25,1.75}
Total: 51264 W: 6445 L: 6134 D: 38685
Ptnml(0-2): 328, 4564, 15580, 4789, 371

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

bench: 4314943

3 years agoAdd tempo also to NNUE eval.
Stefan Geschwentner [Thu, 6 Aug 2020 23:08:15 +0000 (01:08 +0200)]
Add tempo also to NNUE eval.

STC:
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 10608 W: 1507 L: 1358 D: 7743
Ptnml(0-2): 94, 945, 3074, 1100, 91
https://tests.stockfishchess.org/tests/view/5f2c5921b3ebe5cbfee85b8b

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 7536 W: 556 L: 448 D: 6532
Ptnml(0-2): 9, 383, 2881, 481, 14
https://tests.stockfishchess.org/tests/view/5f2c6f4461e3b6af64881e95

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

Bench: 4746616

3 years agoNNUE evaluation threshold
MJZ1977 [Thu, 6 Aug 2020 15:39:10 +0000 (17:39 +0200)]
NNUE evaluation threshold

The idea is to use NNUE only on quite balanced material positions. This bring a big speedup on research since NNUE eval is slower than classical eval for most of the hardwares and specially on unbalanced positions with LazyEval.

STC: https://tests.stockfishchess.org/tests/view/5f2c2680b3ebe5cbfee85b61
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 3168 W: 560 L: 400 D: 2208
Ptnml(0-2): 21, 294, 819, 404, 46

LTC: https://tests.stockfishchess.org/tests/view/5f2c2ca6b3ebe5cbfee85b69
LLR: 2.98 (-2.94,2.94) {0.25,1.75}
Total: 3200 W: 287 L: 183 D: 2730
Ptnml(0-2): 4, 149, 1191, 251, 5

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

Bench 4746616

3 years agoAdd NNUE evaluation
nodchip [Wed, 5 Aug 2020 15:11:15 +0000 (17:11 +0200)]
Add NNUE evaluation

This patch ports the efficiently updatable neural network (NNUE) evaluation to Stockfish.

Both the NNUE and the classical evaluations are available, and can be used to
assign a value to a position that is later used in alpha-beta (PVS) search to find the
best move. The classical evaluation computes this value as a function of various chess
concepts, handcrafted by experts, tested and tuned using fishtest. The NNUE evaluation
computes this value with a neural network based on basic inputs. The network is optimized
and trained on the evalutions of millions of positions at moderate search depth.

The NNUE evaluation was first introduced in shogi, and ported to Stockfish afterward.
It can be evaluated efficiently on CPUs, and exploits the fact that only parts
of the neural network need to be updated after a typical chess move.
[The nodchip repository](https://github.com/nodchip/Stockfish) provides additional
tools to train and develop the NNUE networks.

This patch is the result of contributions of various authors, from various communities,
including: nodchip, ynasu87, yaneurao (initial port and NNUE authors), domschl, FireFather,
rqs, xXH4CKST3RXx, tttak, zz4032, joergoster, mstembera, nguyenpham, erbsenzaehler,
dorzechowski, and vondele.

This new evaluation needed various changes to fishtest and the corresponding infrastructure,
for which tomtor, ppigazzini, noobpwnftw, daylen, and vondele are gratefully acknowledged.

The first networks have been provided by gekkehenker and sergiovieri, with the latter
net (nn-97f742aaefcd.nnue) being the current default.

The evaluation function can be selected at run time with the `Use NNUE` (true/false) UCI option,
provided the `EvalFile` option points the the network file (depending on the GUI, with full path).

The performance of the NNUE evaluation relative to the classical evaluation depends somewhat on
the hardware, and is expected to improve quickly, but is currently on > 80 Elo on fishtest:

60000 @ 10+0.1 th 1
https://tests.stockfishchess.org/tests/view/5f28fe6ea5abc164f05e4c4c
ELO: 92.77 +-2.1 (95%) LOS: 100.0%
Total: 60000 W: 24193 L: 8543 D: 27264
Ptnml(0-2): 609, 3850, 9708, 10948, 4885

40000 @ 20+0.2 th 8
https://tests.stockfishchess.org/tests/view/5f290229a5abc164f05e4c58
ELO: 89.47 +-2.0 (95%) LOS: 100.0%
Total: 40000 W: 12756 L: 2677 D: 24567
Ptnml(0-2): 74, 1583, 8550, 7776, 2017

At the same time, the impact on the classical evaluation remains minimal, causing no significant
regression:

sprt @ 10+0.1 th 1
https://tests.stockfishchess.org/tests/view/5f2906a2a5abc164f05e4c5b
LLR: 2.94 (-2.94,2.94) {-6.00,-4.00}
Total: 34936 W: 6502 L: 6825 D: 21609
Ptnml(0-2): 571, 4082, 8434, 3861, 520

sprt @ 60+0.6 th 1
https://tests.stockfishchess.org/tests/view/5f2906cfa5abc164f05e4c5d
LLR: 2.93 (-2.94,2.94) {-6.00,-4.00}
Total: 10088 W: 1232 L: 1265 D: 7591
Ptnml(0-2): 49, 914, 3170, 843, 68

The needed networks can be found at https://tests.stockfishchess.org/nns
It is recommended to use the default one as indicated by the `EvalFile` UCI option.

Guidelines for testing new nets can be found at
https://github.com/glinscott/fishtest/wiki/Creating-my-first-test#nnue-net-tests

Integration has been discussed in various issues:
https://github.com/official-stockfish/Stockfish/issues/2823
https://github.com/official-stockfish/Stockfish/issues/2728

The integration branch will be closed after the merge:
https://github.com/official-stockfish/Stockfish/pull/2825
https://github.com/official-stockfish/Stockfish/tree/nnue-player-wip

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

This will be an exciting time for computer chess, looking forward to seeing the evolution of
this approach.

Bench: 4746616

3 years agoTweak cutnode reduction
Stefan Geschwentner [Thu, 30 Jul 2020 16:56:11 +0000 (18:56 +0200)]
Tweak cutnode reduction

Less reduction for second move at non-check CUT node with depth <= 10.

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 38680 W: 7490 L: 7245 D: 23945
Ptnml(0-2): 643, 4441, 8967, 4606, 683
https://tests.stockfishchess.org/tests/view/5f21e1782f7e63962b99f451

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 71976 W: 9003 L: 8636 D: 54337
Ptnml(0-2): 440, 6414, 21972, 6663, 499
https://tests.stockfishchess.org/tests/view/5f2245762f7e63962b99f4bd

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

Bench: 4746616

3 years agoImprove handling of queen imbalance
Stéphane Nicolet [Tue, 28 Jul 2020 08:08:09 +0000 (10:08 +0200)]
Improve handling of queen imbalance

We double the bonus for potential threats by minors and rooks against
our queen, in case of "queen vs pieces imbalance". Hopefully this will
improve a little bit the evaluation for this well-known Stockfish weakness.

passed STC:
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 72976 W: 14003 L: 13710 D: 45263
Ptnml(0-2): 1218, 8370, 17094, 8513, 1293
https://tests.stockfishchess.org/tests/view/5efa50eb020eec13834a977d

passed LTC:
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 22232 W: 2779 L: 2560 D: 16893
Ptnml(0-2): 129, 1885, 6896, 2050, 156
https://tests.stockfishchess.org/tests/view/5f1fdd2dc09435d870cb9f13

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

Bench: 4367349

3 years agoRemove late irreversible move extension
UnaiCorzo [Sat, 25 Jul 2020 20:30:05 +0000 (22:30 +0200)]
Remove late irreversible move extension

We simplify away the late irreversible move extension, which
does not seem to be necessary in the current master.

STC
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 38584 W: 7464 L: 7342 D: 23778
Ptnml(0-2): 581, 4328, 9365, 4424, 594
https://tests.stockfishchess.org/tests/view/5f1c9669c09435d870cb9de9

LTC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 27840 W: 3417 L: 3353 D: 21070
Ptnml(0-2): 120, 2315, 8994, 2363, 128
https://tests.stockfishchess.org/tests/view/5f1d2e22c09435d870cb9e21

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

bench: 4829420

3 years agoRemove conditional_more_than_two().
protonspring [Sat, 25 Jul 2020 13:32:19 +0000 (07:32 -0600)]
Remove conditional_more_than_two().

This is a functional simplification that removes the conditional_more_than_two()
function, which was quite strange and kooky. Note the very minor change to the bench
value.

See this thread for relevant comments on the passing branch:
protonspring/Stockfish@d89730d...ff35b50

STC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 59760 W: 11411 L: 11311 D: 37038
Ptnml(0-2): 992, 6863, 14044, 7015, 966
https://tests.stockfishchess.org/tests/view/5f179988c09435d870cb9b9a

LTC
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 45208 W: 5553 L: 5497 D: 34158
Ptnml(0-2): 315, 4081, 13761, 4127, 320
https://tests.stockfishchess.org/tests/view/5f184847c09435d870cb9bee

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

Bench: 4578290

3 years agoDo not overwrite valuable TT data after probcut.
Vizvezdenec [Mon, 13 Jul 2020 17:30:58 +0000 (20:30 +0300)]
Do not overwrite valuable TT data after probcut.

This patch allows an engine to write probcut data only in case
the probcut search depth is greater than transposition table depth.

passed STC
https://tests.stockfishchess.org/tests/view/5f0b52e959f6f035328949a6
LLR: 2.97 (-2.94,2.94) {-0.50,1.50}
Total: 52544 W: 10145 L: 9880 D: 32519
Ptnml(0-2): 853, 6097, 12121, 6334, 867

passed LTC
https://tests.stockfishchess.org/tests/view/5f0bd94c59f6f035328949f3
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 49576 W: 6164 L: 5863 D: 37549
Ptnml(0-2): 297, 4371, 15218, 4538, 364

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

bench 4578298

3 years agoMultiple lazy stages.
mstembera [Sun, 12 Jul 2020 20:58:00 +0000 (13:58 -0700)]
Multiple lazy stages.

An extension of the lazy eval idea: when the score is sufficiently large
we now skip more granular parts of the eval.

Inspired by an original patch by Moez Jellouli
https://tests.stockfishchess.org/tests/view/5f03b2a159f6f03532894529
Credit to him!

STC https://tests.stockfishchess.org/tests/view/5f0a862c59f6f03532894924
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 13504 W: 2684 L: 2472 D: 8348
Ptnml(0-2): 229, 1496, 3111, 1666, 250

LTC https://tests.stockfishchess.org/tests/view/5f0ac0e159f6f0353289495b
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 31312 W: 3926 L: 3677 D: 23709
Ptnml(0-2): 185, 2773, 9509, 2986, 203

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

bench: 4541608

3 years agoCorrects a functional change in a cleanup patch.
syzygy1 [Sat, 11 Jul 2020 14:25:34 +0000 (16:25 +0200)]
Corrects a functional change in a cleanup patch.

This corrects a functional change in
https://github.com/official-stockfish/Stockfish/commit/ddcbacd04d1c860e808202ce8c1206c8acdca627
changing evaluation of KPPvK. Bench remains unchanged at low depth

With this patch, 8/8/5k1p/8/7p/7K/8/8 b - - 1 11 is again correctly evaluated as a draw.

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

Bench: 4366686

3 years agoIntroduce bad outpost penalty
SFisGOD [Wed, 8 Jul 2020 02:09:32 +0000 (10:09 +0800)]
Introduce bad outpost penalty

In some French games, Stockfish likes to bring the Knight to a bad outpost spot. This is evident in TCEC S18 Superfinal Game 63, where there is a Knight outpost on the queenside but is actually useless. Stockfish is effectively playing a piece down while holding ground against Leela's break on the kingside.

This patch turns the +56 mg bonus for a Knight outpost into a -7 mg penalty if it satisfies the following conditions:

* The outpost square is not on the CenterFiles (i.e. not on files C,D,E and F)
* The knight is not attacking non pawn enemies.
* The side where the outpost is located contains only few enemies, with a particular conditional_more_than_two() implementation

Thank you to apospa...@gmail.com for bringing this to our attention and for providing insights.
See https://groups.google.com/forum/?fromgroups=#!topic/fishcooking/dEXNzSIBgZU
Reference game: https://tcec-chess.com/#div=sf&game=63&season=18

Passed STC:
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 6960 W: 1454 L: 1247 D: 4259
Ptnml(0-2): 115, 739, 1610, 856, 160
https://tests.stockfishchess.org/tests/view/5f08221059f6f0353289477e

Passed LTC:
LLR: 2.98 (-2.94,2.94) {0.25,1.75}
Total: 21440 W: 2767 L: 2543 D: 16130
Ptnml(0-2): 122, 1904, 6462, 2092, 140
https://tests.stockfishchess.org/tests/view/5f0838ed59f6f035328947a2

various related tests show strong test results, but so far no generalizations or simplifications of conditional_more_than_two() are found. See PR for details.

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

Bench: 4366686

3 years agoMaximize usage of transposition table in probcut
Vizvezdenec [Fri, 10 Jul 2020 21:06:55 +0000 (00:06 +0300)]
Maximize usage of transposition table in probcut

Probcut is a heuristic that wasn't changed a lot in past years,
all attempts to change it using information / writing info to transposition table failed.

This patch has a number of differences that can be summarized as follows:

* For TT write/read we use depth - 3. Because probcut search is depth - 4 but we actually do the move prior to it so effectively we do depth - 3 search;
* In any case of depth of eval from transposition table being >= depth - 3 we either produce cutoff or refuse to even do probcut search, this is allowing us to write info of probcut to transposition table because we know that we wouldn't be overwriting some deeper data with our depth - 3 search - this is an important aspect of this patch;
* For some not really known reason this patch completely ignores tte->bound() - which was the case for previous patch that made probcut interact with TT, maybe 2) is the reason, although it's unproven.

A first version of this patch passed STC and LTC

passed STC
https://tests.stockfishchess.org/tests/view/5f05908a59f6f03532894613
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 95776 W: 18300 L: 17973 D: 59503
Ptnml(0-2): 1646, 10944, 22377, 11279, 1642

passed LTC
https://tests.stockfishchess.org/tests/view/5f06b54059f6f035328946bb
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 57128 W: 7266 L: 6938 D: 42924
Ptnml(0-2): 372, 5163, 17217, 5389, 423

However, an additional bugfix was needed to avoid checking a condition on ttMove if was not available. This passed non-regression bounds on top of the first version:

at STC
https://tests.stockfishchess.org/tests/view/5f080e5059f6f03532894766
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 14096 W: 2800 L: 2628 D: 8668
Ptnml(0-2): 225, 1620, 3238, 1688, 277

at LTC
https://tests.stockfishchess.org/tests/view/5f0836a559f6f0353289479c
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 25352 W: 3228 L: 3139 D: 18985
Ptnml(0-2): 175, 2350, 7549, 2415, 187

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

Bench 4540940

3 years agoSmall cleanups
Joost VandeVondele [Thu, 9 Jul 2020 20:01:06 +0000 (22:01 +0200)]
Small cleanups

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

No functional change

3 years agoSimplify make_promotions()
mstembera [Sun, 5 Jul 2020 22:17:04 +0000 (15:17 -0700)]
Simplify make_promotions()

Remove special case handling of QUIET_CHECKS in make_promotions()

STC https://tests.stockfishchess.org/tests/view/5f055dbb59f6f035328945fb
LLR: 2.98 (-2.94,2.94) {-1.50,0.50}
Total: 42808 W: 8177 L: 8054 D: 26577
Ptnml(0-2): 665, 4890, 10201, 4953, 695

LTC https://tests.stockfishchess.org/tests/view/5f06231a59f6f03532894661
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 9616 W: 1214 L: 1111 D: 7291
Ptnml(0-2): 53, 821, 2965, 908, 61

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

Bench: 4576410

3 years agoConnected / blocked pawns simplification
FauziAkram [Tue, 7 Jul 2020 22:29:03 +0000 (01:29 +0300)]
Connected / blocked pawns simplification

There is no need to score blocked pawns at many places.
The idea originated from: Rocky
Tuning and testing by: Fauzi

Passed STC:
https://tests.stockfishchess.org/tests/view/5f04f8fd59f6f035328945d4
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 6352 W: 1299 L: 1118 D: 3935
Ptnml(0-2): 89, 695, 1469, 792, 131

Passed LTC:
https://tests.stockfishchess.org/tests/view/5f0527bd59f6f035328945e3
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 27648 W: 3517 L: 3433 D: 20698
Ptnml(0-2): 177, 2561, 8301, 2571, 214

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

Bench: 4734746

3 years agoClean-up en passant processing
Alain SAVARD [Tue, 7 Jul 2020 02:43:54 +0000 (22:43 -0400)]
Clean-up en passant processing

the goal of this PR is to better document how we process
the ep square (if any) given position fen command, and to
output more meaningful (and consistent) debug fen on the "d"
command. The implementation follows
https://en.wikipedia.org/wiki/X-FEN#Encoding_en-passant
following x-fen, it is "valid" to record ep even if ep would put king en prise.

fixes #2784

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

No functional change

3 years agoAdd a rank based bonus for blocked pawns.
Stefan Geschwentner [Mon, 6 Jul 2020 07:30:23 +0000 (09:30 +0200)]
Add a rank based bonus for blocked pawns.

Fix for overevaluated blocked pawns on the 5th and 6th rank.
This is a rewrite of the original idea that uses only two parameters.
Thanks to rocky640 for pointing this out.

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 50800 W: 9707 L: 9446 D: 31647
Ptnml(0-2): 831, 5851, 11822, 6018, 878
https://tests.stockfishchess.org/tests/view/5f00b4f359f6f03532894304

LTC:
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 52064 W: 6477 L: 6167 D: 39420
Ptnml(0-2): 331, 4628, 15834, 4878, 361
https://tests.stockfishchess.org/tests/view/5f0115fe59f6f03532894345

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

Bench: 4882833

3 years agodenormalize KRKP.
protonspring [Tue, 30 Jun 2020 16:17:50 +0000 (10:17 -0600)]
denormalize KRKP.

a non-functional code style change that denormalizes the KRKP endgame,
making it somewhat easier to read.

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

No functional change

3 years agoRemove passed pawn condition.
SFisGOD [Wed, 1 Jul 2020 16:11:23 +0000 (00:11 +0800)]
Remove passed pawn condition.

This will help scale down relatively high eval in drawish rook endgames with passed pawn like in TCEC S18 Superfinal Game 90.

Passed STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 50456 W: 9644 L: 9540 D: 31272
Ptnml(0-2): 760, 5637, 12332, 5737, 762
https://tests.stockfishchess.org/tests/view/5efcb76e59f6f035328940ed

Passed LTC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 77264 W: 9518 L: 9518 D: 58228
Ptnml(0-2): 402, 6766, 24321, 6716, 427
https://tests.stockfishchess.org/tests/view/5efd2ad759f6f03532894143

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

Bench: 4431626

3 years agoSet UCI_ShowWDL by default to false
Joost VandeVondele [Thu, 2 Jul 2020 16:58:37 +0000 (18:58 +0200)]
Set UCI_ShowWDL by default to false

UCI_ShowWDL might not be shown by GUIs that don't know the option,
but crash on the WDL output, effectively making it hard for users to
turn it off and run the engine. This sets it by default to false.

fixes https://github.com/official-stockfish/Stockfish/issues/2787

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

No functional change.

3 years agoUse arrays
Alain SAVARD [Wed, 1 Jul 2020 06:12:59 +0000 (02:12 -0400)]
Use arrays

for safe checks, outposts and king protectors in evaluate.cpp

Tested for non regression on the safe checks
https://tests.stockfishchess.org/tests/view/5ef8b75c020eec13834a9596
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 22256 W: 4283 L: 4143 D: 13830
Ptnml(0-2): 291, 2439, 5588, 2459, 351

Tested for non regression on the safe checks, outposts and king protectors
https://tests.stockfishchess.org/tests/view/5ef8e543020eec13834a95e7
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 28400 W: 5382 L: 5253 D: 17765
Ptnml(0-2): 394, 3078, 7119, 3223, 386

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

No functional change

3 years agoProvide WDL statistics
Joost VandeVondele [Sat, 27 Jun 2020 19:29:29 +0000 (21:29 +0200)]
Provide WDL statistics

A number of engines, GUIs and tournaments start to report WDL estimates
along or instead of scores. This patch enables reporting of those stats
in a more or less standard way (http://www.talkchess.com/forum3/viewtopic.php?t=72140)

The model this reporting uses is based on data derived from a few million fishtest LTC games,
given a score and a game ply, a win rate is provided that matches rather closely,
especially in the intermediate range [0.05, 0.95] that data. Some data is shown at
https://github.com/glinscott/fishtest/wiki/UsefulData#win-loss-draw-statistics-of-ltc-games-on-fishtest
Making the conversion game ply dependent is important for a good fit, and is in line
with experience that a +1 score in the early midgame is more likely a win than in the late endgame.

Even when enabled, the printing of the info causes no significant overhead.

Passed STC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 197112 W: 37226 L: 37347 D: 122539
Ptnml(0-2): 2591, 21025, 51464, 20866, 2610
https://tests.stockfishchess.org/tests/view/5ef79ef4f993893290cc146b

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

No functional change

3 years agoTweak single queen endgame scaling.
Stefan Geschwentner [Mon, 29 Jun 2020 17:35:24 +0000 (19:35 +0200)]
Tweak single queen endgame scaling.

Increase scaling factor for each minor of the opponent side of the queen.

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 14528 W: 2860 L: 2653 D: 9015
Ptnml(0-2): 217, 1632, 3408, 1741, 266
https://tests.stockfishchess.org/tests/view/5ef98384020eec13834a96a0

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 34584 W: 4371 L: 4111 D: 26102
Ptnml(0-2): 205, 3080, 10501, 3262, 244
https://tests.stockfishchess.org/tests/view/5ef99972020eec13834a96c9

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

Bench: 4523573

3 years agoScale down eval for queen imbalance
Stéphane Nicolet [Sun, 28 Jun 2020 20:24:57 +0000 (22:24 +0200)]
Scale down eval for queen imbalance

We lower the endgame value of the evaluation when we detect that there
is only one queen left on the board (more precisely, we use a scale
factor of 37/64, or about 0.58, for the endgame part of the evaluation).
Hopefully this helps a little bit for the assessment of positions with
queen imbalance, which are one of the well-known Stockfish weaknesses.

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 21600 W: 4176 L: 3955 D: 13469
Ptnml(0-2): 351, 2457, 5003, 2598, 391
https://tests.stockfishchess.org/tests/view/5ef871b6020eec13834a94e8

LTC:
LLR: 2.97 (-2.94,2.94) {0.25,1.75}
Total: 248328 W: 30596 L: 29720 D: 188012
Ptnml(0-2): 1544, 22345, 75665, 22911, 1699
https://tests.stockfishchess.org/tests/view/5ef87aec020eec13834a94fe

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

Bench: 4441323

3 years agoScale down eval for drawish rook endgames.
Stefan Geschwentner [Sun, 28 Jun 2020 14:28:55 +0000 (16:28 +0200)]
Scale down eval for drawish rook endgames.

STC:
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 82136 W: 15694 L: 15407 D: 51035
Ptnml(0-2): 1076, 8960, 20767, 9131, 1134
https://tests.stockfishchess.org/tests/view/5ef86cf8020eec13834a94dd

LTC:
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 70200 W: 8787 L: 8440 D: 52973
Ptnml(0-2): 325, 5983, 22170, 6264, 358
https://tests.stockfishchess.org/tests/view/5ef88225020eec13834a950a

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

Bench: 4478869

3 years agoIncrease value of pawns on fifth rank
Stéphane Nicolet [Sun, 28 Jun 2020 04:00:28 +0000 (06:00 +0200)]
Increase value of pawns on fifth rank

This patch increases the endgame value of pawns on the fifth rank.
The increase is very small (+1 evaluation point, about 0.005 pawn)
for the pawns on external columns (a-b-c-f-g-h) and a bit bigger
(+7 evaluation points, about 0.033 pawn) for the pawns on d5/e5.

STC:
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 79864 W: 15331 L: 15027 D: 49506
Ptnml(0-2): 1336, 9284, 18433, 9498, 1381
https://tests.stockfishchess.org/tests/view/5ef73e2ef993893290cc0c47

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 47240 W: 5927 L: 5630 D: 35683
Ptnml(0-2): 320, 4133, 14440, 4384, 343
https://tests.stockfishchess.org/tests/view/5ef7c0c4f993893290cc14b7

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

Bench: 4794633

3 years agoRemove old zobrist trick for castling rights
mstembera [Fri, 26 Jun 2020 05:08:17 +0000 (22:08 -0700)]
Remove old zobrist trick for castling rights

Removes an 8 year old micro optimization aimed at 32-bit architectures
because back then doing an xor of a Key could not be done in one instruction.
See original commit here 821e1c7

STC https://tests.stockfishchess.org/tests/view/5ef5833dde213bf647527d0c
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 162648 W: 31053 L: 31097 D: 100498
Ptnml(0-2): 2841, 18966, 37715, 19000, 2802

LTC https://tests.stockfishchess.org/tests/view/5ef7b1bbf993893290cc1489
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 62360 W: 7617 L: 7586 D: 47157
Ptnml(0-2): 423, 5662, 18994, 5663, 438

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

bench: 4591425

3 years agoFix fragile code to use proper random 64 bit keys.
mstembera [Sat, 27 Jun 2020 00:26:46 +0000 (17:26 -0700)]
Fix fragile code to use proper random 64 bit keys.

This fixes an old issue where we want to make a position unique but only
change a small number of bits in the key instead of all 64 of them randomly.
This is fragile and can lead to non uniqueness issues in the TT.

Key make_key(uint64_t seed) takes any integer and produces a unique random 64 bit key.
It is computationally efficient and is based on a congruential pseudo random number
generator using well tested constants by Donald Knuth
(see https://en.wikipedia.org/wiki/Linear_congruential_generator)

STC https://tests.stockfishchess.org/tests/view/5ef6c78f761b685b4c724bb6
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 154320 W: 29343 L: 29376 D: 95601
Ptnml(0-2): 2543, 18170, 35891, 17889, 2667

LTC https://tests.stockfishchess.org/tests/view/5ef7d1a9020eec13834a940e
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 53488 W: 6629 L: 6584 D: 40275
Ptnml(0-2): 372, 4878, 16183, 4955, 356

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

bench: 4626776

3 years agoRevert LTO for mingw on windows.
Joost VandeVondele [Sat, 27 Jun 2020 06:23:46 +0000 (08:23 +0200)]
Revert LTO for mingw on windows.

LTO with static linking is still only working with the latest versions of gcc,
causing problems for some devs.

on a modern mingw toolchain LTO optimizations can still be enabled as:

```
CXXFLAGS='-flto' make -j ARCH=x86-64-modern COMP=mingw profile-build
```

fixes https://github.com/official-stockfish/Stockfish/issues/2769

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

No functional change.

3 years agosupport popcnt on armv8
Niklas Fiekas [Thu, 25 Jun 2020 10:42:25 +0000 (12:42 +0200)]
support popcnt on armv8

* Supports popcnt (thanks @daylen)
* bits = 64 is now the default

Tested with g++ (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 on ThunderX CN8890,
yields about 9% speedup.

Also tested with clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final).

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

No functional change.

3 years agoSimplify use_time_management() and allow composing
Niklas Fiekas [Wed, 24 Jun 2020 21:03:00 +0000 (23:03 +0200)]
Simplify use_time_management() and allow composing

like other `go` commands wtime/btime can now be composed.

`go depth 10 wtime 100`

will let the engine use standard time management but stop if depth 10 is reached.

fixes https://github.com/official-stockfish/Stockfish/issues/2767

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

No functional change

3 years agoSmall cleanups
Joost VandeVondele [Wed, 24 Jun 2020 20:19:58 +0000 (22:19 +0200)]
Small cleanups

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

No functional change

3 years agoMakefile: support lto on mingw, default to 64bits
UnaiCorzo [Tue, 23 Jun 2020 15:56:38 +0000 (17:56 +0200)]
Makefile: support lto on mingw, default to 64bits

Clean and organize uppercase and spaces

fixes https://github.com/official-stockfish/Stockfish/issues/2731

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

No functional change

3 years agoRemove 'Minimum Thinking Time' UCI option.
Joost VandeVondele [Wed, 24 Jun 2020 14:23:31 +0000 (16:23 +0200)]
Remove 'Minimum Thinking Time' UCI option.

the option was, since at least 2014, not correctly implemented,
ignoring all dynamic adjustments to optimum time in search.
Instead of fixing it, remove it, no need to expose an option that
will influence time management negatively.

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

No functional change.

3 years agoSupport ARCH=armv8 in Makefile (#2355)
Niklas Fiekas [Tue, 23 Jun 2020 08:41:53 +0000 (10:41 +0200)]
Support ARCH=armv8 in Makefile (#2355)

Tested with bench run after compiling with

- g++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
- clang version 3.8.1-24

on ThunderX CN8890.

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

fixes https://github.com/official-stockfish/Stockfish/issues/2355

No functional change.

3 years agoDo less futility pruning for captures.
Vizvezdenec [Tue, 23 Jun 2020 11:55:52 +0000 (14:55 +0300)]
Do less futility pruning for captures.

The idea of this patch is that if capture can be described as
"less valuable piece takes more valuable piece" it's not really correct
to add only piece value of captured piece to static evaluation
since there can be more threats in other places and opponent can't really
do much but recapture our capturing piece which leaves us space for
more captures thus winning more material and increasing static eval.

passed STC
https://tests.stockfishchess.org/tests/view/5ef0167b122d6514328d760f
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 24736 W: 4838 L: 4607 D: 15291
Ptnml(0-2): 438, 2812, 5648, 3021, 449

passed LTC
https://tests.stockfishchess.org/tests/view/5ef073bc122d6514328d7693
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 46152 W: 5865 L: 5567 D: 34720
Ptnml(0-2): 312, 4160, 13886, 4354, 364

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

bench 4789930

3 years agoIntroduce bonus for queen infiltration
FauziAkram [Mon, 22 Jun 2020 09:52:31 +0000 (12:52 +0300)]
Introduce bonus for queen infiltration

Idea is that queen feels much better when it can't be kicked away now
or later by pawn moves, especially in endgame. Special thanks to
Linmiao Xu for the original idea of this patch.

passed STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 84008 W: 16271 L: 15958 D: 51779
Ptnml(0-2): 1476, 9688, 19420, 9887, 1533
https://tests.stockfishchess.org/tests/view/5eee7ca0447c5b640047a439

passed LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 11720 W: 1522 L: 1328 D: 8870
Ptnml(0-2): 52, 1021, 3574, 1107, 106
https://tests.stockfishchess.org/tests/view/5eefc588122d6514328d75f9

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

Bench: 4471740

3 years agoMake endgames consistent
protonspring [Wed, 17 Jun 2020 21:15:54 +0000 (15:15 -0600)]
Make endgames consistent

Changes variable names and occasionally consolidated variable declarations.
Piece squares are consistently prefixed with "weak" or "strong."

passed STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 29008 W: 5532 L: 5416 D: 18060
Ptnml(0-2): 355, 2983, 7723, 3077, 366
https://tests.stockfishchess.org/tests/view/5eea88d3563bc7aa75600689

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

No functional change

3 years agosmall cleanups
Joost VandeVondele [Sun, 21 Jun 2020 13:21:46 +0000 (15:21 +0200)]
small cleanups

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

No functional change

3 years agoMore reduction for evading pawn moves.
Vizvezdenec [Wed, 17 Jun 2020 02:36:30 +0000 (05:36 +0300)]
More reduction for evading pawn moves.

pawn moves are irreversable unlike other evading moves; pawn is the least valuable piece in the game.
So it makes a lot of sence to assume that evading pawn moves are on average not as good as other evading moves thus can be reduced more.

Passed STC
https://tests.stockfishchess.org/tests/view/5ee9602e563bc7aa756002dc
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 94176 W: 17993 L: 17668 D: 58515
Ptnml(0-2): 1634, 10742, 21989, 11111, 1612

Passed LTC
https://tests.stockfishchess.org/tests/view/5ee97342563bc7aa75600301
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 20432 W: 2572 L: 2354 D: 15506
Ptnml(0-2): 146, 1707, 6280, 1949, 134

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

Bench: 5073064

3 years agoSmall bonus to favor thorn pawns
Stéphane Nicolet [Tue, 16 Jun 2020 11:21:24 +0000 (13:21 +0200)]
Small bonus to favor thorn pawns

We increase a little bit the midgame value of pawns on a4, h4, a6 and h6.

Original idea by Malcolm Campbell, who tried the version restricted to the
pawns on the H column a couple of weeks ago and got a patch which almost
passed LTC. The current pull request just adds the same idea for pawns on
the A column.

Possible follow-ups: maybe tweak the a5/h5 pawn values, and/or add a malus
for very low king mobility in midgame?

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 33416 W: 6516 L: 6275 D: 20625
Ptnml(0-2): 575, 3847, 7659, 4016, 611
https://tests.stockfishchess.org/tests/view/5ee6c4e687586124bc2c10d4

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 134368 W: 16869 L: 16319 D: 101180
Ptnml(0-2): 908, 12083, 40708, 12521, 964
https://tests.stockfishchess.org/tests/view/5ee74e60aae8aec816ab756a

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

Bench: 5299456

3 years agoUse 128 bit multiply for TT index
mstembera [Mon, 15 Jun 2020 06:35:07 +0000 (23:35 -0700)]
Use 128 bit multiply for TT index

Remove super cluster stuff from TT and just use a 128 bit multiply.

STC https://tests.stockfishchess.org/tests/view/5ee719b3aae8aec816ab7548
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 12736 W: 2502 L: 2333 D: 7901
Ptnml(0-2): 191, 1452, 2944, 1559, 222

LTC https://tests.stockfishchess.org/tests/view/5ee732d1aae8aec816ab7556
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 27584 W: 3431 L: 3350 D: 20803
Ptnml(0-2): 173, 2500, 8400, 2511, 208

Scheme back to being derived from https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/

Also the default optimized version of the index calculation now uses fewer instructions.
https://godbolt.org/z/Tktxbv
Might benefit from mulx (requires -mbmi2)

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

bench: 4320954

3 years agoRetuned values after eval quantize patch.
xoto10 [Sun, 14 Jun 2020 20:50:27 +0000 (21:50 +0100)]
Retuned values after eval quantize patch.

The last search tune patch was tested before the implementation of #2733 which
presumably changed the search characteristics noticeably. Another tuning run was
done, see https://tests.stockfishchess.org/tests/view/5ee5b434ca6c451633a9a08c
and the updated values passed these tests:

STC:
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 34352 W: 6600 L: 6360 D: 21392
Ptnml(0-2): 581, 3947, 7914, 4119, 615
https://tests.stockfishchess.org/tests/view/5ee62f05ca6c451633a9a15f

LTC 60+0.6 th 1 :
LLR: 2.97 (-2.94,2.94) {0.25,1.75}
Total: 11176 W: 1499 L: 1304 D: 8373
Ptnml(0-2): 69, 933, 3403, 1100, 83
https://tests.stockfishchess.org/tests/view/5ee6205bca6c451633a9a147

SMP LTC 20+0.2 th 8 :
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 54032 W: 6126 L: 5826 D: 42080
Ptnml(0-2): 278, 4454, 17280, 4698, 306
https://tests.stockfishchess.org/tests/view/5ee62f25ca6c451633a9a162

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

Bench 4957812

3 years agoTuned values for search constants
xoto10 [Sat, 13 Jun 2020 08:54:07 +0000 (09:54 +0100)]
Tuned values for search constants

Tuned search constants after many search patches since the last
successful tune.

1st LTC @ 60+0.6 th 1 :
LLR: 2.97 (-2.94,2.94) {0.25,1.75}
Total: 57656 W: 7369 L: 7036 D: 43251
Ptnml(0-2): 393, 5214, 17336, 5437, 448
https://tests.stockfishchess.org/tests/view/5ee1e074f29b40b0fc95af19

SMP LTC @ 20+0.2 th 8 :
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 83576 W: 9731 L: 9341 D: 64504
Ptnml(0-2): 464, 7062, 26369, 7406, 487
https://tests.stockfishchess.org/tests/view/5ee35a21f29b40b0fc95b008

The changes were rebased on top of a successful patch by Viz (see #2734)
and two different ways of doing this were tested. The successful test
modified the constants in the patch by Viz in a similar manner to the
tuning run:

LTC (rebased) @ 60+0.6 th 1 :
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 193384 W: 24241 L: 23521 D: 145622
Ptnml(0-2): 1309, 17497, 58472, 17993, 1421
https://tests.stockfishchess.org/tests/view/5ee43319ca6c451633a995f9

Further work: the recent patch to quantize eval #2733 affects search quit
quite a bit, so doing another tune in, say, three months time might be a
good idea.

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

Bench 4246971

3 years agoQuantize eval to multiples of 16
Joost VandeVondele [Wed, 10 Jun 2020 11:19:21 +0000 (13:19 +0200)]
Quantize eval to multiples of 16

Removes some excess precision, helps searchs.

Effectively reintroduces evaluation grain, with a slightly different context.
https://github.com/official-stockfish/Stockfish/commit/45dbd9cd0303d0db469670af8ec3598731a4eace

passed STC
LLR: 2.97 (-2.94,2.94) {-0.50,1.50}
Total: 197032 W: 37938 L: 37462 D: 121632
Ptnml(0-2): 3359, 22994, 45446, 23246, 3471
https://tests.stockfishchess.org/tests/view/5ee0c228f29b40b0fc95ae53

passed LTC
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 77696 W: 9970 L: 9581 D: 58145
Ptnml(0-2): 530, 7075, 23311, 7340, 592
https://tests.stockfishchess.org/tests/view/5ee21426f29b40b0fc95af43

passed LTC SMP
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 64136 W: 7425 L: 7091 D: 49620
Ptnml(0-2): 345, 5416, 20228, 5718, 361
https://tests.stockfishchess.org/tests/view/5ee387bbf29b40b0fc95b04c

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

Bench: 4939103

3 years agoAdjust history threshold for quiet moves futility pruning
Vizvezdenec [Sat, 13 Jun 2020 02:03:59 +0000 (05:03 +0300)]
Adjust history threshold for quiet moves futility pruning

This patch adjusts the threshold for futility pruning of quiet moves
using the continuation history array contHist[5], in the same way as
it is used in movepicker.

passed STC:
https://tests.stockfishchess.org/tests/view/5ee3f88bca6c451633a9959f
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 55984 W: 10822 L: 10552 D: 34610
Ptnml(0-2): 952, 6435, 12941, 6719, 945

passed LTC:
https://tests.stockfishchess.org/tests/view/5ee4186dca6c451633a995cf
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 41712 W: 5402 L: 5114 D: 31196
Ptnml(0-2): 293, 3766, 12469, 4016, 312

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

Bench: 4715960

3 years agoImprove the anti-shuffling policy
Stéphane Nicolet [Tue, 9 Jun 2020 22:10:07 +0000 (00:10 +0200)]
Improve the anti-shuffling policy

We replace the current decrease of the complexity term in initiative
when shuffling by a direct damping of the evaluation. This scheme may
have two benefits over the initiative approach:

a) the damping effect is more brutal for fortresses with heavy pieces
   on the board, because the initiative term is almost an endgame term;

b) the initiative implementation had a funny side effect, almost a bug,
   in the rare positions where mg > 0, eg < 0 and the tampered eval
   returned a positive value (ie with heavy pieces still on the board):
   sending eg to zero via shuffling would **increase** the tampered
   eval instead of decreasing it, which is somewhat illogical. This
   patch avoids this phenomenon.

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 43072 W: 8373 L: 8121 D: 26578
Ptnml(0-2): 729, 4954, 9940, 5162, 751
https://tests.stockfishchess.org/tests/view/5ee008ebf29b40b0fc95ade2

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 37376 W: 4816 L: 4543 D: 28017
Ptnml(0-2): 259, 3329, 11286, 3508, 306
https://tests.stockfishchess.org/tests/view/5ee03b06f29b40b0fc95ae0c

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

Bench: 4757174

3 years agoIncrease the maximum hash size by a factor of 256
Sami Kiminki [Fri, 5 Jun 2020 17:17:00 +0000 (20:17 +0300)]
Increase the maximum hash size by a factor of 256

Conceptually group hash clusters into super clusters of 256 clusters.
This scheme allows us to use hash sizes up to 32 TB
(= 2^32 super clusters = 2^40 clusters).

Use 48 bits of the Zobrist key to choose the cluster index. We use 8
extra bits to mitigate the quantization error for very large hashes when
scaling the hash key to cluster index.

The hash index computation is organized to be compatible with the existing
scheme for power-of-two hash sizes up to 128 GB.

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

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

Passed non-regression STC:
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 37976 W: 7336 L: 7211 D: 23429
Ptnml(0-2): 578, 4295, 9149, 4356, 610
https://tests.stockfishchess.org/tests/view/5edcbaaef29b40b0fc95abc5

No functional change.

3 years agoImprove Readme.md about compiling
nguyenpham [Sun, 7 Jun 2020 22:49:27 +0000 (08:49 +1000)]
Improve Readme.md about compiling

Reparagraph, add an example how to compile on Unix-like systems

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

No functional change

3 years agoshow coordinates when displaying board
NguyenPham [Sun, 7 Jun 2020 21:48:38 +0000 (07:48 +1000)]
show coordinates when displaying board

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

No functional change

3 years agoRefactor some threads related code.
protonspring [Mon, 1 Jun 2020 05:31:14 +0000 (23:31 -0600)]
Refactor some threads related code.

This is a code style change that moves some pure thread code into the threads class.

It is a bit more code, but it makes search.cpp cleaner and easier to read by hiding some thread specific functionality.

STC (SMP)
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 75896 W: 12073 L: 12026 D: 51797
Ptnml(0-2): 828, 8224, 19872, 8121, 903
https://tests.stockfishchess.org/tests/view/5ed492e8f29b40b0fc95a74c

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

No functional change.

3 years agoWrap all access to LineBB and add assert
protonspring [Sun, 7 Jun 2020 03:25:32 +0000 (21:25 -0600)]
Wrap all access to LineBB and add assert

This is a non-functional code style change which provides a safe access handler for LineBB.
Also includes an assert in debug mode to verify square correctness.

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

No functional change

3 years agojoin scale_factor, initiative and mg+eg reduction
xoto10 [Wed, 3 Jun 2020 10:05:58 +0000 (11:05 +0100)]
join scale_factor, initiative and mg+eg reduction

Merging this code into one function `winnable()`.
Should allow common concepts used to adjust the eg value,
either by addition or scaling, to be combined more effectively.

Improve trace function.

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

No functional change.

3 years agoUse lowply-history also on low depths
pb00067 [Sat, 6 Jun 2020 10:56:38 +0000 (12:56 +0200)]
Use lowply-history also on low depths

STC:
https://tests.stockfishchess.org/tests/view/5ed75078f29b40b0fc95a8b9
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 73928 W: 14301 L: 14005 D: 45622
Ptnml(0-2): 1243, 8572, 17096, 8752, 1301

LTC:
https://tests.stockfishchess.org/tests/view/5ed895e0f29b40b0fc95a976
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 154848 W: 19684 L: 19074 D: 116090
Ptnml(0-2): 1048, 14108, 46627, 14468, 1173

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

bench: 4582693

3 years agosmall speed-up in movegen
protonspring [Thu, 4 Jun 2020 00:06:49 +0000 (18:06 -0600)]
small speed-up in movegen

pass color as a template parameter.

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

No functional change.

3 years agoMinimal thinking time, even if only one rootMove.
Moez Jellouli [Sun, 31 May 2020 14:51:38 +0000 (16:51 +0200)]
Minimal thinking time, even if only one rootMove.

without search, the eval returned can be misleading (e.g. mate instead of draw),
leading to wrong adjudication. With a minimal search, this is avoided.
This patch leads to 1ms long searches if there is only 1 move,
similar patches all indicate a small Elo gain.

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

Passed non-regression STC:
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 22312 W: 4350 L: 4204 D: 13758
Ptnml(0-2): 323, 2488, 5437, 2536, 372
https://tests.stockfishchess.org/tests/view/5ed562b0f29b40b0fc95a7d0

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

Bench: 4733799

3 years agoSingular quiet LMR
Moez Jellouli [Tue, 2 Jun 2020 20:27:11 +0000 (22:27 +0200)]
Singular quiet LMR

If ttMove is a capture and had a singular extension, it is probably the best move.
No need to make a decrease of LMR on other moves.

STC
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 41968 W: 8170 L: 7918 D: 25880
Ptnml(0-2): 733, 4770, 9726, 5022, 733
https://tests.stockfishchess.org/tests/view/5ed6b666f29b40b0fc95a884

LTC
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 71376 W: 9200 L: 8827 D: 53349
Ptnml(0-2): 486, 6544, 21342, 6743, 573
https://tests.stockfishchess.org/tests/view/5ed7578bf29b40b0fc95a8c9

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

Bench: 4733799

3 years agoGive bonus for bishops that are alligned with enemy kingring.
Stefan Geschwentner [Sun, 31 May 2020 15:00:47 +0000 (17:00 +0200)]
Give bonus for bishops that are alligned with enemy kingring.

Inspired by the succesful patch "Give bonus for rooks that are alligned with enemy kingring" from Vizvezdenec,
this idea has been reused for bishops. Here, we only consider attacks that are not blocked by any pawn.
Also we have a 50% higher bonus than for the rooks.

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 68960 W: 13495 L: 13202 D: 42263
Ptnml(0-2): 1213, 8018, 15802, 8157, 1290
https://tests.stockfishchess.org/tests/view/5ed27495042fa6d77c3553aa

LTC:
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 54560 W: 7105 L: 6780 D: 40675
Ptnml(0-2): 379, 4986, 16254, 5253, 408
https://tests.stockfishchess.org/tests/view/5ed30375596e6dc1e1f97425

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

Bench: 4860021

3 years agoIsolated pawns tweak
ElbertoOne [Sun, 31 May 2020 14:39:03 +0000 (16:39 +0200)]
Isolated pawns tweak

Give opposed doubled isolated pawns only the Doubled penalty.
The other isolated pawns get the Isolated penalty and the WeakUnopposed penalty.
The popcount condition has been replaced with an opposed check,
which is non-functional, but probably gives a speed-up.

Passed STC (https://tests.stockfishchess.org/tests/view/5ed0f0f0042fa6d77c3552f5):
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 121832 W: 23562 L: 23195 D: 75075
Ptnml(0-2): 2092, 14064, 28313, 14279, 2168

LTC: (https://tests.stockfishchess.org/tests/view/5ed22e40042fa6d77c355387)
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 103368 W: 13232 L: 12768 D: 77368
Ptnml(0-2): 693, 9484, 30919, 9842, 746

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

Bench: 4085694

3 years agoLess pruning in draw PV lines.
Joost VandeVondele [Thu, 28 May 2020 20:34:43 +0000 (22:34 +0200)]
Less pruning in draw PV lines.

no futility pruning for certain captures if the PvNode has a draw eval.

passed STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 59392 W: 11576 L: 11302 D: 36514
Ptnml(0-2): 977, 6816, 13920, 6922, 1061
https://tests.stockfishchess.org/tests/view/5ed0b1bb042fa6d77c355295

passed LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 64040 W: 8273 L: 7923 D: 47844
Ptnml(0-2): 424, 5842, 19220, 6028, 506
https://tests.stockfishchess.org/tests/view/5ed145e0042fa6d77c35531c

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

Bench: 4704615