128bit vs 64bit hash

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
JohnWoe
Posts: 196
Joined: Sat Mar 02, 2013 10:31 pm

128bit vs 64bit hash

Post by JohnWoe » Sat Feb 01, 2020 11:32 pm

These hash collisions threads got me thinking.

Uploaded Sapeli-128bit source code here: https://github.com/SamuraiDangyo/bins/b ... master.zip

So I experimented a bit w/ the latest Sapeli 1.71.
Instead of adding an array and tons of complex code.
I added a new type BITBOARD128 which is 16 bytes. Which is unsigned uint_128t.
I use it for hashing. Moves and the rest are still 64bit. So it works perfectly. Super easy and all asserts are ok. GCC at least supports these types.

First lets test that our types are what they should be:

1.71 64-bit:

Code: Select all

./old -memory
> Sapeli memory usage :

BOARD_T          184 B
HASH_ENTRY_T     16 B
EVAL_HASH        262144 KB ( count: 16777216, key: 16777215 )
GOOD_MOVES_HASH  131072 KB ( count: 8388608, key: 8388607 )

= Total memory   393216 KB
1.71 128bit:

Code: Select all

./sapeli -memory
> Sapeli memory usage :

BOARD_T          192 B
HASH_ENTRY_T     32 B
EVAL_HASH        262144 KB ( count: 8388608, key: 8388607 )
GOOD_MOVES_HASH  131072 KB ( count: 4194304, key: 4194303 )

= Total memory   393216 KB
As expected. BOARD_T is 8 bytes bigger. When BITBOARD -> BITBOARD128.

Some quick 1+0.01 Chess960 games, that it actually works. There is no difference.

Code: Select all

Score of Sapeli-128bit 1.71 vs Sapeli 1.71: 201 - 199 - 105  [0.502] 505
Elo difference: 1.38 +/- 26.98
Finished match
Here is search speed. The 64bit is a lot faster. As expected. Eval hash is 2x bigger on 64bit vs 128bit. So there's that difference.

Sapeli-128bit 1.71 : bench :

Code: Select all

= nodes 104971734 mnps 3.499 time 30.000
Sapeli 1.71 : bench :

Code: Select all

= nodes 122129827 mnps 4.071 time 30.000

Post Reply