All of my attempts to change the move ordering are hurting nps too much, so I decided to test another SMRC setup, this time with smaller steps. The quoted patch lost to slightly tweaked one +198 =586 -216 (LOS=27:72), where the slight tweak was just removing 'fail high' condition and nothing else this time:Vratko Polák wrote:The original stockfish has lost +189 =577 -234 (LOS=6:93), so it looks this patch can be considered better (bayeselo says better by 12+-17 elo, so nothing certain). This patch still has 'fail high' condition in.
Code: Select all
// Step 9. Internal iterative deepening
if ( depth >= IIDDepth[PvNode]
- && ttMove == MOVE_NONE
- && (PvNode || (!isCheck && ss->eval >= beta - IIDMargin)))
+ && ttMove == MOVE_NONE)
{
Depth d = (PvNode ? depth - 2 * OnePly : depth - 4 * OnePly);
Code: Select all
diff -dur src-Ch/search.cpp src-Asm5SmrcCh/search.cpp
--- src-Ch/search.cpp 2010-07-09 13:04:18.000000000 +0200
+++ src-Asm5SmrcCh/search.cpp 2010-08-08 23:18:51.000000000 +0200
@@ -1058,7 +1058,7 @@
const TTEntry* tte;
Key posKey;
Move ttMove, move, excludedMove;
- Depth ext, newDepth;
+ Depth ext, newDepth, oldDepth = depth;
Value bestValue, value, oldAlpha;
Value refinedValue, nullValue, futilityValueScaled; // Non-PV specific
bool isCheck, singleEvasion, singularExtensionNode, moveIsCheck, captureOrPromotion, dangerous;
@@ -1210,7 +1210,9 @@
return nullValue;
ss->skipNullMove = true;
+ (ss-1)->reduction += 5*OnePly;
Value v = search<NonPV>(pos, ss, alpha, beta, depth-5*OnePly, ply);
+ (ss-1)->reduction -= 5*OnePly;
ss->skipNullMove = false;
if (v >= beta)
@@ -1237,10 +1239,9 @@
// Step 9. Internal iterative deepening
if ( depth >= IIDDepth[PvNode]
- && ttMove == MOVE_NONE
- && (PvNode || (!isCheck && ss->eval >= beta - IIDMargin)))
+ && ttMove == MOVE_NONE)
{
- Depth d = (PvNode ? depth - 2 * OnePly : depth / 2);
+ Depth d = (PvNode ? depth - 2 * OnePly : depth - 4 * OnePly);
ss->skipNullMove = true;
search<PvNode>(pos, ss, alpha, beta, d, ply);
@@ -1262,7 +1263,7 @@
&& tte && tte->move()
&& !excludedMove // Do not allow recursive singular extension search
&& is_lower_bound(tte->type())
- && tte->depth() >= depth - 3 * OnePly;
+ && tte->depth() >= depth - 4 * OnePly;
// Step 10. Loop through moves
// Loop through all legal moves until no moves remain or a beta cutoff occurs
@@ -1285,22 +1286,24 @@
// its siblings. To verify this we do a reduced search on all the other moves but the
// ttMove, if result is lower then ttValue minus a margin then we extend ttMove.
if ( singularExtensionNode
- && move == tte->move()
- && ext < OnePly)
+ && move == tte->move())
{
- Value ttValue = value_from_tt(tte->value(), ply);
-
- if (abs(ttValue) < VALUE_KNOWN_WIN)
+ if (abs(alpha) < VALUE_KNOWN_WIN)
{
- Value b = ttValue - SingularExtensionMargin;
+ Value b = alpha - SingularExtensionMargin;
ss->excludedMove = move;
ss->skipNullMove = true;
- Value v = search<NonPV>(pos, ss, b - 1, b, depth / 2, ply);
+ assert((depth + (ss-1)->reduction) / 2 <= depth);
+ Value v = search<NonPV>(pos, ss, b - 1, b, (depth + (ss-1)->reduction) / 2, ply);
ss->skipNullMove = false;
ss->excludedMove = MOVE_NONE;
- if (v < ttValue - SingularExtensionMargin)
+ if (v < alpha - SingularExtensionMargin)
ext = OnePly;
+ else
+ singularExtensionNode = false;
}
+ else
+ singularExtensionNode = false;
}
newDepth = depth - OnePly + ext;
@@ -1396,6 +1399,19 @@
}
}
+ // Singular Move Reduction Cancellation.
+ if ( singularExtensionNode
+ && ttMove == move
+ && (ss-1)->reduction
+ && value >= beta)
+ {
+ depth += (ss-1)->reduction;
+ newDepth += (ss-1)->reduction;
+ assert(PvNode == NonPV);
+ value = newDepth < OnePly ? -qsearch<NonPV>(pos, ss+1, -(alpha+1), -alpha, Depth(0), ply+1)
+ : - search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth, ply+1);
+ }
+
// Step 16. Undo move
pos.undo_move(move);
@@ -1444,7 +1460,7 @@
ValueType f = (bestValue <= oldAlpha ? VALUE_TYPE_UPPER : bestValue >= beta ? VALUE_TYPE_LOWER : VALUE_TYPE_EXACT);
move = (bestValue <= oldAlpha ? MOVE_NONE : ss->bestMove);
- TT.store(posKey, value_to_tt(bestValue, ply), f, depth, move, ss->eval, ei.kingDanger[pos.side_to_move()]);
+ TT.store(posKey, value_to_tt(bestValue, ply), f, oldDepth, move, ss->eval, ei.kingDanger[pos.side_to_move()]);
// Update killers and history only for non capture moves that fails high
if (bestValue >= beta)