Thanks for the figures.
I must have something wrong because I try to correct from
Code: Select all
void setEntry(ThreadContext & context, Hash h, Move m, ScoreType s, ScoreType eval, Bound b, DepthType d){
Entry e = {h,m,s,eval,b,d};
e.h ^= e._d;
assert(e.h > 0);
if ( DynamicConfig::disableTT ) return;
++context.stats.counters[Stats::sid_ttInsert];
const size_t index = h&(ttSize-1);
table[index].e[0] = e; // always replace (favour leaf)
Entry * toUpdate = &(table[index].e[1]);
for (unsigned int i = 1 ; i < Bucket::nbBucket ; ++i){ // other replace by depth (and generation ?)
Entry & curEntry = table[index].e[i];
if( curEntry.h == 0 ) { break; }; // fill empty entry
if( curEntry.h == e.h && curEntry.d < e.d ) { toUpdate = &curEntry; break; } // favour high depth or exact bound entry with same hash
else if( curEntry.d < toUpdate->d /*|| curEntry.generation < toUpdate->generation*/ ) toUpdate = &curEntry; // not same hash, replace the oldest or lowest depth
}
*toUpdate = e;
}
to that
Code: Select all
void setEntry(ThreadContext & context, Hash h, Move m, ScoreType s, ScoreType eval, Bound b, DepthType d){
Entry e = {h,m,s,eval,b,d};
e.h ^= e._d;
assert(e.h > 0);
if ( DynamicConfig::disableTT ) return;
++context.stats.counters[Stats::sid_ttInsert];
const size_t index = h&(ttSize-1);
table[index].e[0] = e; // always replace (favour leaf)
Entry * toUpdate = &(table[index].e[1]);
for (unsigned int i = 1 ; i < Bucket::nbBucket ; ++i){ // other replace by depth (and generation ?)
Entry & curEntry = table[index].e[i];
if( curEntry.h == 0 ) { toUpdate = &curEntry; break; }; // fill empty entry
if( curEntry.h == e.h && curEntry.d < e.d ) { toUpdate = &curEntry; break; } // favour high depth or exact bound entry with same hash
else if( curEntry.d < toUpdate->d /*|| curEntry.generation < toUpdate->generation*/ ) toUpdate = &curEntry; // not same hash, replace the oldest or lowest depth
}
*toUpdate = e;
}
which seems less wrong to me. The first version was updating i-1 bucket when the i was never used. The corrected version use i bucket when is was never used before. This patch is loosing 20 Elo at 1min+0.3 TC
Am I missing something, my eyes may not see something obvious.