Ralph Stoesser wrote:
Why not store static eval score in TT (VALUE_TYPE_EVAL) before calling qsearch()?
Disclaimer: I may be wrong. I'm still not very familar with all the details from Stockfish code.
Hi Ralph,
your suggestion is not bad, and is also supported with the actual code
I had not implemented this to avoid overwriting an exsisting valuable TT entry with an eval score. If you look at TranspositionTable::store() in tt.cpp you see:
Code: Select all
if (!tte->key() || tte->key() == posKey32) // empty or overwrite old
{
// Do not overwrite when new type is VALUE_TYPE_EV_LO
if (tte->key() && t == VALUE_TYPE_EV_LO)
return;
...... cut ......
*tte = TTEntry(posKey32, v, t, d, m, generation);
return;
}
So we have two possibilities
1) Leave the code as is and in this case we overwrite any exsisting TT entry (but I don't like it)
2) Modify the code in tt.cpp as:
Code: Select all
// Do not overwrite when new entry is a static evaluation
if (tte->key() && (t & VALUE_TYPE_EVAL))
return;
in this case your suggestion works only when we don't have any exsisting TT entry.
Next step is to _measure_ what we are talking about, so after adding dbg_hit_on() statistical tracing in the code:
Code: Select all
{
Value rbeta = beta - razor_margin(depth);
dbg_hit_on(!tte);
Value v = qsearch(pos, ss, rbeta-1, rbeta, Depth(0), ply, threadID);
if (v < rbeta)
// Logically we should return (v + razor_margin(depth)), but
// surprisingly this did slightly weaker in tests.
return v;
}
we found that on a set of typical positions in the 66% of cases we don't have any pre-exsisting TT entry and so the trick works.
The trick doesn't work for remaining more then 40% of cases. If we think that 60% is enough, the last step is to build up a patch and test the idea on some thousands games
Perhaps I will do, I still don't know, but I just wanted to explicitly write all the steps involved in how a typical modification is analysed, evaluated, and then tested with real games before to be committed: this is how we develop in SF.