]> git.sesse.net Git - stockfish/commit - src/nnue/layers/affine_transform.h
Add support for ARM dot product instructions
authorSebastian Buchwald <UniQP@web.de>
Tue, 21 Feb 2023 21:18:17 +0000 (22:18 +0100)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Thu, 23 Feb 2023 12:22:03 +0000 (13:22 +0100)
commitb4ad3a3c4b68f9c8736f444aeb3364f833247fdc
tree736656ad78b58f27928b1bdf2980c65b757c341a
parent037ef3e18dc7f5455cc671995ae38d5b4d1fce4a
Add support for ARM dot product instructions

The sdot instruction computes (and accumulates) a signed dot product,
which is quite handy for Stockfish's NNUE code. The instruction is
optional for Armv8.2 and Armv8.3, and mandatory for Armv8.4 and above.

The commit adds a new 'arm-dotprod' architecture with enabled dot
product support. It also enables dot product support for the existing
'apple-silicon' architecture, which is at least Armv8.5.

The following local speed test was performed on an Apple M1 with
ARCH=apple-silicon. I had to remove CPU pinning from the benchmark
script. However, the results were still consistent: Checking both
binaries against themselves reported a speedup of +0.0000 and +0.0005,
respectively.

```
Result of 100 runs
==================
base (...ish.037ef3e1) =    1917997  +/- 7152
test (...fish.dotprod) =    2159682  +/- 9066
diff                   =    +241684  +/- 2923

speedup        = +0.1260
P(speedup > 0) =  1.0000

CPU: 10 x arm
Hyperthreading: off
```

Fixes #4193

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

No functional change
src/Makefile
src/nnue/layers/affine_transform.h
src/nnue/layers/simd.h