Reinhard Scharnagl wrote:Hi Uri,
If I understand correctly you have solution that is good when the number of hash entries is not bigger than 2^32
there seems to be a misunderstanding. Probably our identification method might be very similar. The position identification has a total length of 64 bit. But because of some reasons (one is that I am still using a 32 bit system) that identification consists of two 32 bit parts. From one the (initial!) storing address is derived and the non used part of that plus the other 32 bit word are stored within the cached data as a verificaton stuff. Thus the identification is potentially 64 bit.
But I use the cache multi-associative. So the storage place could vary. That tactic costs me about two bits. Additionally (as in my cached Perft example) there are more than one entry used for a single position, e.g. to store data for distinct calculation levels.
Reinhard.
Hi again Reinhard.
I started to write my hash data and
I think that we need the same structure for storing hash in order to compare with your results.
You say that there is more than one entry for different calculation levels but how exactly you do it.
I can think about more than one way to do it.
Suppose for the discussion that you have 2^22 entries.
I can think about the following definition to store only one perft calculation per position and not more than perft 7
perftnums may include all the 4 numbers that you store in the relevant depth and the only condition is that perft<65536
typedef unsigned __int64 BitBoard;
typedef struct tagperftHASHE
{
BitBoard key:42;
int depth:3;
BitBoard perftnums
} perftHASHE;
If I want to store more than one perft calculation then there is some ways to do it.
Way 1:
storing perft 1 perft 2 perft 3 in the same hash key and you have
typedef unsigned __int64 BitBoard;
typedef struct tagperftHASHE
{
BitBoard key:42;
BitBoard perftnum1;
BitBoard perftnum2;
BitBoard perftnum3;
} perftHASHE;
The problem is that you waste memory when you store only one number.
Way 2:storing the depth inside the address.
In that case you may have longer key because instead of using 22 bit of the key position to calculate the storing address you use 3 bits of the calculation level and 19 bits of the key position so you are left with 45 unused bits that you can use and you have the following structure
typedef struct tagperftHASHE
{
BitBoard key:45;
BitBoard perftnums;
} perftHASHE;
The disadvantage is that you can store only 2^19 different positions instead of being able to stroring 2^22 positions.
practically in my chess program when I use hash not to calculate perft I chose the solution of storing all the 64 bits inspite of knowing that
I spend bits that are not needed because the alternatives meant different structure depends on the number of entries in my hash tables and I do not like to release different version for every size of hash.
There may be a better programming solution that will define different structure dependent on the hash size but I do not know how to do it.
Uri