Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compile Stockfish on Windows 11 ARM, when using a MacBook Pro M1 MAX and Parallels Desktop? #4241

Closed
Chess321 opened this issue Nov 23, 2022 · 27 comments

Comments

@Chess321
Copy link

Describe the issue

How to compile Stockfish on Windows 11 ARM, when using a MacBook Pro M1 MAX and Parallels Desktop?

When we will have the latest dev. version for Windows ARM?
https://abrok.eu/stockfish/

Expected behavior

It looks like I need to create a Stockfish.exe, which can use Apple MacBook ARM cores, to run Stockfish inside ChessBase 17 on Windows 11 ARM.

Steps to reproduce

Can someone try to compile on Windows 11 ARM or with Apples terminal?

Anything else?

No response

Operating system

Windows

Stockfish version

Stockfish 15

@ppigazzini
Copy link
Contributor

Try the new msys2 ARM64 support with Windows 11 ARM
https://www.msys2.org/wiki/arm64/

@Chess321
Copy link
Author

Try the new msys2 ARM64 support with Windows 11 ARM
https://www.msys2.org/wiki/arm64/

@ppigazzini Thanks I have done this:

Installation:
Download/Install MSYS2 as usual
Execute clangarm64.exe in the MSYS2 install directory
Uncomment the clangarm64 config in /etc/pacman.conf
Run pacman -Suy
Install clang for example: pacman -S mingw-w64-clang-aarch64-clang

All done without problems.

But what I need to do now?

When I try:
CLANGARM64 ~/Stockfish-master/src
and then:
make help
-bash: make: command not found

and when I try without make, then I get:
help
GNU bash, version 5.2.9(1)-release (x86_64-pc-msys)
These shell commands are defined internally. Type help' to see this list. Type help name' to find out more about the function name'. Use info bash' to find out more about the shell in general.
Use man -k' or info' to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

job_spec [&] history [-c] [-d offset] [n] or history -anrw >
(( expression )) if COMMANDS; then COMMANDS; [ elif COMMANDS; t>
. filename [arguments] jobs [-lnprs] [jobspec ...] or jobs -x command>
: kill [-s sigspec | -n signum | -sigspec] pid |>
[ arg... ] let arg [arg ...]
[[ expression ]] local [option] name[=value] ...
alias [-p] [name[=value] ... ] logout [n]
bg [job_spec ...] mapfile [-d delim] [-n count] [-O origin] [-s >
bind [-lpsvPSVX] [-m keymap] [-f filename] [-q > popd [-n] [+N | -N]
break [n] printf [-v var] format [arguments]
builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir]
caller [expr] pwd [-LPW]
case WORD in [PATTERN [| PATTERN]...) COMMANDS > read [-ers] [-a array] [-d delim] [-i text] [->
cd [-L|[-P [-e]] [-@]] [dir] readarray [-d delim] [-n count] [-O origin] [->
command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] or readonly>
compgen [-abcdefgjksuv] [-o option] [-A action]> return [n]
complete [-abcdefgjksuv] [-pr] [-DEI] [-o optio> select NAME [in WORDS ... ;] do COMMANDS; done
compopt [-o|+o option] [-DEI] [name ...] set [-abefhkmnptuvxBCEHPT] [-o option-name] [->
continue [n] shift [n]
coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...]
declare [-aAfFgiIlnrtux] [name[=value] ...] or > source filename [arguments]
dirs [-clpv] [+N] [-N] suspend [-f]
disown [-h] [-ar] [jobspec ... | pid ...] test [expr]
echo [-neE] [arg ...] time [-p] pipeline
enable [-a] [-dnps] [-f filename] [name ...] times
eval [arg ...] trap [-lp] [[arg] signal_spec ...]
exec [-cl] [-a name] [command [argument ...]] [> true
exit [n] type [-afptP] name [name ...]
export [-fn] [name[=value] ...] or export -p typeset [-aAfFgiIlnrtux] name[=value] ... or t>
false ulimit [-SHabcdefiklmnpqrstuvxPRT] [limit]
fc [-e ename] [-lnr] [first] [last] or fc -s [p> umask [-p] [-S] [mode]
fg [job_spec] unalias [-a] name [name ...]
for NAME [in WORDS ... ] ; do COMMANDS; done unset [-f] [-v] [-n] [name ...]
for (( exp1; exp2; exp3 )); do COMMANDS; done until COMMANDS; do COMMANDS-2; done
function name { COMMANDS ; } or name () { COMMA> variables - Names and meanings of some shell v>
getopts optstring name [arg ...] wait [-fn] [-p var] [id ...]
hash [-lr] [-p pathname] [-dt] [name ...] while COMMANDS; do COMMANDS-2; done
help [-dms] [pattern ...] { COMMANDS ; }

@ppigazzini
Copy link
Contributor

ppigazzini commented Nov 24, 2022

  • Not all packages in the repo have native builds yet, let us know if any you need are missing.
  • All unixy tools, like bash, will go through x64 emulation, so they might run slower than expected.

It seems that Windows 11 ARM is able to run programs through x64 emulation, so try pacman -S make.
Then the Makefile could require some changes, but only you have this platform and can experiment.

@XInTheDark
Copy link
Contributor

Just curious, is there a Windows equivalent of Rosetta 2?

@Chess321
Copy link
Author

  • Not all packages in the repo have native builds yet, let us know if any you need are missing.
  • All unixy tools, like bash, will go through x64 emulation, so they might run slower than expected.

It seems that Windows 11 ARM is able to run programs through x64 emulation, so try pacman -S make. Then the Makefile could requires some changes, but only you have can experiment.

$ pacman -S make
warning: make-4.3-4 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) make-4.3-4

Total Installed Size: 1.48 MiB
Net Upgrade Size: 0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring [###############################] 100%
(1/1) checking package integrity [###############################] 100%
(1/1) loading package files [###############################] 100%
(1/1) checking for file conflicts [###############################] 100%
(1/1) checking available disk space [###############################] 100%
:: Processing package changes...
(1/1) reinstalling make [###############################] 100%
:: Running post-transaction hooks...
(1/1) Updating the info directory file...

But make help or help doesn't work.
pacman -S make -j profile-build COMP=clang ARCH=apple-silicon doesn't work, but when I try:
make -j profile-build COMP=clang ARCH=apple-silicon ->

MINGW64 ~/Stockfish-master/src
$ make -j profile-build COMP=clang ARCH=apple-silicon
make: [Makefile:1007: .depend] Error 127 (ignored)
Default net: nn-ad9b42354671.nnue
Downloading https://tests.stockfishchess.org/api/nn/nn-ad9b42354671.nnue
Network validated

Config:
debug: 'no'
sanitize: 'none'
optimize: 'yes'
arch: 'arm64'
bits: '64'
kernel: 'MINGW64_NT-10.0-22000'
os: 'Windows_NT'
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'no'
mmx: 'no'
sse2: 'no'
ssse3: 'no'
sse41: 'no'
avx2: 'no'
avxvnni: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'yes'
arm_version: '8'

Flags:
CXX: x86_64-w64-mingw32-clang++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld
LDFLAGS: -static -m64 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld

Testing config sanity. If this fails, try 'make help' ...

Step 1/4. Building instrumented executable ...
make ARCH=apple-silicon COMP=clang clang-profile-make
make[1]: Entering directory '/home/my/Stockfish-master/src'
make ARCH=apple-silicon COMP=clang
EXTRACXXFLAGS='-fprofile-instr-generate '
EXTRALDFLAGS=' -fprofile-instr-generate'
all
make[2]: Entering directory '/home/my/Stockfish-master/src'
x86_64-w64-mingw32-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o benchmark.o benchmark.cpp
x86_64-w64-mingw32-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o bitbase.o bitbase.cpp
make[2]: x86_64-w64-mingw32-clang++: No such file or directory
make[2]: *** [: benchmark.o] Error 127
make[2]: *** Waiting for unfinished jobs....
make[2]: x86_64-w64-mingw32-clang++: No such file or directory
make[2]: *** [: bitbase.o] Error 127
make[2]: Leaving directory '/home/my/Stockfish-master/src'
make[1]: *** [Makefile:968: clang-profile-make] Error 2
make[1]: Leaving directory '/home/my/Stockfish-master/src'
make: *** [Makefile:823: profile-build] Error 2

CLANGARM64 ~/Stockfish-master/src
$ make -j profile-build COMP=clang ARCH=apple-silicon
Default net: nn-ad9b42354671.nnue
nn-ad9b42354671.nnue available.
Network validated

Config:
debug: 'no'
sanitize: 'none'
optimize: 'yes'
arch: 'arm64'
bits: '64'
kernel: 'MINGW64_NT-10.0-22000'
os: 'Windows_NT'
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'no'
mmx: 'no'
sse2: 'no'
ssse3: 'no'
sse41: 'no'
avx2: 'no'
avxvnni: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'yes'
arm_version: '8'

Flags:
CXX: x86_64-w64-mingw32-clang++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld
LDFLAGS: -static -m64 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld

Testing config sanity. If this fails, try 'make help' ...

Step 1/4. Building instrumented executable ...
make ARCH=apple-silicon COMP=clang clang-profile-make
make[1]: Entering directory '/home/my/Stockfish-master/src'
make ARCH=apple-silicon COMP=clang
EXTRACXXFLAGS='-fprofile-instr-generate '
EXTRALDFLAGS=' -fprofile-instr-generate'
all
make[2]: Entering directory '/home/my/Stockfish-master/src'
x86_64-w64-mingw32-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o benchmark.o benchmark.cpp
x86_64-w64-mingw32-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o bitbase.o bitbase.cpp
make[2]: x86_64-w64-mingw32-clang++: No such file or directory
make[2]: *** [: benchmark.o] Error 127
make[2]: *** Waiting for unfinished jobs....
make[2]: x86_64-w64-mingw32-clang++: No such file or directory
make[2]: *** [: bitbase.o] Error 127
make[2]: Leaving directory '/home/my/Stockfish-master/src'
make[1]: *** [Makefile:968: clang-profile-make] Error 2
make[1]: Leaving directory '/home/my/Stockfish-master/src'
make: *** [Makefile:823: profile-build] Error 2

CLANGARM64 ~/Stockfish-master/src
$ make help
make: g++: No such file or directory
make: g++: No such file or directory

To compile stockfish, type:

make target ARCH=arch [COMP=compiler] [COMPCXX=cxx]

Supported targets:

help > Display architecture details
build > Standard build
net > Download the default nnue net
profile-build > Faster build (with profile-guided optimization)
strip > Strip executable
install > Install executable
clean > Clean up

Supported archs:

x86-64-vnni512 > x86 64-bit with vnni support 512bit wide
x86-64-vnni256 > x86 64-bit with vnni support 256bit wide
x86-64-avx512 > x86 64-bit with avx512 support
x86-64-avxvnni > x86 64-bit with avxvnni support
x86-64-bmi2 > x86 64-bit with bmi2 support
x86-64-avx2 > x86 64-bit with avx2 support
x86-64-sse41-popcnt > x86 64-bit with sse41 and popcnt support
x86-64-modern > common modern CPU, currently x86-64-sse41-popcnt
x86-64-ssse3 > x86 64-bit with ssse3 support
x86-64-sse3-popcnt > x86 64-bit with sse3 and popcnt support
x86-64 > x86 64-bit generic (with sse2 support)
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)
ppc-64 > PPC 64-bit
ppc-32 > PPC 32-bit
armv7 > ARMv7 32-bit
armv7-neon > ARMv7 32-bit with popcnt and neon
armv8 > ARMv8 64-bit with popcnt and neon
e2k > Elbrus 2000
apple-silicon > Apple silicon ARM64
general-64 > unspecified 64-bit
general-32 > unspecified 32-bit
riscv64 > RISC-V 64-bit

Supported compilers:

gcc > Gnu compiler (default)
mingw > Gnu compiler with MinGW under Windows
clang > LLVM Clang compiler
icc > Intel compiler
ndk > Google NDK to cross-compile for Android

Simple examples. If you don't know what to do, you likely want to run:

make -j build ARCH=x86-64 (A portable, slow compile for 64-bit systems)
make -j build ARCH=x86-32 (A portable, slow compile for 32-bit systems)

Advanced examples, for experienced users looking for performance:

make help ARCH=x86-64-bmi2
make -j profile-build ARCH=x86-64-bmi2 COMP=gcc COMPCXX=g++-9.0
make -j build ARCH=x86-64-ssse3 COMP=clang


Specify a supported architecture with the ARCH option for more details

@ppigazzini
Copy link
Contributor

ppigazzini commented Nov 24, 2022

EDIT_000: I fixed the wrong command syntax:
Try make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++

Alternative name for that compiler: aarch64-w64-mingw32-clang++

@Chess321
Copy link
Author

Try CXX="clang++" make -j profile-build COMP=clang ARCH=apple-silicon

With mingw64 or clangarm64?

CLANGARM64 ~/Stockfish-master/src
$ CXX="clang++" make -j profile-build COMP=clang ARCH=apple-silicon
Default net: nn-ad9b42354671.nnue
nn-ad9b42354671.nnue available.
Network validated

Config:
debug: 'no'
sanitize: 'none'
optimize: 'yes'
arch: 'arm64'
bits: '64'
kernel: 'MINGW64_NT-10.0-22000'
os: 'Windows_NT'
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'no'
mmx: 'no'
sse2: 'no'
ssse3: 'no'
sse41: 'no'
avx2: 'no'
avxvnni: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'yes'
arm_version: '8'

Flags:
CXX: x86_64-w64-mingw32-clang++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld
LDFLAGS: -static -m64 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld

Testing config sanity. If this fails, try 'make help' ...

Step 1/4. Building instrumented executable ...
make ARCH=apple-silicon COMP=clang clang-profile-make
make[1]: Entering directory '/home/my/Stockfish-master/src'
make ARCH=apple-silicon COMP=clang
EXTRACXXFLAGS='-fprofile-instr-generate '
EXTRALDFLAGS=' -fprofile-instr-generate'
all
make[2]: Entering directory '/home/my/Stockfish-master/src'
x86_64-w64-mingw32-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o benchmark.o benchmark.cpp
x86_64-w64-mingw32-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o bitbase.o bitbase.cpp
make[2]: x86_64-w64-mingw32-clang++: No such file or directory
make[2]: x86_64-w64-mingw32-clang++: No such file or directory
make[2]: *** [: benchmark.o] Error 127
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [: bitbase.o] Error 127
make[2]: Leaving directory '/home/my/Stockfish-master/src'
make[1]: *** [Makefile:968: clang-profile-make] Error 2
make[1]: Leaving directory '/home/my/Stockfish-master/src'
make: *** [Makefile:823: profile-build] Error 2

MINGW64 ~/Stockfish-master/src
$ CXX="clang++" make -j profile-build COMP=clang ARCH=apple-silicon
Default net: nn-ad9b42354671.nnue
nn-ad9b42354671.nnue available.
Network validated

Config:
debug: 'no'
sanitize: 'none'
optimize: 'yes'
arch: 'arm64'
bits: '64'
kernel: 'MINGW64_NT-10.0-22000'
os: 'Windows_NT'
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'no'
mmx: 'no'
sse2: 'no'
ssse3: 'no'
sse41: 'no'
avx2: 'no'
avxvnni: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'yes'
arm_version: '8'

Flags:
CXX: x86_64-w64-mingw32-clang++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld
LDFLAGS: -static -m64 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld

Testing config sanity. If this fails, try 'make help' ...

Step 1/4. Building instrumented executable ...
make ARCH=apple-silicon COMP=clang clang-profile-make
make[1]: Entering directory '/home/my/Stockfish-master/src'
make ARCH=apple-silicon COMP=clang
EXTRACXXFLAGS='-fprofile-instr-generate '
EXTRALDFLAGS=' -fprofile-instr-generate'
all
make[2]: Entering directory '/home/my/Stockfish-master/src'
x86_64-w64-mingw32-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o benchmark.o benchmark.cpp
x86_64-w64-mingw32-clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o bitbase.o bitbase.cpp
make[2]: x86_64-w64-mingw32-clang++: No such file or directory
make[2]: *** [: benchmark.o] Error 127
make[2]: x86_64-w64-mingw32-clang++: No such file or directory
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [: bitbase.o] Error 127
make[2]: Leaving directory '/home/my/Stockfish-master/src'
make[1]: *** [Makefile:968: clang-profile-make] Error 2
make[1]: Leaving directory '/home/my/Stockfish-master/src'
make: *** [Makefile:823: profile-build] Error 2

@Chess321
Copy link
Author

EDIT_000: wrote the wright command syntax:
Try make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++

MINGW64 ~/Stockfish-master/src
$ make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++
Default net: nn-ad9b42354671.nnue
nn-ad9b42354671.nnue available.
Network validated

Config:
debug: 'no'
sanitize: 'none'
optimize: 'yes'
arch: 'arm64'
bits: '64'
kernel: 'MINGW64_NT-10.0-22000'
os: 'Windows_NT'
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'no'
mmx: 'no'
sse2: 'no'
ssse3: 'no'
sse41: 'no'
avx2: 'no'
avxvnni: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'yes'
arm_version: '8'

Flags:
CXX: clang++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld
LDFLAGS: -static -m64 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld

Testing config sanity. If this fails, try 'make help' ...

Step 1/4. Building instrumented executable ...
make ARCH=apple-silicon COMP=clang clang-profile-make
make[1]: Entering directory '/home/my/Stockfish-master/src'
make ARCH=apple-silicon COMP=clang
EXTRACXXFLAGS='-fprofile-instr-generate '
EXTRALDFLAGS=' -fprofile-instr-generate'
all
make[2]: Entering directory '/home/my/Stockfish-master/src'
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o benchmark.o benchmark.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o bitbase.o bitbase.cpp
make[2]: clang++: No such file or directory
make[2]: *** [: benchmark.o] Error 127
make[2]: *** Waiting for unfinished jobs....
make[2]: clang++: No such file or directory
make[2]: *** [: bitbase.o] Error 127
make[2]: Leaving directory '/home/my/Stockfish-master/src'
make[1]: *** [Makefile:968: clang-profile-make] Error 2
make[1]: Leaving directory '/home/my/Stockfish-master/src'
make: *** [Makefile:823: profile-build] Error 2

It works:
CLANGARM64 ~/Stockfish-master/src
$ make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++
Default net: nn-ad9b42354671.nnue
nn-ad9b42354671.nnue available.
Network validated

Config:
debug: 'no'
sanitize: 'none'
optimize: 'yes'
arch: 'arm64'
bits: '64'
kernel: 'MINGW64_NT-10.0-22000'
os: 'Windows_NT'
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'no'
mmx: 'no'
sse2: 'no'
ssse3: 'no'
sse41: 'no'
avx2: 'no'
avxvnni: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'yes'
arm_version: '8'

Flags:
CXX: clang++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld
LDFLAGS: -static -m64 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld

Testing config sanity. If this fails, try 'make help' ...

Step 1/4. Building instrumented executable ...
make ARCH=apple-silicon COMP=clang clang-profile-make
make[1]: Entering directory '/home/my/Stockfish-master/src'
make ARCH=apple-silicon COMP=clang
EXTRACXXFLAGS='-fprofile-instr-generate '
EXTRALDFLAGS=' -fprofile-instr-generate'
all
make[2]: Entering directory '/home/my/Stockfish-master/src'
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o benchmark.o benchmark.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o bitbase.o bitbase.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o bitboard.o bitboard.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o endgame.o endgame.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o evaluate.o evaluate.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o main.o main.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o material.o material.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o misc.o misc.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o movegen.o movegen.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o movepick.o movepick.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o pawns.o pawns.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o position.o position.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o psqt.o psqt.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o search.o search.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o thread.o thread.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o timeman.o timeman.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o tt.o tt.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o uci.o uci.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o ucioption.o ucioption.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o tune.o tune.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o tbprobe.o syzygy/tbprobe.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o evaluate_nnue.o nnue/evaluate_nnue.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o half_ka_v2_hm.o nnue/features/half_ka_v2_hm.cpp
clang++ -o stockfish.exe benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o search.o thread.o timeman.o tt.o uci.o ucioption.o tune.o tbprobe.o evaluate_nnue.o half_ka_v2_hm.o -fprofile-instr-generate -static -m64 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld
make[2]: Leaving directory '/home/my/Stockfish-master/src'
make[1]: Leaving directory '/home/my/Stockfish-master/src'

Step 2/4. Running benchmark for pgo-build ...
./stockfish.exe bench 2>&1 | tail -n 4

Total time (ms) : 5416
Nodes searched : 4390318
Nodes/second : 810620

Step 3/4. Building optimized executable ...
make ARCH=apple-silicon COMP=clang objclean
make[1]: Entering directory '/home/my/Stockfish-master/src'
make[1]: Leaving directory '/home/my/Stockfish-master/src'
make ARCH=apple-silicon COMP=clang clang-profile-use
make[1]: Entering directory '/home/my/Stockfish-master/src'
llvm-profdata merge -output=stockfish.profdata *.profraw
make ARCH=apple-silicon COMP=clang
EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata'
EXTRALDFLAGS='-fprofile-use '
all
make[2]: Entering directory '/home/my/Stockfish-master/src'
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o benchmark.o benchmark.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o bitbase.o bitbase.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o bitboard.o bitboard.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o endgame.o endgame.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o evaluate.o evaluate.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o main.o main.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o material.o material.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o misc.o misc.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o movegen.o movegen.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o movepick.o movepick.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o pawns.o pawns.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o position.o position.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o psqt.o psqt.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o search.o search.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o thread.o thread.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o timeman.o timeman.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o tt.o tt.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o uci.o uci.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o ucioption.o ucioption.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o tune.o tune.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o tbprobe.o syzygy/tbprobe.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o evaluate_nnue.o nnue/evaluate_nnue.cpp
clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld -c -o half_ka_v2_hm.o nnue/features/half_ka_v2_hm.cpp
clang++ -o stockfish.exe benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o search.o thread.o timeman.o tt.o uci.o ucioption.o tune.o tbprobe.o evaluate_nnue.o half_ka_v2_hm.o -fprofile-use -static -m64 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-use=stockfish.profdata -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -fexperimental-new-pass-manager -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto=full -fuse-ld=lld
make[2]: Leaving directory '/home/my/Stockfish-master/src'
make[1]: Leaving directory '/home/my/Stockfish-master/src'

Step 4/4. Deleting profile data ...
make ARCH=apple-silicon COMP=clang profileclean
make[1]: Entering directory '/home/my/Stockfish-master/src'
make[1]: Leaving directory '/home/my/Stockfish-master/src'

strip Stockfish.exe

Bench
Total time (ms) : 2774
Nodes searched : 4390318
Nodes/second : 1582666

It works fine with ChessBase 17.
But most of the time I use Stockfish with BanksiaGUI for Apple Silicon :-)

I'm curious if we can make Stockfish even faster?

@vondele
Copy link
Member

vondele commented Nov 24, 2022

success, it seems.

See #4193 for your question. Needs a code contribution, which is likely only possible by somebody with some experience and with the hardware.

@Disservin
Copy link
Member

Disservin commented Nov 24, 2022

I wonder if -mcpu=apple-m1 would add some performance, probably not because our nnue is hidden behind ifdef's so it will use some other instructions and not some compiler generated ones, if that makes sense

@Chess321
Copy link
Author

I wonder if -mcpu=apple-m1 would add some performance, probably not because our nnue is hidden behind ifdef's so it will use some other instructions and not some compiler generated ones, if that makes sense

@Disservin I can try it, but what do I need to do?
make -mcpu=apple-m1 -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ ?

@vondele
Copy link
Member

vondele commented Nov 24, 2022

CXXFLAGS="-mcpu=apple-m1" make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++
should work

@Disservin
Copy link
Member

Disservin commented Nov 24, 2022

with -mcpu=apple-m1 and ./stockfish bench

Total time (ms) : 5057
Nodes searched  : 4390318
Nodes/second    : 868166

without

===========================
Total time (ms) : 4503
Nodes searched  : 4390318
Nodes/second    : 974976

No speedup in this test

@vondele
Copy link
Member

vondele commented Nov 24, 2022

these look very different benches (duration etc).

@Disservin
Copy link
Member

okay I just realised looks like i copied wrong

@Disservin
Copy link
Member

Disservin commented Nov 24, 2022

Now corrected, for me it seems to be definitely slower with the additional flag.

@ppigazzini
Copy link
Contributor

ppigazzini commented Nov 24, 2022

It seems that -march=native works now in Clang 15 for the Apple silicon:
https://www.phoronix.com/news/LLVM-Clang-march-native-M1
(last post on SO):
https://stackoverflow.com/questions/65966969/why-does-march-native-not-work-on-apple-m1

CXXFLAGS="-march=native" make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++

@Chess321
Copy link
Author

Chess321 commented Nov 24, 2022

CXXFLAGS="-mcpu=apple-m1" make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++
should work

@vondele
Thanks I tried it and here is the result:

Step 2/4. Running benchmark for pgo-build ...
./stockfish.exe bench 2>&1 | tail -n 4
CXXFLAGS="-mcpu=apple-m1" make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++
Total time (ms) : 5264
Nodes searched : 4390318
Nodes/second : 834026

Step 2/4. Running benchmark for pgo-build ...
./stockfish.exe bench 2>&1 | tail -n 4
make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++
Total time (ms) : 5416
Nodes searched : 4390318
Nodes/second : 810620

@Chess321
Copy link
Author

When I open Stockfish.exe and run bench:

CXXFLAGS="-mcpu=apple-m1" make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++
Total time (ms) : 4909
Nodes searched : 4390318
Nodes/second : 894340

make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++
Total time (ms) : 4689
Nodes searched : 4390318
Nodes/second : 936301

@gsobala
Copy link
Contributor

gsobala commented Nov 25, 2022

If you are running in a Windows ARM VM on Mac you are better off running stockfish native under MacOS and then using ssh or something like inbetween.exe to connect to it from the VM.

@Chess321
Copy link
Author

CXXFLAGS="-mcpu=apple-m1" make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++
should work

@vondele Thanks I tried it and here is the result:

Step 2/4. Running benchmark for pgo-build ... ./stockfish.exe bench 2>&1 | tail -n 4 CXXFLAGS="-mcpu=apple-m1" make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Total time (ms) : 5264 Nodes searched : 4390318 Nodes/second : 834026

Step 2/4. Running benchmark for pgo-build ... ./stockfish.exe bench 2>&1 | tail -n 4 make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Total time (ms) : 5416 Nodes searched : 4390318 Nodes/second : 810620

@ppigazzini I tried:
CXXFLAGS="-march=native" make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++

Step 2/4. Running benchmark for pgo-build ...
./stockfish.exe bench 2>&1 | tail -n 4
Total time (ms) : 3363
Nodes searched : 3467381
Nodes/second : 1031038

@Chess321
Copy link
Author

When I open Stockfish.exe and run bench:

CXXFLAGS="-mcpu=apple-m1" make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Total time (ms) : 4909 Nodes searched : 4390318 Nodes/second : 894340

make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Total time (ms) : 4689 Nodes searched : 4390318 Nodes/second : 936301

CXXFLAGS="-march=native" make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++
Total time (ms) : 2209
Nodes searched : 3467381
Nodes/second : 1569660

@gcp
Copy link
Contributor

gcp commented May 9, 2023

So if anyone is just looking for compiled binaries:
https://sjeng.org/dl/stockfishv15.1_WinARM_m1.zip

That's the current git (which has the M1 dot product) + v15.1 release. Compiled with the steps here plus the suggested fix in #4379.

If it's useful maybe they can go on the site? Parallels + Coherence + this works very well for ChessBase and friends on Apple Silicon macs.

@Disservin
Copy link
Member

So if anyone is just looking for compiled binaries: https://sjeng.org/dl/stockfishv15.1_macos_m1.zip

That's the current git (which has the M1 dot product) + v15.1 release. Compiled with the steps here plus the suggested fix in #4379.

If it's useful maybe they can go on the site? Parallels + Coherence + this works very well for ChessBase and friends on Apple Silicon macs.

This is just a normal m1 compile no? This issue was that someone had a windows vm on a mac m1 and tried to compile Stockfish which didnt work. Compilation on a M1 works just fine.

@gcp
Copy link
Contributor

gcp commented May 9, 2023

No, they're Windows on ARM binaries, e.g. to use inside a Parallels VM. I renamed the archive to make that clearer.

@gcp
Copy link
Contributor

gcp commented Jun 26, 2023

Given #4638 I might as well provide an updated one. Generic ARMv8 and Apple Silicon compiles for Windows on ARM.
https://sjeng.org/dl/stockfish16_win_armv8.zip

@Disservin
Copy link
Member

I'll close this since it is not really something within Stockfish but something related to the user system and I think we got a successful compilation anyway. Should have been opened in the discussions anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants
@gcp @vondele @ppigazzini @gsobala @Chess321 @Disservin @XInTheDark and others