Skip to content

Commit

Permalink
Ensure ttValue != VALUE_NONE in singular extension search
Browse files Browse the repository at this point in the history
The assert:

  assert(ttValue != VALUE_NONE);

Could fire for multiple reasons (although is very rare),
for instance after an IID we can have ttMove != MOVE_NONE
while ttValue is still set at VALUE_NONE.

But not only this, actually SMP is a source of corrupted
ttValue and anyhow we can detect the condition:

 ttMove != MOVE_NONE && ttValue == VALUE_NONE

even north of IID.

Reported by Ronald de Man.

It is so rare that bench didn't change.

bench: 7710548
  • Loading branch information
mcostalba committed Jun 21, 2014
1 parent 43efd7f commit e8baf2b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/search.cpp
Expand Up @@ -700,6 +700,7 @@ namespace {
&& depth >= 8 * ONE_PLY
&& abs(beta) < VALUE_KNOWN_WIN
&& ttMove != MOVE_NONE
&& ttValue != VALUE_NONE
&& !excludedMove // Recursive singular search is not allowed
&& (tte->bound() & BOUND_LOWER)
&& tte->depth() >= depth - 3 * ONE_PLY;
Expand Down Expand Up @@ -766,8 +767,6 @@ namespace {
&& !ext
&& pos.legal(move, ci.pinned))
{
assert(ttValue != VALUE_NONE);

Value rBeta = ttValue - int(depth);
ss->excludedMove = move;
ss->skipNullMove = true;
Expand Down

2 comments on commit e8baf2b

@DU-jdto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular reason that IID doesn't update ttValue anyway?

@Kingdefender
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could do that, but the ttMove is more important, for move ordering. The depth of an IID search will often not be enough to allow the node to become a singularExtensionNode;
Depth d = depth - 2 * ONE_PLY - (PvNode ? DEPTH_ZERO : depth / 4);
in IID and the requirement for Singular Extensions is:
&& tte->depth() >= depth - 3 * ONE_PLY;
But it also would not hurt I think, and in PvNodes the IID would have enough depth.

Please sign in to comment.