Hashed perft on a single Ryzen 9 9950X3D, how fast can it go?

Discussion of chess software programming and technical issues.

Moderator: Ras

vtlmks
Posts: 5
Joined: Fri Aug 07, 2026 4:59 am
Full name: Peter Fors

Hashed perft on a single Ryzen 9 9950X3D, how fast can it go?

Post by vtlmks »

In my previous post I presented the single-threaded raw-perft version of Mindchess. Naturally, I then became curious about how far the same move generator could be pushed on a single Ryzen 9 9950X3D, using all 32 hardware threads and a transposition table.

The current result for start-position perft 10 is:

Code: Select all

Depth:          10
Nodes:          69,352,859,712,417
Time:           25.721 seconds
Logical rate:   2.696 trillion nodes/second
Threads:        32
TT:             48 GiB
This was measured with stock boost and DDR5-4800. The binary was built with Clang 22 PGO and used explicit 1 GiB pages.

Since this is hashed perft, the node rate is a logical rate: TT hits reuse completed subtree counts rather than physically visiting all 69 trillion leaves.

The part I found most interesting was that the TT was nowhere near saturating memory bandwidth. It used only about 21 GB/s, or 27.5% of the theoretical DDR5-4800 bandwidth. Random-access latency was the dominant problem.

To overlap more of that latency, I added batching when recursion reaches remaining depth 3. Each worker generates the depth-2 child positions into a queue, then processes that queue while prefetching TT buckets 20 positions ahead of consumption. The move generator, TT keys, lookup semantics and replacement policy remain unchanged.

That reduced the median from 30.059 to 25.721 seconds, a 14.43% improvement. IPC increased from 2.11 to 2.54 and measured L3 misses fell from 8.20 to 6.18 billion.

For another same-machine reference, MPerft 5.3 with its Clang PGO build completed the same calculation in 36.883 seconds.

Table allocation, zeroing and first-touch are outside the timer. Task generation, thread creation, calculation, joining and result reduction are included.

While expanding the validation suite I found and fixed two correctness defects in the earlier version. The current raw and hashed paths pass the 25-position suite with GCC and Clang, including sanitizer and collision-stress testing.

Source, build scripts, reproduction commands and the experiments that did not work:

https://github.com/vtlmks/mindchess

I am curious how this compares with other current CPU perft implementations, and particularly whether anyone has tried a similar batched-TT approach. There is probably still quite a lot hidden in the latency problem.
chessbit
Posts: 48
Joined: Fri Dec 29, 2023 4:47 pm
Location: Belgium
Full name: thomas albert

Re: Hashed perft on a single Ryzen 9 9950X3D, how fast can it go?

Post by chessbit »

Hello fellow perft enthusiast,
Your results seem promising so far.
My best result on my engine (chessbit) is ~19s perft 10 with a Ryzen 7 9800x3d (so only 16 threads) and 16GB TT. For this depth, a larger TT doesn't help I believe. You can check it out here: https://github.com/thuijbregts/chessbit ... rdstate_tt
I don't have the means to test with 32 threads so not sure if it would go twice as fast or less (probably more like 1.5).
vtlmks
Posts: 5
Joined: Fri Aug 07, 2026 4:59 am
Full name: Peter Fors

Re: Hashed perft on a single Ryzen 9 9950X3D, how fast can it go?

Post by vtlmks »

Thanks! I pulled the boardstate_tt branch and tested it on my 9950X3D.

With an 8 GiB TT I get:

Code: Select all

16 threads / 8 cores: 22.290 s
32 threads / 16 cores: 12.020 s
So your 1.5x estimate was actually conservative here; 16 -> 32 threads gives about 1.85x.

That is substantially faster than my current Mindchess result, so I definitely have something to chase now.

Looking through the branch, the largest difference seems to be the aggressive depth-2 arithmetic evaluator. My current implementation is much more conservative there, so I am investigating how much of that approach I can reproduce while retaining the existing legality handling and validation suite.

Thanks for pointing me at the branch. This is exactly the sort of comparison I was hoping to get from this thread.
chessbit
Posts: 48
Joined: Fri Dec 29, 2023 4:47 pm
Location: Belgium
Full name: thomas albert

Re: Hashed perft on a single Ryzen 9 9950X3D, how fast can it go?

Post by chessbit »

Thanks for the comparison, I was quite curious what time it would produce on 32 threads :)

I haven't had the time to go through your code, but I guess you don't have the null move implementation? I discovered it recently from another user and this was a massive gain. For a perft engine where speed is your only goal, this was a massive gain for me (~50% overall, and ~100% from the initial position). This is the depth 2 logic.

Good luck on beating the time!
vtlmks
Posts: 5
Joined: Fri Aug 07, 2026 4:59 am
Full name: Peter Fors

Re: Hashed perft on a single Ryzen 9 9950X3D, how fast can it go?

Post by vtlmks »

Yes, I did not have the null/depth-2 aggregation when I made the original post. After looking through boardstate_tt and following your hint, I implemented a version that retains Mindchess’s existing legality handling. You were right: it was a very large gain.

I also found a separate TT problem. After some double pawn pushes, I was treating equivalent positions as different because I retained an en-passant square even when no capture was possible. Fixing that recovered many transpositions.

Current start-position perft(10) results on the 9950X3D are:

Code: Select all

8 GiB TT, PGO:  9.854 s   7.038 T logical nodes/s
32 GiB TT, PGO: 9.418 s   7.364 T logical nodes/s
For a capacity-matched comparison, your boardstate_tt build completed it in 12.020 seconds on the same machine with 32 threads and an 8 GiB TT.

The new Mindchess version still passes the complete 25-position validation suite, and start-position depth 10 returns the exact 69,352,859,712,417 nodes.

Thanks for pointing me toward the depth-2 approach. Your 12.020-second run on my machine was exactly the kind of target I needed. Without something faster to compare against, I probably would have stopped much earlier.

I’m pushing the updated source now. The TT build no longer requires reserved 1 GiB pages: it can use ordinary pages, transparent huge pages, or explicit 1 GiB hugetlb pages.
chessbit
Posts: 48
Joined: Fri Dec 29, 2023 4:47 pm
Location: Belgium
Full name: thomas albert

Re: Hashed perft on a single Ryzen 9 9950X3D, how fast can it go?

Post by chessbit »

Impressive results. Congratulations!
I have to check what you have done more for that, or maybe you can write here some novel ideas you added to go so fast?
For now I moved on to a chess engine implementation but I'll come back to the perft engine in the future.