Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove nmpMinPly #5586

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ Value Search::Worker::search(
// Step 9. Null move search with verification search (~35 Elo)
if (cutNode && (ss - 1)->currentMove != Move::null() && eval >= beta
&& ss->staticEval >= beta - 21 * depth + 390 && !excludedMove && pos.non_pawn_material(us)
&& ss->ply >= thisThread->nmpMinPly && beta > VALUE_TB_LOSS_IN_MAX_PLY)
&& beta > VALUE_TB_LOSS_IN_MAX_PLY)
{
assert(eval - beta >= 0);

Expand All @@ -794,18 +794,16 @@ Value Search::Worker::search(
// Do not return unproven mate or TB scores
if (nullValue >= beta && nullValue < VALUE_TB_WIN_IN_MAX_PLY)
{
if (thisThread->nmpMinPly || depth < 16)
if (thisThread->verification || depth < 16)
return nullValue;

assert(!thisThread->nmpMinPly); // Recursive verification is not allowed
assert(!thisThread->verification); // Recursive verification is not allowed

// Do verification search at high depths, with null move pruning disabled
// until ply exceeds nmpMinPly.
thisThread->nmpMinPly = ss->ply + 3 * (depth - R) / 4;
thisThread->verification = true;

Value v = search<NonPV>(pos, ss, beta - 1, beta, depth - R, false);

thisThread->nmpMinPly = 0;
thisThread->verification = false;

if (v >= beta)
return nullValue;
Expand Down
3 changes: 2 additions & 1 deletion src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ class Worker {

size_t pvIdx, pvLast;
std::atomic<uint64_t> nodes, tbHits, bestMoveChanges;
int selDepth, nmpMinPly;
int selDepth;
bool verification;

Value optimism[COLOR_NB];

Expand Down
4 changes: 2 additions & 2 deletions src/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ void ThreadPool::start_thinking(const OptionsMap& options,
{
th->run_custom_job([&]() {
th->worker->limits = limits;
th->worker->nodes = th->worker->tbHits = th->worker->nmpMinPly =
th->worker->bestMoveChanges = 0;
th->worker->nodes = th->worker->tbHits = th->worker->bestMoveChanges = 0;
th->worker->verification = false;
th->worker->rootDepth = th->worker->completedDepth = 0;
th->worker->rootMoves = rootMoves;
th->worker->rootPos.set(pos.fen(), pos.is_chess960(), &th->worker->rootState);
Expand Down
Loading