Buckets for pawn hash?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Buckets for pawn hash?

Post by jwes »

Do people use multiple buckets for pawn hash? Why or why not?
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: Buckets for pawn hash?

Post by cdani »

No because I have not tried. But also at some point I doubled the hash size and if this has improved the engine was so little that I returned to the previous hash size. So I doubt that buckets can add anything, but of course I cannot be sure.
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Buckets for pawn hash?

Post by hgm »

The idea of buckets is that it would make a smaller table give the same performance as a bigger one without buckets. I would be surprised if using buckets of 4 with LRU replacement wouldn't allow you to halve the table size to achieve the same hit rate. The question is how much code complexity it is worth to you to halve the table size. If it would make the table fit in a cache in which it otherwise would not fit,it might be an incentive to try it.
Aleks Peshkov
Posts: 892
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia

Re: Buckets for pawn hash?

Post by Aleks Peshkov »

I personally doubt that pawn hash is good idea from the beginning.
tpetzke
Posts: 686
Joined: Thu Mar 03, 2011 4:57 pm
Location: Germany

Re: Buckets for pawn hash?

Post by tpetzke »

I personally doubt that pawn hash is good idea from the beginning.
It is the hash with the highest hitrate (by far) and saves you to collect all those backward, passed, isolated pawns over and over again.

Because the hitrate is so high the pawn hash size can be small so using buckets is probably not worth it or would further improve it.
Thomas...

=======
http://macechess.blogspot.com - iCE Chess Engine
Aleks Peshkov
Posts: 892
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia

Re: Buckets for pawn hash?

Post by Aleks Peshkov »

tpetzke wrote:
I personally doubt that pawn hash is good idea from the beginning.
It is the hash with the highest hitrate (by far) and saves you to collect all those backward, passed, isolated pawns over and over again.

Because the hitrate is so high the pawn hash size can be small so using buckets is probably not worth it or would further improve it.
1) How much is pawn evaluation from scratch cost comparing to total evaluation cost? How often it is actually needed when lazy evaluation shortcut active?
2) It is always O(1) savings, while regular transposition table can save magnitude of whole search time.
3) Pawn cache "table" with just 1 record would have decent hit rate.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Buckets for pawn hash?

Post by bob »

jwes wrote:Do people use multiple buckets for pawn hash? Why or why not?
The purpose for buckets is to provide better replacement decisions. With a reasonable sized pawn hash and probing just one entry, 99% hit rates are typical. So the effort of searching through a bucket for maybe a 1% hit improvement is almost certainly not worth it...
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Buckets for pawn hash?

Post by hgm »

It depends. If doing the Pawn eval is 100 times more expensive than doing the probe, increasing the hit rate from 99% to 99.5% shaves 25% off your average Pawn-eval time.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Buckets for pawn hash?

Post by bob »

hgm wrote:It depends. If doing the Pawn eval is 100 times more expensive than doing the probe, increasing the hit rate from 99% to 99.5% shaves 25% off your average Pawn-eval time.
Not quite. 99% of the time it has no effect at all, so we are only talking about 1% of the cases.

In the above,

average_time = .99 * 0 + .25 * C * 0.01

where C is the computational cost for a full pawn eval. 25% of 1% is not very big for any reasonable C. And then there is that 0 value for 99% which will go up a bit to manage the buckets. So 99% of the hits are now slower, to speed up 1/4 of the remaining 1%.
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Buckets for pawn hash?

Post by hgm »

Not sure where your 0.25 comes from. The correct calculation would be

0.99 + C*0.01 = 1.99 (C = 100)
0.995 + C*0.005 = 1.495

1.495/1.99 = 75% = 100% - 25%.