official-stockfish / Stockfish

A free and strong UCI chess engine
https://stockfishchess.org/
GNU General Public License v3.0
11.62k stars 2.29k forks source link

misc.cpp:378:10: error: use of undeclared identifier '_mm_malloc' / misc.cpp:389:3: error: use of undeclared identifier '_mm_free' #4379

Closed Chess321 closed 1 year ago

Chess321 commented 1 year ago

Describe the issue

misc.cpp:378:10: error: use of undeclared identifier '_mm_malloc' return _mm_malloc(size, alignment); ^ misc.cpp:389:3: error: use of undeclared identifier '_mm_free' _mm_free(ptr); ^ 2 errors generated. make[2]: [: misc.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: Leaving directory '/home/my/Stockfish-master/src' make[1]: [Makefile:972: clang-profile-make] Error 2 make[1]: Leaving directory '/home/my/Stockfish-master/src' make: [Makefile:825: profile-build] Error 2

Expected behavior

misc.cpp:378:10: error: use of undeclared identifier '_mm_malloc' return _mm_malloc(size, alignment); ^ misc.cpp:389:3: error: use of undeclared identifier '_mm_free' _mm_free(ptr); ^ 2 errors generated. make[2]: [: misc.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: Leaving directory '/home/my/Stockfish-master/src' make[1]: [Makefile:972: clang-profile-make] Error 2 make[1]: Leaving directory '/home/my/Stockfish-master/src' make: [Makefile:825: profile-build] Error 2

Steps to reproduce

$ make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Default net: nn-bc24c101ada0.nnue nn-bc24c101ada0.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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 misc.cpp:378:10: error: use of undeclared identifier '_mm_malloc' return _mm_malloc(size, alignment); ^ misc.cpp:389:3: error: use of undeclared identifier '_mm_free' _mm_free(ptr); ^ 2 errors generated. make[2]: [: misc.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: Leaving directory '/home/my/Stockfish-master/src' make[1]: [Makefile:972: clang-profile-make] Error 2 make[1]: Leaving directory '/home/my/Stockfish-master/src' make: [Makefile:825: profile-build] Error 2

Anything else?

Can't compile newest Stockfish dev. on Windows 11 ARM.

My last compile from 14.01.2023 was fine.

Operating system

Windows

Stockfish version

Stockfish 02.02.2023

TonHaver commented 1 year ago

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

Don't have Windows on ARMmyself, but are you sure ARCH=apple-silicon is correct for that system? This command creates a binary on my M1 MacBook MacOs 12.3.1

Chess321 commented 1 year ago

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

Don't have Windows on ARMmyself, but are you sure ARCH=apple-silicon is correct for that system? This command creates a binary on my M1 MacBook MacOs 12.3.1

Yes I sure, take a look here: https://github.com/official-stockfish/Stockfish/issues/4241

TonHaver commented 1 year ago

OK, I learned something today, but can't help you then

MinetaS commented 1 year ago

This is possibly related to your environment being changed (e.g. compiler, environment variable or etc.). Is your OS, compiler and other toolchains all same?

If so, please try with this line removed because this is the only Makefile modification that's been made from 14.01.2023.

https://github.com/official-stockfish/Stockfish/blob/da8513f0eae439f526ab0a905a3433bdb44bcf66/src/Makefile#L430

However I doubt this is the cause because these two are totally unrelated.

Chess321 commented 1 year ago

This is possibly related to your environment being changed (e.g. compiler, environment variable or etc.). Is your OS, compiler and other toolchains all same?

If so, please try with this line removed because this is the only Makefile modification that's been made from 14.01.2023.

https://github.com/official-stockfish/Stockfish/blob/da8513f0eae439f526ab0a905a3433bdb44bcf66/src/Makefile#L430

However I doubt this is the cause because these two are totally unrelated.

I updated to macOS Ventura 13.2 I updated Windows 11 ARM I updated msys2 Parallels Desktop for Mac has the newest version.

Now I deleted 430 -Wconditional-uninitialized but it doesn't help. I get the same errors.

hgoschuetz commented 1 year ago

It seems to me that _mm_malloc and _mm_free are both exclusive to Intel processors. Since you are using Windows 11 for ARM, these two functions do not exist. While I cannot test this, I suppose either using Windows' _aligned_alloc and _aligned_free or adding an extra case for Windows on ARM would fix this issue.

UniQP commented 1 year ago

My understanding is the following: _mm_malloc and _mm_free are provided by either malloc.h or xmmintrin.h. We currently don't include malloc.h. When compiling misc.pp for x86-64, we (indirectly) include xmmintrin.h. But when compiling misc.cpp for arm64, we don't include xmmintrin.h, because it contains x86-specific intrinsics; and that's why we end up without a definition for _mm_malloc and _mm_free.

@Chess321 Does adding the line #include <malloc.h> in src/misc.cpp line 29 (in front of the #include <Windows.h>) solve the compile error?

Note to myself: The reason why we cannot just use std::aligned_alloc is this (Note M).

Chess321 commented 1 year ago

My understanding is the following: _mm_malloc and _mm_free are provided by either malloc.h or xmmintrin.h. We currently don't include malloc.h. When compiling misc.pp for x86-64, we (indirectly) include xmmintrin.h. But when compiling misc.cpp for arm64, we don't include xmmintrin.h, because it contains x86-specific intrinsics; and that's why we end up without a definition for _mm_malloc and _mm_free.

@Chess321 Does adding the line #include <malloc.h> in src/misc.cpp line 29 (in front of the #include <Windows.h>) solve the compile error?

Note to myself: The reason why we cannot just use std::aligned_alloc is this (Note M).

29 #include #include 30 // The needed Windows API for processor groups could be missed from old Windows

$ make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Default net: nn-1337b1adec5b.nnue nn-1337b1adec5b.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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 misc.cpp:29:21: warning: extra tokens at end of #include directive [-Wextra-tokens]

include #include

                ^
                //

misc.cpp:35:23: error: unknown type name 'LOGICAL_PROCESSOR_RELATIONSHIP' typedef bool(*fun1_t)(LOGICAL_PROCESSOR_RELATIONSHIP, ^ misc.cpp:36:23:clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -Wmissing-prototypes -Wconditional-uninitialized -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 error: unknown type name 'PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX' PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD); ^clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -Wmissing-prototypes -Wconditional-uninitialized -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

misc.cpp:36:65: error: unknown type name 'PDWORD' PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD); ^ misc.cpp:37:23: error: unknown type name 'USHORT' typedef bool(*fun2_t)(USHORT, PGROUP_AFFINITY); ^clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -Wmissing-prototypes -Wconditional-uninitialized -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

misc.cpp:37:31: error: unknown type name 'PGROUP_AFFINITY' typedef bool(*fun2_t)(USHORT, PGROUP_AFFINITY); ^clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -Wmissing-prototypes -Wconditional-uninitialized -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

misc.cpp:38:23: error: unknown type name 'HANDLE' typedef bool(fun3_t)(HANDLE, CONST GROUP_AFFINITY, PGROUP_AFFINITY); ^ misc.cpp:38:clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -Wmissing-prototypes -Wconditional-uninitialized -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 31: error: unknown type name 'CONST' typedef bool(fun3_t)(HANDLE, CONST GROUP_AFFINITY, PGROUP_AFFINITY); ^ misc.cpp:38:51: error: expected ')' typedef bool(fun3_t)(HANDLE, CONST GROUP_AFFINITY, PGROUP_AFFINITY); ^ misc.cpp:38:22: note: to match this '(' typedef bool(fun3_t)(HANDLE, CONST GROUP_AFFINITY, PGROUP_AFFINITY); ^ misc.cpp:39:23: error: unknown type name 'USHORT' typedef bool(fun4_t)(USHORT, PGROUP_AFFINITY, USHORT, PUSHORT); ^ misc.cpp:39:31: error: unknown type name 'PGROUP_AFFINITY' typedef bool(fun4_t)(USHORT, PGROUP_AFFINITY, USHORT, PUSHORT); ^clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -Wmissing-prototypes -Wconditional-uninitialized -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

misc.cpp:39:48: error: unknown type name 'USHORT' typedef bool(fun4_t)(USHORT, PGROUP_AFFINITY, USHORT, PUSHORT); ^ misc.cpp:39:56clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -Wmissing-prototypes -Wconditional-uninitialized -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 : error: unknown type name 'PUSHORT' typedef bool(fun4_t)(USHORT, PGROUP_AFFINITY, USHORT, PUSHORT); ^ misc.cpp:40:9: error: unknown type name 'WORD' typedef WORD(*fun5_t)(); ^clang++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-instr-generate -pedantic -Wextra -Wshadow -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 misc.cpp:452:10: error: use of undeclared identifier '_mm_malloc' return _mm_malloc(size, alignment); ^ misc.cpp:463:3: error: use of undeclared identifier '_mm_free' _mm_free(ptr); ^ misc.cpp:479:3: error: unknown type name 'HANDLE' HANDLE hProcessToken { }; ^ misc.cpp:480:3: error: unknown type name 'LUID' LUID luid { }; ^ misc.cpp:483:32: error: use of undeclared identifier 'GetLargePageMinimum' const size_t largePageSize = GetLargePageMinimum(); ^ misc.cpp:488:25: error: use of undeclared identifier 'GetCurrentProcess' if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hProcessToken)) ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 1 warning and 20 errors generated. make[2]: [: misc.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: Leaving directory '/home/my/Stockfish-master/src' make[1]: [Makefile:972: clang-profile-make] Error 2 make[1]: Leaving directory '/home/my/Stockfish-master/src' make: [Makefile:825: profile-build] Error 2

UniQP commented 1 year ago

Sorry, maybe my phrasing was a misleading. Each #include should be on a separate line:

#include <malloc.h>
#include <windows.h>
borg323 commented 1 year ago

I would suggest changing lines 452 and 463 of misc.cpp from #elif defined(_WIN32) to #elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)

Chess321 commented 1 year ago

Sorry, maybe my phrasing was a misleading. Each #include should be on a separate line:

#include <malloc.h>
#include <windows.h>

I tried it also on a separate line: $ make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Default net: nn-1337b1adec5b.nnue nn-1337b1adec5b.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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 misc.cpp:453:10: error: use of undeclared identifier '_mm_malloc' return _mm_malloc(size, alignment); ^ misc.cpp:464:3: error: use of undeclared identifier '_mm_free' _mm_free(ptr); ^ 2 errors generated. make[2]: [: misc.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: Leaving directory '/home/my/Stockfish-master/src' make[1]: [Makefile:972: clang-profile-make] Error 2 make[1]: Leaving directory '/home/my/Stockfish-master/src' make: [Makefile:825: profile-build] Error 2

Chess321 commented 1 year ago

I would suggest changing lines 452 and 463 of misc.cpp from #elif defined(_WIN32) to #elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)

Here is the result:

$ make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Default net: nn-1337b1adec5b.nnue nn-1337b1adec5b.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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 misc.cpp:454:15: error: reference to unresolved using declaration return std::aligned_alloc(alignment, size); ^ C:/msys64/clangarm64/include/c++/v1/cstdlib:139:1: note: using declaration annotated with 'using_if_exists' here using ::aligned_alloc _LIBCPP_USING_IF_EXISTS; ^ misc.cpp:454:10: error: excess elements in scalar initializer return std::aligned_alloc(alignment, size); ^ ~~ 2 errors generated. make[2]: [: misc.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: Leaving directory '/home/my/Stockfish-master/src' make[1]: [Makefile:972: clang-profile-make] Error 2 make[1]: Leaving directory '/home/my/Stockfish-master/src' make: [Makefile:825: profile-build] Error 2

borg323 commented 1 year ago

OK, there was some progress. Next change, as an untested diff:

--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -358,8 +358,10 @@ void* std_aligned_alloc(size_t alignment, size_t size) {
 #if defined(POSIXALIGNEDALLOC)
   void *mem;
   return posix_memalign(&mem, alignment, size) ? nullptr : mem;
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
   return _mm_malloc(size, alignment);
+#elif defined(_WIN32)
+  return _aligned_malloc(size, alignment);
 #else
   return std::aligned_alloc(alignment, size);
 #endif
@@ -369,8 +371,10 @@ void std_aligned_free(void* ptr) {

 #if defined(POSIXALIGNEDALLOC)
   free(ptr);
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
   _mm_free(ptr);
+#elif defined(_WIN32)
+  _aligned_free(ptr);
 #else
   free(ptr);
 #endif
Chess321 commented 1 year ago

OK, there was some progress. Next change, as an untested diff:

--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -358,8 +358,10 @@ void* std_aligned_alloc(size_t alignment, size_t size) {
 #if defined(POSIXALIGNEDALLOC)
   void *mem;
   return posix_memalign(&mem, alignment, size) ? nullptr : mem;
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
   return _mm_malloc(size, alignment);
+#elif defined(_WIN32)
+  return _aligned_malloc(size, alignment);
 #else
   return std::aligned_alloc(alignment, size);
 #endif
@@ -369,8 +371,10 @@ void std_aligned_free(void* ptr) {

 #if defined(POSIXALIGNEDALLOC)
   free(ptr);
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
   _mm_free(ptr);
+#elif defined(_WIN32)
+  _aligned_free(ptr);
 #else
   free(ptr);
 #endif

Where can I find: --- a/src/misc.cpp

Should it look like this?

442/// std_aligned_alloc() is our wrapper for systems where the c++17 implementation /// does not guarantee the availability of aligned_alloc(). Memory allocated with /// std_aligned_alloc() must be freed with std_aligned_free().

+++ b/src/misc.cpp void* std_aligned_alloc(size_t alignment, size_t size) {

if defined(POSIXALIGNEDALLOC)

void *mem; return posix_memalign(&mem, alignment, size) ? nullptr : mem;

elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)

return _mm_malloc(size, alignment); +#elif defined(_WIN32)

void std_aligned_free(void* ptr) {

if defined(POSIXALIGNEDALLOC)

free(ptr);

elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)

_mm_free(ptr); +#elif defined(_WIN32)

$ make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Default net: nn-1337b1adec5b.nnue nn-1337b1adec5b.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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 misc.cpp:446:1: error: expected unqualified-id +++ b/src/misc.cpp ^ 1 error generated. make[2]: [: misc.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: Leaving directory '/home/my/Stockfish-master/src' make[1]: [Makefile:972: clang-profile-make] Error 2 make[1]: Leaving directory '/home/my/Stockfish-master/src' make: [Makefile:825: profile-build] Error 2

Without +++ b/src/misc.cpp it looks like this:

$ make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Default net: nn-1337b1adec5b.nnue nn-1337b1adec5b.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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 misc.cpp:456:15: error: reference to unresolved using declaration return std::aligned_alloc(alignment, size); ^ C:/msys64/clangarm64/include/c++/v1/cstdlib:139:1: note: using declaration annotated with 'using_if_exists' here using ::aligned_alloc _LIBCPP_USING_IF_EXISTS; ^ misc.cpp:456:10: error: excess elements in scalar initializer return std::aligned_alloc(alignment, size); ^ ~~ 2 errors generated. make[2]: [: misc.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: Leaving directory '/home/my/Stockfish-master/src' make[1]: [Makefile:972: clang-profile-make] Error 2 make[1]: Leaving directory '/home/my/Stockfish-master/src' make: [Makefile:825: profile-build] Error 2

borg323 commented 1 year ago

Forget the diff, the two functions in misc.cpp should be:

void* std_aligned_alloc(size_t alignment, size_t size) {

#if defined(POSIXALIGNEDALLOC)
  void *mem;
  return posix_memalign(&mem, alignment, size) ? nullptr : mem;
#elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
  return _mm_malloc(size, alignment);
#elif defined(_WIN32)
  return _aligned_malloc(size, alignment);
#else
  return std::aligned_alloc(alignment, size);
#endif
}

void std_aligned_free(void* ptr) {

#if defined(POSIXALIGNEDALLOC)
  free(ptr);
#elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
  _mm_free(ptr);
#elif defined(_WIN32)
  _aligned_free(ptr);
#else
  free(ptr);
#endif
}
Chess321 commented 1 year ago

Forget the diff, the two functions in misc.cpp should be:

void* std_aligned_alloc(size_t alignment, size_t size) {

#if defined(POSIXALIGNEDALLOC)
  void *mem;
  return posix_memalign(&mem, alignment, size) ? nullptr : mem;
#elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
  return _mm_malloc(size, alignment);
#elif defined(_WIN32)
  return _aligned_malloc(size, alignment);
#else
  return std::aligned_alloc(alignment, size);
#endif
}

void std_aligned_free(void* ptr) {

#if defined(POSIXALIGNEDALLOC)
  free(ptr);
#elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
  _mm_free(ptr);
#elif defined(_WIN32)
  _aligned_free(ptr);
#else
  free(ptr);
#endif
}

$ make -j profile-build ARCH=apple-silicon COMP=clang CXX=clang++ Default net: nn-1337b1adec5b.nnue nn-1337b1adec5b.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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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) : 3436 Nodes searched : 3841998 Nodes/second : 1118160

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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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 -Wmissing-prototypes -Wconditional-uninitialized -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

When I use ChessBase 17, Stockfish works fine now :-) Thanks to all for the great support. I hope to see some Apple Silicon (speed) improvements in the future ;-)