1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 01:03:09 +00:00

Don't insert pv back into tt

This code was added before the accurate pv patch, when
we retrieved PV directly from TT.

It's not required for correct (and long) PVs any more and
should be safe to remove it.

Also, allowing helper threads to repeatedly over-write
TT doesn't seem to make sense(that was probably an un-intended
side-effect of lazy smp). Before Lazy SMP only Main Thread used
to run ID loop and insert PV into TT.

STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 74346 W: 13946 L: 13918 D: 46482

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 47265 W: 6531 L: 6447 D: 34287

bench: 8819179
This commit is contained in:
ajithcj 2016-06-10 18:10:40 +00:00 committed by Marco Costalba
parent 126036abb0
commit 8e45e70e55
2 changed files with 0 additions and 33 deletions

View file

@ -413,11 +413,6 @@ void Thread::search() {
// search the already searched PV lines are preserved. // search the already searched PV lines are preserved.
std::stable_sort(rootMoves.begin() + PVIdx, rootMoves.end()); std::stable_sort(rootMoves.begin() + PVIdx, rootMoves.end());
// Write PV back to the transposition table in case the relevant
// entries have been overwritten during the search.
for (size_t i = 0; i <= PVIdx; ++i)
rootMoves[i].insert_pv_in_tt(rootPos);
// If search has been stopped, break immediately. Sorting and // If search has been stopped, break immediately. Sorting and
// writing PV back to TT is safe because RootMoves is still // writing PV back to TT is safe because RootMoves is still
// valid, although it refers to the previous iteration. // valid, although it refers to the previous iteration.
@ -1564,33 +1559,6 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) {
} }
/// RootMove::insert_pv_in_tt() is called at the end of a search iteration, and
/// inserts the PV back into the TT. This makes sure the old PV moves are searched
/// first, even if the old TT entries have been overwritten.
void RootMove::insert_pv_in_tt(Position& pos) {
StateInfo state[MAX_PLY], *st = state;
bool ttHit;
for (Move m : pv)
{
assert(MoveList<LEGAL>(pos).contains(m));
TTEntry* tte = TT.probe(pos.key(), ttHit);
if (!ttHit || tte->move() != m) // Don't overwrite correct entries
tte->save(pos.key(), VALUE_NONE, BOUND_NONE, DEPTH_NONE,
m, VALUE_NONE, TT.generation());
pos.do_move(m, *st++, pos.gives_check(m, CheckInfo(pos)));
}
for (size_t i = pv.size(); i > 0; )
pos.undo_move(pv[--i]);
}
/// RootMove::extract_ponder_from_tt() is called in case we have no ponder move /// RootMove::extract_ponder_from_tt() is called in case we have no ponder move
/// before exiting the search, for instance, in case we stop the search during a /// before exiting the search, for instance, in case we stop the search during a
/// fail high at root. We try hard to have a ponder move to return to the GUI, /// fail high at root. We try hard to have a ponder move to return to the GUI,

View file

@ -59,7 +59,6 @@ struct RootMove {
bool operator<(const RootMove& m) const { return m.score < score; } // Descending sort bool operator<(const RootMove& m) const { return m.score < score; } // Descending sort
bool operator==(const Move& m) const { return pv[0] == m; } bool operator==(const Move& m) const { return pv[0] == m; }
void insert_pv_in_tt(Position& pos);
bool extract_ponder_from_tt(Position& pos); bool extract_ponder_from_tt(Position& pos);
Value score = -VALUE_INFINITE; Value score = -VALUE_INFINITE;