hash eval, hash pawn or twice ?

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Daniel Anulliero
Posts: 624
Joined: Fri Jan 04, 2013 3:55 pm
Location: Nice

hash eval, hash pawn or twice ?

Post by Daniel Anulliero » Sat Mar 19, 2016 9:59 am

Hi all !
I've implemented hash eval in Isa , very easy to do and seems working very well .But I wonder if it's useful to implement hash pawns too , or it's better to implement hash pawns instead of hash eval ?
I've seen CPW have twice in his eval , I don't understand why it is useful to have twice in the eval , because in hash eval we have evaluation of pawn structure , right?
All the Bests
Dany

User avatar
hgm
Posts: 22274
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: hash eval, hash pawn or twice ?

Post by hgm » Sat Mar 19, 2016 10:21 am

The point is that the hashed evaluation is only valid for a single position, while the hashed Pawn evaluation would be shared by millions of positions. Evaluating Pawn structure is usually pretty expensive, so being able to fetch it from a table in 99% of the cases would give a significant speedup.

User avatar
Kotlov
Posts: 175
Joined: Fri Jul 10, 2015 7:23 pm
Location: Russia

Re: hash eval, hash pawn or twice ?

Post by Kotlov » Sat Mar 19, 2016 10:44 am

Daniel Anulliero wrote:Hi all !
I've implemented hash eval in Isa , very easy to do and seems working very well .But I wonder if it's useful to implement hash pawns too , or it's better to implement hash pawns instead of hash eval ?
I've seen CPW have twice in his eval , I don't understand why it is useful to have twice in the eval , because in hash eval we have evaluation of pawn structure , right?
All the Bests
Dany
I think both at once

Daniel Anulliero
Posts: 624
Joined: Fri Jan 04, 2013 3:55 pm
Location: Nice

Re: hash eval, hash pawn or twice ?

Post by Daniel Anulliero » Sat Mar 19, 2016 1:37 pm

hgm wrote:The point is that the hashed evaluation is only valid for a single position, while the hashed Pawn evaluation would be shared by millions of positions. Evaluating Pawn structure is usually pretty expensive, so being able to fetch it from a table in 99% of the cases would give a significant speedup.
Aah yes true never thought about that ! 😊
When the engine analyse 24 queen moves for exemple , the pawn structure never change (or just for a capture)
Ok I'll try that too
Thanks

User avatar
cdani
Posts: 2047
Joined: Sat Jan 18, 2014 9:24 am
Location: Andorra
Contact:

Re: hash eval, hash pawn or twice ?

Post by cdani » Sat Mar 19, 2016 3:03 pm

Daniel Anulliero wrote:
hgm wrote:The point is that the hashed evaluation is only valid for a single position, while the hashed Pawn evaluation would be shared by millions of positions. Evaluating Pawn structure is usually pretty expensive, so being able to fetch it from a table in 99% of the cases would give a significant speedup.
Aah yes true never thought about that ! 😊
When the engine analyse 24 queen moves for exemple , the pawn structure never change (or just for a capture)
Ok I'll try that too
Thanks
Also your pawn evaluation should be at least a bit complicated for you to win something relevant; I suppose is like this.
In Andscacs the pawn hash if 2 MB. Seems enough for it.

bob
Posts: 20342
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: hash eval, hash pawn or twice ?

Post by bob » Sat Mar 19, 2016 3:17 pm

Daniel Anulliero wrote:Hi all !
I've implemented hash eval in Isa , very easy to do and seems working very well .But I wonder if it's useful to implement hash pawns too , or it's better to implement hash pawns instead of hash eval ?
I've seen CPW have twice in his eval , I don't understand why it is useful to have twice in the eval , because in hash eval we have evaluation of pawn structure , right?
All the Bests
Dany
Pawn hash is worth it as you will see beyond 95% hits, where eval cache won't be anywhere near that (pawn hash would normally only use pawn positions to compute the signature, eval cache would use normal hash signature). This produces a far greater number of hits for pawns than for the full eval.

Henk
Posts: 5101
Joined: Mon May 27, 2013 8:31 am

Re: hash eval, hash pawn or twice ?

Post by Henk » Sat Mar 19, 2016 3:26 pm

For evaluation of passers it is worthless for pawn table does not tell if passed pawn is blocked by a knight.

bob
Posts: 20342
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: hash eval, hash pawn or twice ?

Post by bob » Sat Mar 19, 2016 5:24 pm

Henk wrote:For evaluation of passers it is worthless for pawn table does not tell if passed pawn is blocked by a knight.
However it CAN store a record of which pawns are passed, so you don't have to do THAT part of the passed pawn evaluation...

Daniel Anulliero
Posts: 624
Joined: Fri Jan 04, 2013 3:55 pm
Location: Nice

Re: hash eval, hash pawn or twice ?

Post by Daniel Anulliero » Sun Mar 20, 2016 8:57 pm

Thanks to HGM, daniel josé and Bob for your answers !

Well I've implemented the pawn hash today and made some tests , the two versions , with and without pawn hash (too few tests for the moment , it take some time
:wink: )

In the first test I had 330 ms of speed gain
5 moves , one depth more
In the second only 65ms
12 moves , one depth more.

In the first test, 3 times (out of 41 moves), two diferents moves (collisions or search instability?)
In the second test , 6 times (out of 71 moves) two diférents moves (collisions or search instability?)

To be continued ...
:)

bob
Posts: 20342
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: hash eval, hash pawn or twice ?

Post by bob » Sun Mar 20, 2016 10:26 pm

Daniel Anulliero wrote:Thanks to HGM, daniel josé and Bob for your answers !

Well I've implemented the pawn hash today and made some tests , the two versions , with and without pawn hash (too few tests for the moment , it take some time
:wink: )

In the first test I had 330 ms of speed gain
5 moves , one depth more
In the second only 65ms
12 moves , one depth more.

In the first test, 3 times (out of 41 moves), two diferents moves (collisions or search instability?)
In the second test , 6 times (out of 71 moves) two diférents moves (collisions or search instability?)

To be continued ...
:)
Pawn hash should change absolutely nothing but speed. If that's not true, you definitely have a bug. Node count should remain identical, as should the score, PV and everything else. You should see an improvement in speed proportional to the time spent in pawn evaluation. If pawn evaluation takes 10% of the execution time when you do a profile run, the pawn hash version should run 10% faster since the pawn eval will hardly ever be executed...

A simple debug test is to look up the pawn eval in hash, save it, then compute the REAL eval anyway and compare the two results. If they are not the same, fix the bug.

Post Reply