New amateur chess engine Petrel

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
Jim Ablett
Posts: 2309
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: New amateur chess engine Petrel

Post by Jim Ablett »

Aleks Peshkov wrote: Sun Oct 12, 2025 12:37 pm
Jim Ablett wrote: Sun Oct 12, 2025 11:45 am src/typedefs.hpp:141:85: error: static assertion failed due to requirement 'sizeof(Move) == sizeof(short)'
141 | constexpr Move (Square::_t f, Square::_t t) : from_{f}, to_{t} { static_assert (sizeof(Move) == sizeof(int16_t)); }
In file included from src/Evaluation.cpp:1:
src/Evaluation.hpp:108:9: warning: packed attribute is unnecessary for 'PieceSquareTable::element_type::(unnamed struct at src/Evaluation.hpp:108:9)' [-Wpacked]
108 | struct PACKED {
| ^
1 warning and 1 error generated.
make: *** [Makefile:123: build/Evaluation.o] Error 1
My understanding cannot fix these issues. They are serious problems.
Hi Aleks,

issues are fixed. Check 'issues' on your petrel github page.

Jim.
taychoe
Posts: 8
Joined: Wed Jul 02, 2025 6:28 pm
Full name: Tay Choe

Re: New amateur chess engine Petrel

Post by taychoe »

I took another look at the Tt.cpp and memory.cpp files. I didn't notice before that there was a freeAligned routine at the bottom of memory.cpp. In Tt.cpp, in line 14, only ::free(memory) was being called. I replaced it with ::freeAligned(memory) and now everything is working. I made both g++ and clang++ compiles and both are working fine.
Aleks Peshkov
Posts: 947
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia
Full name: Aleks Peshkov

Re: New amateur chess engine Petrel

Post by Aleks Peshkov »

taychoe wrote: Sun Oct 12, 2025 5:54 pm I took another look at the Tt.cpp and memory.cpp files. I didn't notice before that there was a freeAligned routine at the bottom of memory.cpp. In Tt.cpp, in line 14, only ::free(memory) was being called. I replaced it with ::freeAligned(memory) and now everything is working. I made both g++ and clang++ compiles and both are working fine.
Serious bug. Thank you very much. A good example to not use own functions in global namespace.
User avatar
Gabor Szots
Posts: 1466
Joined: Sat Jul 21, 2018 7:43 am
Location: Budapest, Hungary
Full name: Gabor Szots

Re: New amateur chess engine Petrel

Post by Gabor Szots »

Will you please incorporate the Jim Ablett fixes so that Windows users, who are the vast majority of users, can also use the engine? Thank you.
Gabor Szots
CCRL testing group
Aleks Peshkov
Posts: 947
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia
Full name: Aleks Peshkov

Re: New amateur chess engine Petrel

Post by Aleks Peshkov »

Version 2.1.

https://github.com/AleksPeshkov/petrel/ ... s/tag/v2.1

I hope this release fixes all platform compatibility issues.
I added code that should improve performance on ARM64 platform (+25% NPS or more). But cannot test it myself.
User avatar
Gabor Szots
Posts: 1466
Joined: Sat Jul 21, 2018 7:43 am
Location: Budapest, Hungary
Full name: Gabor Szots

Re: New amateur chess engine Petrel

Post by Gabor Szots »

Aleks Peshkov wrote: Mon Oct 13, 2025 6:03 pm Version 2.1.

https://github.com/AleksPeshkov/petrel/ ... s/tag/v2.1

I hope this release fixes all platform compatibility issues.
I added code that should improve performance on ARM64 platform (+25% NPS or more). But cannot test it myself.
Hi Aleks,

I'm still unsuccessful with compiling. This is what I get running the makefile:

clang++: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
C:/msys64/mingw64/bin/ld: C:/msys64/mingw64/bin/../lib/LLVMgold.dll: error loading plugin:
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:124: build/petrel] Error 1
Gabor Szots
CCRL testing group
User avatar
Jim Ablett
Posts: 2309
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: New amateur chess engine Petrel

Post by Jim Ablett »

Gabor Szots wrote: Mon Oct 13, 2025 6:15 pm
Aleks Peshkov wrote: Mon Oct 13, 2025 6:03 pm Version 2.1.

https://github.com/AleksPeshkov/petrel/ ... s/tag/v2.1

I hope this release fixes all platform compatibility issues.
I added code that should improve performance on ARM64 platform (+25% NPS or more). But cannot test it myself.
Hi Aleks,

I'm still unsuccessful with compiling. This is what I get running the makefile:

clang++: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
C:/msys64/mingw64/bin/ld: C:/msys64/mingw64/bin/../lib/LLVMgold.dll: error loading plugin:
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:124: build/petrel] Error 1
Compiles fine for me using msys2 clang+ but I needed to comment out this linker switch in makefile (put # in front of switch) so >

Code: Select all

LDFLAGS += $(LDLIBS) $(BUILD_FLAGS) # -Wl,--no-as-needed
'-Wl,--no-as-needed' not known in Windows version of compiler.

Jim.
User avatar
Gabor Szots
Posts: 1466
Joined: Sat Jul 21, 2018 7:43 am
Location: Budapest, Hungary
Full name: Gabor Szots

Re: New amateur chess engine Petrel

Post by Gabor Szots »

Jim Ablett wrote: Mon Oct 13, 2025 6:49 pmCompiles fine for me using msys2 clang+ but I needed to comment out this linker switch in makefile (put # in front of switch) so >

Code: Select all

LDFLAGS += $(LDLIBS) $(BUILD_FLAGS) # -Wl,--no-as-needed
'-Wl,--no-as-needed' not known in Windows version of compiler.

Jim.
That does not work here it seems.

However, this line worked: clang++ *.cpp -std=c++20 -O3 -march=native -oPetrel_2.1-x64.exe
Gabor Szots
CCRL testing group
Aleks Peshkov
Posts: 947
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia
Full name: Aleks Peshkov

Re: New amateur chess engine Petrel

Post by Aleks Peshkov »

I have built with my project's Makefile with latest MINGW64 with g++ but it is known to make inferior performance comparing to clang++.
My Windows clang++ does not find <algorithm> and probably every other C++20 header so I did not succeed to build with it.
-Wl,--no-as-needed was neccesary 15 years ago for g++. Did not change this line from these times as it never create any warnings.

And I have forgotten how I hated Windows for a programmer.
Aleks Peshkov
Posts: 947
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia
Full name: Aleks Peshkov

Re: New amateur chess engine Petrel

Post by Aleks Peshkov »

Gabor Szots wrote: Mon Oct 13, 2025 9:42 pm However, this line worked: clang++ *.cpp -std=c++20 -O3 -march=native -oPetrel_2.1-x64.exe
PGO build does not add much speed for my code, but LTO does.