Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: I need your opinion about this hash entry structure

Author: Robert Hyatt

Date: 08:58:07 01/03/04

Go up one level in this thread


On January 03, 2004 at 06:49:49, Bo Persson wrote:

>On January 02, 2004 at 21:52:56, Federico Corigliano wrote:
>
>>My current hash entry uses a struct and needs 40 bits. I calculated that I can
>>optimize the size using two unsigned 64 bits integers with the following
>>distribution:
>>
>>struct hashEntry {
>>    uint64  a;
>>    uint64  b;
>>};
>>
>>Name       Bits    Description                       Access
>>--------------------------------------------------------------------------------
>>Hash key   64      Hash key signature                (entry.a)
>>Depth      10      Position's search depth*          (entry.b >> 54)
>>Score      16      Position's score (-32767...32767) (entry.b >> 38) & 0xffff
>>Move       32      Position's best move              (entry.b >> 6) & 0xffffffff
>>Age        3       Position's age                    (entry.b >> 3) & 0x7
>>Threat     1       Threat's extension flag           (entry.b >> 2) & 0x1
>>Type       2       Upper, lower, exact or none       (entry.b & 0x3)
>>---------------
>>Total:     128 (16 bytes)
>>
>>* I use a value of 16 for a full ply, so the max search depth is 63, pretty
>>sufficient.
>
>You can gain some additional bits by not storing the entire hash key. If you,
>for example, always have at least 2^16 entries in your hash table and use the
>lower 16 bits as the address, you then know that these bits always match so you
>only have to store the remaning 48 bits in the hash entry.
>
>
>Bo Persson

That will fail if you move entries around any.  IE If you use the classic two-
table Belle approach, and when you overwrite the depth-preferred entry, you
might want to copy it to the always-store table.  You will not be able to
do so as you know the rightmost N bits to address the current depth-preferred
entry, but you are missing the next bit required to select an address in the 2x
bigger table.

If you don't migrate from depth to always, then there is no problem whatsoever.




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.