1
0
Fork 0
Commit Graph

5027 Commits (406979ea12ee7828e079871b0f9f3dc8f127a741)

Author SHA1 Message Date
Stéphane Nicolet 406979ea12 Embed default net, and simplify using non-default nets
covers the most important cases from the user perspective:

It embeds the default net in the binary, so a download of that binary will result
in a working engine with the default net. The engine will be functional in the default mode
without any additional user action.

It allows non-default nets to be used, which will be looked for in up to
three directories (working directory, location of the binary, and optionally a specific default directory).
This mechanism is also kept for those developers that use MSVC,
the one compiler that doesn't have an easy mechanism for embedding data.

It is possible to disable embedding, and instead specify a specific directory, e.g. linux distros might want to use
CXXFLAGS="-DNNUE_EMBEDDING_OFF -DDEFAULT_NNUE_DIRECTORY=/usr/share/games/stockfish/" make -j ARCH=x86-64 profile-build

passed STC non-regression:
https://tests.stockfishchess.org/tests/view/5f4a581c150f0aef5f8ae03a
LLR: 2.95 (-2.94,2.94) {-1.25,-0.25}
Total: 66928 W: 7202 L: 7147 D: 52579
Ptnml(0-2): 291, 5309, 22211, 5360, 293

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

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

No functional change.
2020-08-29 21:56:00 +02:00
VoyagerOne 242a7d9fea Simplify MCP in QS
Simplify moveCount pruning in QS by removing depth dependency.

STC
LLR: 2.94 (-2.94,2.94) {-1.25,0.25}
Total: 42960 W: 4741 L: 4661 D: 33558
Ptnml(0-2): 218, 3574, 13804, 3678, 206
https://tests.stockfishchess.org/tests/view/5f42e3f75089a564a10d8493

LTC
LLR: 2.94 (-2.94,2.94) {-0.75,0.25}
Total: 66672 W: 3563 L: 3508 D: 59601
Ptnml(0-2): 71, 3064, 26996, 3149, 56
https://tests.stockfishchess.org/tests/view/5f4353285089a564a10d84d0

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

Bench: 4074430
2020-08-26 07:19:35 +02:00
VoyagerOne 95b8f3f800 Remove Reduce Depth
Remove Reduce Depth at PV nodes.

STC:
LLR: 2.94 (-2.94,2.94) {-1.25,0.25}
Total: 56760 W: 6299 L: 6236 D: 44225
Ptnml(0-2): 286, 4843, 18076, 4872, 303
https://tests.stockfishchess.org/tests/view/5f41356087a5c3c63d8f53c9

LTC:
LLR: 2.95 (-2.94,2.94) {-0.75,0.25}
Total: 17496 W: 954 L: 865 D: 15677
Ptnml(0-2): 13, 768, 7098, 855, 14
https://tests.stockfishchess.org/tests/view/5f41bb7687a5c3c63d8f53f9

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

Bench: 3555051
2020-08-26 07:16:50 +02:00
syzygy1 9b4967071e Remove EvalList
This patch removes the EvalList structure from the Position object and generally simplifies the interface between do_move() and the NNUE code.

The NNUE evaluation function first calculates the "accumulator". The accumulator consists of two halves: one for white's perspective, one for black's perspective.

If the "friendly king" has moved or the accumulator for the parent position is not available, the accumulator for this half has to be calculated from scratch. To do this, the NNUE node needs to know the positions and types of all non-king pieces and the position of the friendly king. This information can easily be obtained from the Position object.

If the "friendly king" has not moved, its half of the accumulator can be calculated by incrementally updating the accumulator for the previous position. For this, the NNUE code needs to know which pieces have been added to which squares and which pieces have been removed from which squares. In principle this information can be derived from the Position object and StateInfo struct (in the same way as undo_move() does this). However, it is probably a bit faster to prepare this information in do_move(), so I have kept the DirtyPiece struct. Since the DirtyPiece struct now stores the squares rather than "PieceSquare" indices, there are now at most three "dirty pieces" (previously two). A promotion move that captures a piece removes the capturing pawn and the captured piece from the board (to SQ_NONE) and moves the promoted piece to the promotion square (from SQ_NONE).

An STC test has confirmed a small speedup:

https://tests.stockfishchess.org/tests/view/5f43f06b5089a564a10d850a
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 87704 W: 9763 L: 9500 D: 68441
Ptnml(0-2): 426, 6950, 28845, 7197, 434

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

No functional change
2020-08-26 07:11:26 +02:00
Joost VandeVondele b0b4ca17db Check ARCH=.... variable
to prevent user errors or generating untested code,
check explicitly that the ARCH variable is equivalent to a supported architecture
as listed in `make help`.

To nevertheless compile for an untested target the user can override the internal
variable, passing the undocumented `SUPPORTED_ARCH=true` to make.

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

No functional change.
2020-08-26 07:07:06 +02:00
mstembera 530fccbf27 Allow for VNNI256 compilation with g++-8
explicitly pass needed -mavx512f -mavx512bw flags

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

No functional change
2020-08-24 12:43:39 +02:00
Vizvezdenec 843a961a8c Introduce countermove based pruning for qsearch
This patch continues work of previous patch in introducing pruning heuristics in qsearch by analogy to main search, now with countermove based pruning.
Idea is that if move is late enough and is quite check (we do generate them in qsearch) and has bad enough countermove history - prune it.

passed STC
https://tests.stockfishchess.org/tests/view/5f41220287a5c3c63d8f53c5
LLR: 2.93 (-2.94,2.94) {-0.25,1.25}
Total: 35944 W: 4127 L: 3929 D: 27888
Ptnml(0-2): 196, 2970, 11459, 3134, 213

passed LTC
https://tests.stockfishchess.org/tests/view/5f41862f87a5c3c63d8f53e8
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 138448 W: 7655 L: 7252 D: 123541
Ptnml(0-2): 145, 6247, 56043, 6638, 151

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

Bench: 3610676
2020-08-24 12:09:04 +02:00
Sami Kiminki f7b3f0e842 Allow TT entries with key16==0 to be fetched
Fix the issue where a TT entry with key16==0 would always be reported
as a miss. Instead, we'll use depth8 to detect whether the TT entry is
occupied. In order to do that, we'll change DEPTH_OFFSET to -7
(depth8==0) to distinguish between an unoccupied entry and the
otherwise lowest possible depth, i.e., DEPTH_NONE (depth8==1).

To prevent a performance regression, we'll reorder the TT entry fields
by the access order of TranspositionTable::probe(). Memory in general
works fastest when accessed in sequential order. We'll also match the
store order in TTEntry::save() with the entry field order, and
re-order the 'if-or' expressions in TTEntry::save() from the cheapest
to the most expensive.

Finally, as we now have a proper TT entry occupancy test, we'll fix a
minor corner case with hashfull reporting. To reproduce:
- Use a big hash
- Either:
  a. Start 31 very quick searches (this wraparounds generation to 0); or
  b. Force generation of the first search to 0.
- go depth infinite

Before the fix, hashfull would incorrectly report nearly full hash
immediately after the search start, since
TranspositionTable::hashfull() used to consider only the entry
generation and not whether the entry was actually occupied.

STC:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 36848 W: 4091 L: 3898 D: 28859
Ptnml(0-2): 158, 2996, 11972, 3091, 207
https://tests.stockfishchess.org/tests/view/5f3f98d5dc02a01a0c2881f7

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 32280 W: 1828 L: 1653 D: 28799
Ptnml(0-2): 34, 1428, 13051, 1583, 44
https://tests.stockfishchess.org/tests/view/5f3fe77a87a5c3c63d8f5332

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

Bench: 3760677
2020-08-24 12:03:28 +02:00
mstembera 701b2427bd Support VNNI on 256bit vectors
due to downclocking on current chips (tested up to cascade lake)
supporting avx512 and vnni512, it is better to use avx2 or vnni256
in multithreaded (in particular hyperthreaded) engine use.
In single threaded use, the picture is different.

gcc compilation for vnni256 requires a toolchain for gcc >= 9.

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

No functional change
2020-08-24 12:03:04 +02:00
George Sobala e453f09f06 armv8 AArch64 does not require -mfpu=neon
-mpfu is not required on AArch64 / armv8 architecture on Linux and throws an error if present.
This PR has been tested on gcc and clang on Gentoo-64 and Raspian-64 on a Raspberry Pi 4,
as well as with a cross from Ubuntu
(`make clean && make -j build ARCH=armv8         COMP=gcc COMPILER=aarch64-linux-gnu-g++`)

fixes https://github.com/official-stockfish/Stockfish/issues/3056
closes https://github.com/official-stockfish/Stockfish/pull/3059

No functional change
2020-08-24 11:30:55 +02:00
Vizvezdenec d5f86b6359 Introduce movecount pruning for qsearch()
If in quiescence search, we assume that me can prune late moves when:

a) the move ordering count of the move is : moveCount > abs(depth) + 2
b) we are not in check
c) the late move does not give check
d) the late move is not an advanced pawn push

Modification of an original idea by @VoyagerOne.

STC
https://tests.stockfishchess.org/tests/view/5f40581787a5c3c63d8f535f
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 132848 W: 14999 L: 14661 D: 103188
Ptnml(0-2): 684, 11242, 42309, 11430, 759

LTC
https://tests.stockfishchess.org/tests/view/5f4226da87a5c3c63d8f5412
LLR: 2.98 (-2.94,2.94) {0.25,1.25}
Total: 12008 W: 678 L: 551 D: 10779
Ptnml(0-2): 8, 485, 4899, 596, 16

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

Bench: 3749974
2020-08-23 23:27:03 +02:00
syzygy1 cc9d503dde Skip the alignment bug workaround for Clang
Clang-10.0.0 poses as gcc-4.2:

$ clang++ -E -dM - </dev/null | grep GNUC

This means that Clang is using the workaround for the alignment bug of gcc-8
even though it does not have the bug (as far as I know).

This patch should speed up AVX2 and AVX512 compiles on Windows (when using Clang),
because it disables (for Clang) the gcc workaround we had introduced in this commit:
875183b310

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

No functional change.
2020-08-23 23:09:31 +02:00
Joost VandeVondele 5f1843c9cb Small trivial cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2801

No functional change
2020-08-23 01:53:41 +02:00
Stéphane Nicolet 3542033342 Instructions to build on older Macintosh
In recent Macs, it is possible to use the Clang compiler provided by Apple
to compile Stockfish out of the box, and this is the method used by default
in our Makefile (the Makefile sets the macosx-version-min=10.14 flag to select
the right libc++ library for the Clang compiler with recent c++17 support).

But it is quite possible to compile and run Stockfish on older Macs! Below
we describe a method to install a recent GNU compiler on these Macs, to get
the c++17 support. We have tested the following procedure to install gcc10 on
machines running Mac OS 10.7, Mac OS 10.9 and Mac OS 10.13:

1) install XCode for your machine.

2) install Apple command-line developer tools for XCode, by typing the following
   command in a Terminal:

```
      sudo xcode-select --install
```

3) go to the Stockfish "src" directory, then try a default build and run Stockfish:

```
      make clean
      make build
      make net
      ./stockfish
```

4) if step 3 worked, congrats! You have a compiler recent enough on your Mac
to compile Stockfish. If not, continue with step 5 to install GNU gcc10 :-)

5) install the MacPorts package manager (https://www.macports.org/install.php),
for instance using the fast method in the "macOS Package (.pkg) Installer"
section of the page.

6) use the "port" command to install the gcc10 package of MacPorts by typing the
following command:

```
    sudo port install gcc10
```

With this step, MacPorts will install the gcc10 compiler under the name "g++-mp-10"
in the /opt/local/bin directory:

```
   which g++-mp-10

   /opt/local/bin/g++-mp-10       <--- answer
```

7) You can now go back to the "src" directory of Stockfish, and try to build
Stockfish by pointing at the right compiler:

```
   make clean
   make build COMP=gcc COMPCXX=/opt/local/bin/g++-mp-10
   make net
   ./stockfish
```

8) Enjoy Stockfish on Macintosh!

See this pull request for further discussion:
https://github.com/official-stockfish/Stockfish/pull/3049

No functional change
2020-08-22 22:37:50 +02:00
Joost VandeVondele 34f67c5722 Explicitly rely on pthreads if possible
allows us to set the needed stacksize on thread creation.

Useful for environments with too small a default stack size (e.g. Alpine Linux with musl).

Passed STC, no regression:

LLR: 2.96 (-2.94,2.94) {-1.25,0.25}
Total: 17816 W: 1344 L: 1275 D: 15197
Ptnml(0-2): 30, 1057, 6682, 1092, 47
https://tests.stockfishchess.org/tests/view/5f402b5587a5c3c63d8f534d

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

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

No functional change.
2020-08-22 11:00:45 +02:00
MJZ1977 cbcb05ca09 Display classic and NNUE evaluation in trace mode
show both the classical and NNUE evaluation,
as well as the Final evaluation.

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

No functional change.
2020-08-22 10:58:08 +02:00
Unai Corzo e64b957274 Simplify away internal iterative deepening
Remove the iterative deepening step.
Instead, employ a depth reduction if the position is not in TT and on the PV.

STC https://tests.stockfishchess.org/tests/view/5f3ce6eaa95672ddd56c637e
LLR: 2.97 (-2.94,2.94) {-0.50,1.50}
Total: 41096 W: 4421 L: 4257 D: 32418
Ptnml(0-2): 207, 3259, 13460, 3407, 215

LTC (old) https://tests.stockfishchess.org/tests/view/5f3d7d4fa95672ddd56c640b
LLR: 2.92 (-2.94,2.94) {-1.50,0.50}
Total: 26032 W: 1320 L: 1309 D: 23403
Ptnml(0-2): 22, 1152, 10654, 1169, 19

LTC (new) https://tests.stockfishchess.org/tests/view/5f3e31e0a95672ddd56c6464
LLR: 2.95 (-2.94,2.94) {-0.75,0.25}
Total: 34160 W: 1844 L: 1766 D: 30550
Ptnml(0-2): 33, 1533, 13876, 1599, 39

bench: 3849173
2020-08-21 18:04:14 +02:00
gsobala 15abcaedc1 Update Makefile for macOS
Changes to deal with compilation (particularly profile-build) on macOS.
(1) The default toolchain has gcc masquerading as clang,
    the previous Makefile was not picking up the required changes
    to the different profiling tools.
(2) The previous Makefile test for gccisclang occurred before
    a potential overwrite of CXX by COMPCXX
(3) llvm-profdata no longer runs as a command on macOS and
    instead is invoked by ``xcrun llvm-profdata``
(4) Needs to support use of true gcc using e.g.
    ``make build ... COMPCXX=g++-10``
(5) enable profile-build in travis for macOS

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

No functional change
2020-08-21 17:59:21 +02:00
Joost VandeVondele 8b45b1c490 Deal with very old linux kernels
MADV_HUGEPAGE might not be available, for kernels before 2.6.38 (released 2011). Just skip the madvise.

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

No functional change
2020-08-21 17:56:33 +02:00
Joost VandeVondele daac86691d Set Use NNUE by default to true
Since the initial stages of the merge, progress has been made so that
this seems the best option now:

* NNUE is clearly stronger on most relevant hardware and time controls
* All of our CI and testing infrastructure has been adjusted
* The default net is easy to get (further ideas #3030)

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

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

No functional change.
2020-08-20 21:14:32 +02:00
Joost VandeVondele a1ad8604a1 Send error message as an UCI info string
some GUIs do not show the error message when the engine terminates in the no-net case, as it is send to cerr.
Instead send it as an info string, which the GUI will more likely display.

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

No functional change.
2020-08-20 21:13:07 +02:00
SFisGOD 2deb08a529 Reintroduce last captures extension
STC:
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 34840 W: 3834 L: 3682 D: 27324
Ptnml(0-2): 153, 2767, 11455, 2865, 180
https://tests.stockfishchess.org/tests/view/5f3bb380b38d442594aabefc

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 15832 W: 890 L: 776 D: 14166
Ptnml(0-2): 17, 669, 6429, 785, 16
https://tests.stockfishchess.org/tests/view/5f3c46a0a95672ddd56c632a

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

see also https://github.com/official-stockfish/Stockfish/pull/3020

Bench: 4348811
2020-08-20 21:12:37 +02:00
syzygy1 42e8789f0b Expanded support for x86-32 architectures.
add new ARCH targets

x86-32-sse41-popcnt     > x86 32-bit with sse41 and popcnt support
x86-32-sse2             > x86 32-bit with sse2 support
x86-32                  > x86 32-bit generic (with mmx and sse support)

retire x86-32-old (use general-32)

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

No functional change.
2020-08-18 20:15:07 +02:00
Joost VandeVondele 384d684484 Better error message on missing curl/wget
provide clean error/warning message for missing curl/wget, sha256sum/shasum

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

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

No functional change
2020-08-18 19:57:30 +02:00
Joost VandeVondele fbae5614eb Fix Makefile typo
remove stray quote, shown with `make help`

No functional change
2020-08-18 08:49:06 +02:00
mstembera 1bcc981a5a Fallback to NNUE
If the classical eval ends up much smaller than estimated fall back to NNUE.
Also use multiply instead of divide for the threshold comparison for smoother transitions without rounding.

STC https://tests.stockfishchess.org/tests/view/5f3a5011b38d442594aabdfe
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 57352 W: 6325 L: 6135 D: 44892
Ptnml(0-2): 277, 4748, 18482, 4846, 323

LTC https://tests.stockfishchess.org/tests/view/5f3aee9db38d442594aabe82
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 16232 W: 897 L: 781 D: 14554
Ptnml(0-2): 19, 679, 6616, 771, 31

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

bench: 4026216

-----

Recommended net: https://tests.stockfishchess.org/api/nn/nn-82215d0fd0df.nnue
2020-08-18 08:36:57 +02:00
Unai Corzo 581b92e4a7 Remove last captures extension
STC https://tests.stockfishchess.org/tests/view/5f395657e98b6c64b3df41dd
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 144664 W: 15426 L: 15537 D: 113701
Ptnml(0-2): 612, 11341, 48537, 11230, 612

LTC https://tests.stockfishchess.org/tests/view/5f3a2ec7b38d442594aabdd7
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 22728 W: 1161 L: 1146 D: 20421
Ptnml(0-2): 21, 960, 9388, 973, 22

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

bench: 3832662
2020-08-18 08:33:42 +02:00
VoyagerOne 1c0b7bdf4f Remove history bonus from Eval
STC:
LLR: 2.92 (-2.94,2.94) {-1.50,0.50}
Total: 26776 W: 2787 L: 2725 D: 21264
https://tests.stockfishchess.org/tests/view/5f39d6beb38d442594aabd9b

LTC:
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 12968 W: 635 L: 608 D: 11725
https://tests.stockfishchess.org/tests/view/5f39decfb38d442594aabda7

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

Bench:  4335100
2020-08-18 08:29:42 +02:00
notruck 65b976439f Support building for Android using NDK
The easiest way to use the NDK in conjunction with this Makefile (tested on linux-x86_64):

1. Download the latest NDK (r21d) from Google from https://developer.android.com/ndk/downloads
2. Place and unzip the NDK in $HOME/ndk folder
3. Export the path variable e.g., `export PATH=$PATH:$HOME/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin`
4. cd to your Stockfish/src dir
5. Issue `make -j ARCH=armv8 COMP=ndk build`  (use `ARCH=armv7` or `ARCH=armv7-neon` for older CPUs)
6. Optionally `make -j ARCH=armv8 COMP=ndk strip`
7. That's all. Enjoy!

Improves support from Raspberry Pi (incomplete?) and compiling on arm in general

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

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

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

Support is still fragile as we're missing CI on these targets. Nevertheless tested with:

```bash
  # build crosses from ubuntu 20.04 on x86 to various arch/OS combos
  # tested with suitable packages installed
  # (build-essentials, mingw-w64, g++-arm-linux-gnueabihf, NDK (r21d) from google)

  # cross to Android
  export PATH=$HOME/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
  make clean && make -j build ARCH=armv7         COMP=ndk  && make -j build ARCH=armv7 COMP=ndk strip
  make clean && make -j build ARCH=armv7-neon    COMP=ndk  && make -j build ARCH=armv7-neon COMP=ndk strip
  make clean && make -j build ARCH=armv8         COMP=ndk  && make -j build ARCH=armv8 COMP=ndk strip

  # cross to Raspberry Pi
  make clean && make -j build ARCH=armv7         COMP=gcc COMPILER=arm-linux-gnueabihf-g++
  make clean && make -j build ARCH=armv7-neon    COMP=gcc COMPILER=arm-linux-gnueabihf-g++

  # cross to Windows
  make clean && make -j build ARCH=x86-64-modern COMP=mingw
```

No functional change
2020-08-18 08:19:22 +02:00
Unai Corzo 0e17a89e4d Simplify away the passed pawn extension
STC https://tests.stockfishchess.org/tests/view/5f3955f0e98b6c64b3df41d7
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 31992 W: 3611 L: 3548 D: 24833
Ptnml(0-2): 174, 2658, 10273, 2713, 178

LTC https://tests.stockfishchess.org/tests/view/5f399e41e98b6c64b3df4210
LLR: 3.01 (-2.94,2.94) {-1.50,0.50}
Total: 29568 W: 1488 L: 1480 D: 26600
Ptnml(0-2): 40, 1272, 12142, 1300, 30

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

bench: 3844671

-----

Recommended net: https://tests.stockfishchess.org/api/nn/nn-82215d0fd0df.nnue
2020-08-17 12:27:35 +02:00
Stéphane Nicolet 81d716f5cc Reformat code in little-endian patch
Reformat code and rename the function to "read_little_endian()" in the recent
commit by Ronald de Man for support of big endian systems.

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

No functional change
-----

Recommended net: https://tests.stockfishchess.org/api/nn/nn-82215d0fd0df.nnue
2020-08-17 12:15:57 +02:00
Joost VandeVondele 65572de4a7 Add further targets to travis testing
general-32, general-64 and help

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

No functional change
2020-08-16 21:10:26 +02:00
syzygy1 72dc7a5c54 Assume network file is in little-endian byte order
This patch fixes the byte order when reading 16- and 32-bit values from the network file on a big-endian machine.

Bytes are ordered in read_le() using unsigned arithmetic, which doesn't need tricks to determine the endianness of the machine. Unfortunately the compiler doesn't seem to be able to optimise the ordering operation, but reading in the weights is not a time-critical operation and the extra time it takes should not be noticeable.

Big endian systems are still untested with NNUE.

fixes #3007

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

No functional change.
2020-08-16 21:10:26 +02:00
Daylen Yang 8cf43c6317 Display NEON in compiler string
if NEON intrinsics are being used and USE_NEON is defined.

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

No functional change
2020-08-16 21:10:26 +02:00
Joost VandeVondele cd0b8b4cf2 Use NNUE more for fortresses
Increases the use of NNUE evaluation in positions without captures/pawn moves,
by increasing the NNUEThreshold threshold with rule50_count.

This patch will force Stockfish to use NNUE eval more and more in materially
unbalanced positions, when it seems that the classical eval is struggling to
win and only manages to shuffle. This will ask the (slower) NNUE eval to
double-check the potential fortress branches of the search tree, but only
when necessary.

passed STC:
https://tests.stockfishchess.org/tests/view/5f36f1bf11a9b1a1dbf192d8
LLR: 2.93 (-2.94,2.94) {-0.50,1.50}
Total: 51824 W: 5836 L: 5653 D: 40335
Ptnml(0-2): 264, 4356, 16512, 4493, 287

passed LTC:
https://tests.stockfishchess.org/tests/view/5f37836111a9b1a1dbf1936d
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 29768 W: 1747 L: 1590 D: 26431
Ptnml(0-2): 33, 1347, 11977, 1484, 43

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

Bench: 4173967
2020-08-16 08:20:32 +02:00
mstembera 6eb186c97e Try to match relative magnitude of NNUE eval to classical
The idea is that since we are mixing NNUE and classical evals matching their magnitudes closer allows for better comparisons.

STC https://tests.stockfishchess.org/tests/view/5f35a65411a9b1a1dbf18e2b
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 9840 W: 1150 L: 1027 D: 7663
Ptnml(0-2): 49, 772, 3175, 855, 69

LTC https://tests.stockfishchess.org/tests/view/5f35bcbe11a9b1a1dbf18e47
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 44424 W: 2492 L: 2294 D: 39638
Ptnml(0-2): 42, 2015, 17915, 2183, 57

also corrects the location to clamp the evaluation (non-function on bench).

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

bench: 3905447
2020-08-14 16:39:52 +02:00
Miguel Lahoz e5f450cf0b Also dampen NNUE eval with 50 move rule
Move the existing dampening function last so that NNUE evaluations are
also handled as we approach the 50 move rule.

STC:
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 4792 W: 695 L: 561 D: 3536
Ptnml(0-2): 19, 420, 1422, 478, 57
https://tests.stockfishchess.org/tests/view/5f3164179081672066537534

LTC:
LLR: 8.62 (-2.94,2.94) {0.25,1.75}
Total: 286744 W: 18494 L: 17430 D: 250820
Ptnml(0-2): 418, 14886, 111745, 15860, 463
https://tests.stockfishchess.org/tests/view/5f316b039081672066537541

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

Bench: 4001800
2020-08-14 16:31:18 +02:00
Joost VandeVondele ce009ea1aa Verify SHA of downloaded net file
check SHA of the available and downloaded file.

Document the format requirement on the default net.

Also allow curl to make possibly insecure connections, as needed for old curl.

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

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

No functional change.
2020-08-14 16:20:42 +02:00
Stéphane Nicolet e8ea215a13 Clean-up Makefile help
Do not show the details of the default architecture for a simple "make help"
invocation, as the details are most likely to confuse beginners. Instead we
make it clear which architecture is the default and put an example at the end
of the Makefile as an incentative to use "make help ARCH=blah" to discover
the flags used by the different architectures.

```
    make help
    make help ARCH=x86-64-ssse3
```

Also clean-up and modernize a bit the Makefile examples while at it.

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

No functional change
2020-08-14 16:18:50 +02:00
Sergio Vieri 67e48418af Update default net to nn-82215d0fd0df.nnue
Net created at: 20200812-2257

passed STC: https://tests.stockfishchess.org/tests/view/5f340ca99e5f2effc089da17
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 5744 W: 756 L: 627 D: 4361
Ptnml(0-2): 28, 485, 1731, 586, 42

passed LTC: https://tests.stockfishchess.org/tests/view/5f341eba9e5f2effc089da23
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 17136 W: 1041 L: 917 D: 15178
Ptnml(0-2): 13, 813, 6807, 907, 28

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

Bench: 3935117
2020-08-13 07:50:52 +02:00
Joost VandeVondele 69cfe28f31 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.
2020-08-13 07:41:06 +02:00
mstembera dd63b98fb0 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
2020-08-13 07:39:52 +02:00
Daylen Yang 6bc0256292 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.
2020-08-12 07:49:36 +02:00
Joost VandeVondele 992f549ae7 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
2020-08-11 23:35:02 +02:00
SFisGOD ee06046412 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
2020-08-11 13:46:02 +02:00
Guy Vreuls ea6220f381 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
2020-08-11 08:17:03 +02:00
mstembera f46c73040c 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
2020-08-11 08:17:03 +02:00
Joost VandeVondele 399cddf444 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
2020-08-11 08:17:03 +02:00
Guy Vreuls 4ab8b0b738 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.
2020-08-11 08:17:03 +02:00
Vizvezdenec a72cec1ff8 Add comments to probCut code
and rename a variable

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

No functional change
2020-08-11 08:17:03 +02:00