Perft on a GPU can even go faster. This is done with an implementation that dispatches parts of the search-tree to the GPU.
Code: Select all
GPU NVIDIA RTX PRO 4500 Blackwell, 82 multiprocessors, table 16384 MiB, expands 2 plies; table 1024 MiB on the CPU;
Items of depth 5, in levels (64 threads, 4096 MiB), table from depth 2
W:W31-50:B1-20
perft 1 9 0.172 s 0.0 Mn/s
perft 2 81 0.001 s 0.1 Mn/s
perft 3 658 0.001 s 1.0 Mn/s
perft 4 4,265 0.001 s 6.1 Mn/s
perft 5 27,117 0.002 s 16.2 Mn/s
perft 6 167,140 0.002 s 78.6 Mn/s
perft 7 1,049,442 0.003 s 408.3 Mn/s
perft 8 6,483,961 0.004 s 1690.4 Mn/s
perft 9 41,022,423 0.006 s 6538.3 Mn/s
perft 10 258,895,763 0.013 s 20421.7 Mn/s
perft 11 1,665,861,398 0.026 s 63309.2 Mn/s
perft 12 10,749,771,911 0.069 s 155698.6 Mn/s
perft 13 70,612,863,532 0.202 s 349922.7 Mn/s
perft 14 465,829,118,473 0.669 s 695792.9 Mn/s
perft 15 3,120,929,044,364 2.127 s 1466987.4 Mn/s
B:W6,9-11,20-23,30,K31,33,37,41-44,46:BK17,K24
perft 1 14 0.171 s 0.0 Mn/s
perft 2 55 0.003 s 0.0 Mn/s
perft 3 1,168 0.002 s 0.5 Mn/s
perft 4 5,432 0.003 s 2.1 Mn/s
perft 5 87,195 0.004 s 19.7 Mn/s
perft 6 629,010 0.003 s 209.4 Mn/s
perft 7 9,041,010 0.004 s 2140.3 Mn/s
perft 8 86,724,219 0.005 s 16084.2 Mn/s
perft 9 1,216,917,193 0.010 s 124010.7 Mn/s
perft 10 13,106,503,411 0.017 s 767705.8 Mn/s
perft 11 183,848,651,744 0.035 s 5268579.2 Mn/s
perft 12 2,026,297,454,724 0.062 s 32533141.8 Mn/s
perft 13 28,502,670,196,300 0.112 s 255554381.8 Mn/s
perft 14 313,784,387,653,341 0.184 s 1704362514.2 Mn/s
perft 15 4,430,269,571,799,228 0.221 s 20020333509.4 Mn/s
perft 16 48,503,253,678,553,099 0.236 s 205619843648.5 Mn/s
perft 17 687,472,692,301,956,095 1.367 s 502739944492.3 Mn/s
perft 18 7,487,262,800,279,254,994 0.907 s 8250999215570.2 Mn/s
W:W25,27-28,30,32-35,37-38:B12-14,16,18-19,21,23-24,26
perft 1 6 0.167 s 0.0 Mn/s
perft 2 12 0.001 s 0.0 Mn/s
perft 3 30 0.001 s 0.0 Mn/s
perft 4 73 0.001 s 0.1 Mn/s
perft 5 215 0.001 s 0.2 Mn/s
perft 6 590 0.002 s 0.4 Mn/s
perft 7 1,944 0.002 s 1.1 Mn/s
perft 8 6,269 0.002 s 2.9 Mn/s
perft 9 22,369 0.003 s 8.6 Mn/s
perft 10 88,050 0.004 s 23.3 Mn/s
perft 11 377,436 0.004 s 92.0 Mn/s
perft 12 1,910,989 0.005 s 363.2 Mn/s
perft 13 9,872,645 0.009 s 1138.2 Mn/s
perft 14 58,360,286 0.017 s 3489.3 Mn/s
perft 15 346,184,885 0.034 s 10059.7 Mn/s
perft 16 2,272,406,115 0.092 s 24828.4 Mn/s
perft 17 14,962,263,728 0.269 s 55578.3 Mn/s
perft 18 106,965,577,859 0.852 s 125510.1 Mn/s
The current implementation uses 128 bit counters and a 128 bit hash, a perfect hash would be better, but this will take more space. When running the calculation twice with a different hash-function gives the same result, the chance that the result is wrong is almost zero.
The next improvement will be sending the FEN to the GPU and to do all the calculations on the GPU alone, this is way more difficult to get working than the current implementation.