From 22ef36803ed0f1597d8f40731c6e2d3aa01debf2 Mon Sep 17 00:00:00 2001 From: protonspring Date: Wed, 13 Feb 2019 14:58:43 -0700 Subject: [PATCH] Remove PvNode dimension from Reductions array This is a functional simplification: if we simply subtract one to Reductions[] when PvNode is set, we can remove this dimension of the multidimensional array. I think this saves about 8K of memory. STC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 10118 W: 2282 L: 2138 D: 5698 http://tests.stockfishchess.org/tests/view/5c6332b60ebc5925cffbdfed LTC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 70765 W: 11617 L: 11575 D: 47573 http://tests.stockfishchess.org/tests/view/5c63379e0ebc5925cffbe0de Closes https://github.com/official-stockfish/Stockfish/pull/2010 Bench 3261078 --- src/search.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index bbb6e5c4..dbfb9469 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -73,10 +73,10 @@ namespace { // Futility and reductions lookup tables, initialized at startup int FutilityMoveCounts[2][16]; // [improving][depth] - int Reductions[2][2][64][64]; // [pv][improving][depth][moveNumber] + int Reductions[2][64][64]; // [improving][depth][moveNumber] template Depth reduction(bool i, Depth d, int mn) { - return Reductions[PvNode][i][std::min(d / ONE_PLY, 63)][std::min(mn, 63)] * ONE_PLY; + return (Reductions[i][std::min(d / ONE_PLY, 63)][std::min(mn, 63)] - PvNode) * ONE_PLY; } // History and stats update bonus, based on depth @@ -162,12 +162,11 @@ void Search::init() { { double r = log(d) * log(mc) / 1.95; - Reductions[NonPV][imp][d][mc] = int(std::round(r)); - Reductions[PV][imp][d][mc] = std::max(Reductions[NonPV][imp][d][mc] - 1, 0); + Reductions[imp][d][mc] = std::round(r); // Increase reduction for non-PV nodes when eval is not improving if (!imp && r > 1.0) - Reductions[NonPV][imp][d][mc]++; + Reductions[imp][d][mc]++; } for (int d = 0; d < 16; ++d) -- 2.39.2