But that explains the low hit rate.
Pawn hash table, a little disappointment
Moderators: hgm, Rebel, chrisw
-
- Posts: 27793
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
-
- Posts: 1871
- Joined: Sat Nov 25, 2017 2:28 pm
- Location: France
Re: Pawn hash table, a little disappointment
The code is up to date on master branch. The entry size is now 68, i'm using 2Mb pawn table, always replace, using king+pawn hash.
Still not better than without table.
A side effect of this is that I found some issues in eval, but to my surprise, correcting them is not good ... (but correction is present on master as they are logical).
-
- Posts: 584
- Joined: Fri Mar 30, 2018 7:20 am
- Full name: Andreas Matthies
Re: Pawn hash table, a little disappointment
This line in your ::eval() seems strange:
if (!getPawnEntry(*this, computePHash(p), pePtr)) { ...
Seems that by calling computePHash(p) you recalculate the complete pawnhash from scratch?
I checked that you already do "delta-hashing" in your movepiece so recalculating should not be necessary and may cost too much time.
Another strange thing: Even in your applyNull() the ph (pawnhash?) is changed. Why that?
if (!getPawnEntry(*this, computePHash(p), pePtr)) { ...
Seems that by calling computePHash(p) you recalculate the complete pawnhash from scratch?
I checked that you already do "delta-hashing" in your movepiece so recalculating should not be necessary and may cost too much time.
Another strange thing: Even in your applyNull() the ph (pawnhash?) is changed. Why that?
-
- Posts: 1871
- Joined: Sat Nov 25, 2017 2:28 pm
- Location: France
Re: Pawn hash table, a little disappointment
Pawn hash (as well as position hash) are computed on the fly in apply or applyNull and computeHash will early return if already computedRubiChess wrote: ↑Thu Oct 31, 2019 3:56 pm This line in your ::eval() seems strange:
if (!getPawnEntry(*this, computePHash(p), pePtr)) { ...
Seems that by calling computePHash(p) you recalculate the complete pawnhash from scratch?
I checked that you already do "delta-hashing" in your movepiece so recalculating should not be necessary and may cost too much time.
Another strange thing: Even in your applyNull() the ph (pawnhash?) is changed. Why that?
Code: Select all
if (p.ph != 0ull) return p.ph;
In a way, assuming symetric eval, this is probably loosing half of TT ...
-
- Posts: 1871
- Joined: Sat Nov 25, 2017 2:28 pm
- Location: France
Re: Pawn hash table, a little disappointment
Not taking color into account in pawn hash is currently under test.xr_a_y wrote: ↑Thu Oct 31, 2019 5:24 pmPawn hash (as well as position hash) are computed on the fly in apply or applyNull and computeHash will early return if already computedRubiChess wrote: ↑Thu Oct 31, 2019 3:56 pm This line in your ::eval() seems strange:
if (!getPawnEntry(*this, computePHash(p), pePtr)) { ...
Seems that by calling computePHash(p) you recalculate the complete pawnhash from scratch?
I checked that you already do "delta-hashing" in your movepiece so recalculating should not be necessary and may cost too much time.
Another strange thing: Even in your applyNull() the ph (pawnhash?) is changed. Why that?applyNull is xoring zobrist key for color and possible ep but this is bad design (this is because eval is returning score from stm point of view).Code: Select all
if (p.ph != 0ull) return p.ph;
In a way, assuming symetric eval, this is probably loosing half of TT ...
-
- Posts: 584
- Joined: Fri Mar 30, 2018 7:20 am
- Full name: Andreas Matthies
Re: Pawn hash table, a little disappointment
Okay. Missed that first line in computePHash.xr_a_y wrote: ↑Thu Oct 31, 2019 5:24 pm Pawn hash (as well as position hash) are computed on the fly in apply or applyNull and computeHash will early return if already computedapplyNull is xoring zobrist key for color and possible ep but this is bad design (this is because eval is returning score from stm point of view).Code: Select all
if (p.ph != 0ull) return p.ph;
In a way, assuming symetric eval, this is probably loosing half of TT ...
And the side2move dependant hash is probably not the (only) reason for performing bad.
Will have another look...
Andreas