New fast move generation engine

Discussion of chess software programming and technical issues.

Moderator: Ras

Sapling
Posts: 21
Joined: Sun Oct 13, 2024 7:31 pm
Location: UK
Full name: Tim Jones

New fast move generation engine

Post by Sapling »

I've just released the binaries for the engine used in The Grand Chess Tree project to github.

It has 3 main functions at the moment (I'll be adding more of the features used in TGCT client in future releases):
  • stats - full perft stats, including nodes, captures, ep, castles, checks, mates etc
  • nodes - just the node count, optimized to be a lot faster using bulk counting
  • unique - calculates the number of unique positions reachable at a given depth
On my system these are the speeds reachable using kiwipete:

Code: Select all

stats:6:1024:kiwipete          ~ 250Mnps (single-threaded)
stats_mt:7:1024:32:kiwipete    ~ 4Bnps (multi-threaded)
nodes:7:1024:kiwipete          ~ 4.5Bnps (single-threaded)
nodes_mt:9:1024:32:kiwipete    ~ 85Bnps (multi-threaded)
unique:6:1024:kiwipete         ~ 4m unique positions per second (single-threaded)
Above results were using a AMD Ryzen 9 7950X, though I'd be very interested to hear what speeds people get using other hardware.

You can find releases for windows, linux & osx (including ARM builds) here

Note: It's the 'engine' download for the stand alone application, the 'client' is for contributing to the project.

This is the output of the 'help' command

Code: Select all

commands:
help                                        - this output
stats:<depth>:<mb_hash>:<fen>               - calculates the full perft stats, single-threaded
stats_mt:<depth>:<mb_hash>:<threads>:<fen>  - calculates the full perft stats, multi-threaded
nodes:<depth>:<mb_hash>:<fen>               - calculates the perft nodes, single-threaded
nodes_mt:<depth>:<mb_hash>:<threads>:<fen>  - calculates the perft nodes, multi-threaded
unique:<depth>:<mb_hash>:<fen>              - calculates the number of unique positions, single-threaded
exit                                        - closes the program
clear                                       - clears the console output
parameters:
<depth>    - the number of ply to search up to
<mb_hash>  - the hash table size in MB per thread
<threads>  - the number of threads to use in a multi-threaded command
<fen>      - the fen string for the position to search
special positions can be used in place of their fen:
start      - rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
kiwipete   - r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -
sje        - r4rk1/1pp1qppp/p1np1n2/2b1p1B1/2B1P1b1/P1NP1N2/1PP1QPPP/R4RK1 w - - 0 10
There are still optimizations and features I'll be adding in the next few days / weeks but for now I hope it might be of use to you!
The Grand Chess Tree - Distributed volunteer computing project
Sapling - 3380 ELO [CCRL] UCI chess engine
User avatar
phhnguyen
Posts: 1524
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: New fast move generation engine

Post by phhnguyen »

Congrats for the new contribution! Any work on open source and computer chess in particular will be appreciated!

BTW, testing, checking, and coding are hard jobs, requiring a lot of time and labour. It is better if you do some comparisons with some popular programs such as Stockfish first and post them here, thus we could know how fast/good your program is.
https://banksiagui.com
The most features chess GUI, based on opensource Banksia - the chess tournament manager
imnoumni
Posts: 10
Joined: Sat Dec 02, 2023 4:14 am
Full name: Imno Umni

Re: New fast move generation engine

Post by imnoumni »

I guess it's not possible to not have a hashtable?

Code: Select all

$ ./tgct_engine_0_0_6_linux-x64

nodes:7:1:start
-----results-----
nodes: 3195901860
nps: 441.7m
time: 7235ms
hash: 5060803636482931868
fen: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
-----------------

nodes:7:0:start
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at GrandChessTree.Shared.Board.AccumulateWhitePawnMovesBulk(Int32, Int32, UInt64, UInt64)
   at GrandChessTree.Shared.PerftBulk.PerftRootBulk(GrandChessTree.Shared.Board ByRef, Int32, Boolean)
   at GrandChessTree.Engine.Program.RunPerftNodes(System.String[])
   at GrandChessTree.Engine.Program.Main(System.String[])
Aborted
User avatar
Ajedrecista
Posts: 2097
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Re: New fast move generation engine.

Post by Ajedrecista »

Hello Imno:

There have been some releases since version 0.0.6:

https://github.com/Timmoth/grandchesstree/releases

Though I do not know if they allow hashless computations. I lack BMI2 instructions, so I can not run the counter.

Regards from Spain.

Ajedrecista.