]> git.sesse.net Git - stockfish/commitdiff
Revert per-thread history tables
authorMarco Costalba <mcostalba@gmail.com>
Thu, 2 Jul 2009 00:54:17 +0000 (01:54 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 2 Jul 2009 05:29:25 +0000 (06:29 +0100)
Testing on Joona QUAD failed to give any
advantage. Actually we had a little loss:

Mod - Orig: 342.0 - 374.0

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp
src/thread.h

index 70bd1eab463968717a38c9262a65409baada9a09..6c9060191964bd219b1119bc29e09f63e5fe4ce6 100644 (file)
@@ -271,6 +271,9 @@ namespace {
   int NodesSincePoll;
   int NodesBetweenPolls = 30000;
 
   int NodesSincePoll;
   int NodesBetweenPolls = 30000;
 
+  // History table
+  History H;
+
 
   /// Functions
 
 
   /// Functions
 
@@ -289,10 +292,10 @@ namespace {
   bool move_is_killer(Move m, const SearchStack& ss);
   Depth extension(const Position& pos, Move m, bool pvNode, bool capture, bool check, bool singleReply, bool mateThreat, bool* dangerous);
   bool ok_to_do_nullmove(const Position& pos);
   bool move_is_killer(Move m, const SearchStack& ss);
   Depth extension(const Position& pos, Move m, bool pvNode, bool capture, bool check, bool singleReply, bool mateThreat, bool* dangerous);
   bool ok_to_do_nullmove(const Position& pos);
-  bool ok_to_prune(const Position& pos, Move m, Move threat, Depth d, const History& H);
+  bool ok_to_prune(const Position& pos, Move m, Move threat, Depth d);
   bool ok_to_use_TT(const TTEntry* tte, Depth depth, Value beta, int ply);
   bool ok_to_history(const Position& pos, Move m);
   bool ok_to_use_TT(const TTEntry* tte, Depth depth, Value beta, int ply);
   bool ok_to_history(const Position& pos, Move m);
-  void update_history(const Position& pos, Move m, Depth depth, History& H, Move movesSearched[], int moveCount);
+  void update_history(const Position& pos, Move m, Depth depth, Move movesSearched[], int moveCount);
   void update_killers(Move m, SearchStack& ss);
 
   bool fail_high_ply_1();
   void update_killers(Move m, SearchStack& ss);
 
   bool fail_high_ply_1();
@@ -629,9 +632,7 @@ namespace {
 
     // Initialize
     TT.new_search();
 
     // Initialize
     TT.new_search();
-    for (int i = 0; i < THREAD_MAX; i++)
-        Threads[i].H.clear();
-
+    H.clear();
     for (int i = 0; i < 3; i++)
     {
         ss[i].init(i);
     for (int i = 0; i < 3; i++)
     {
         ss[i].init(i);
@@ -1043,7 +1044,7 @@ namespace {
 
     // Initialize a MovePicker object for the current position, and prepare
     // to search all moves
 
     // Initialize a MovePicker object for the current position, and prepare
     // to search all moves
-    MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H, &ss[ply]);
+    MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply]);
 
     Move move, movesSearched[256];
     int moveCount = 0;
 
     Move move, movesSearched[256];
     int moveCount = 0;
@@ -1172,7 +1173,7 @@ namespace {
         Move m = ss[ply].pv[ply];
         if (ok_to_history(pos, m)) // Only non capture moves are considered
         {
         Move m = ss[ply].pv[ply];
         if (ok_to_history(pos, m)) // Only non capture moves are considered
         {
-            update_history(pos, m, depth, Threads[threadID].H, movesSearched, moveCount);
+            update_history(pos, m, depth, movesSearched, moveCount);
             update_killers(m, ss[ply]);
         }
         TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_LOWER, depth, m);
             update_killers(m, ss[ply]);
         }
         TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_LOWER, depth, m);
@@ -1304,7 +1305,7 @@ namespace {
 
     // Initialize a MovePicker object for the current position, and prepare
     // to search all moves.
 
     // Initialize a MovePicker object for the current position, and prepare
     // to search all moves.
-    MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H, &ss[ply]);
+    MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply]);
 
     Move move, movesSearched[256];
     int moveCount = 0;
 
     Move move, movesSearched[256];
     int moveCount = 0;
@@ -1341,7 +1342,7 @@ namespace {
       {
           // History pruning. See ok_to_prune() definition
           if (   moveCount >= 2 + int(depth)
       {
           // History pruning. See ok_to_prune() definition
           if (   moveCount >= 2 + int(depth)
-              && ok_to_prune(pos, move, ss[ply].threatMove, depth, Threads[threadID].H))
+              && ok_to_prune(pos, move, ss[ply].threatMove, depth))
               continue;
 
           // Value based pruning
               continue;
 
           // Value based pruning
@@ -1431,7 +1432,7 @@ namespace {
         Move m = ss[ply].pv[ply];
         if (ok_to_history(pos, m)) // Only non capture moves are considered
         {
         Move m = ss[ply].pv[ply];
         if (ok_to_history(pos, m)) // Only non capture moves are considered
         {
-            update_history(pos, m, depth, Threads[threadID].H, movesSearched, moveCount);
+            update_history(pos, m, depth, movesSearched, moveCount);
             update_killers(m, ss[ply]);
         }
         TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_LOWER, depth, m);
             update_killers(m, ss[ply]);
         }
         TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_LOWER, depth, m);
@@ -1524,7 +1525,7 @@ namespace {
     // Initialize a MovePicker object for the current position, and prepare
     // to search the moves.  Because the depth is <= 0 here, only captures,
     // queen promotions and checks (only if depth == 0) will be generated.
     // Initialize a MovePicker object for the current position, and prepare
     // to search the moves.  Because the depth is <= 0 here, only captures,
     // queen promotions and checks (only if depth == 0) will be generated.
-    MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H);
+    MovePicker mp = MovePicker(pos, ttMove, depth, H);
     Move move;
     int moveCount = 0;
     Bitboard dcCandidates = mp.discovered_check_candidates();
     Move move;
     int moveCount = 0;
     Bitboard dcCandidates = mp.discovered_check_candidates();
@@ -1665,7 +1666,7 @@ namespace {
           && !moveIsCapture
           && !move_is_promotion(move)
           &&  moveCount >= 2 + int(sp->depth)
           && !moveIsCapture
           && !move_is_promotion(move)
           &&  moveCount >= 2 + int(sp->depth)
-          &&  ok_to_prune(pos, move, ss[sp->ply].threatMove, sp->depth, Threads[threadID].H))
+          &&  ok_to_prune(pos, move, ss[sp->ply].threatMove, sp->depth))
         continue;
 
       // Make and search the move.
         continue;
 
       // Make and search the move.
@@ -2274,7 +2275,7 @@ namespace {
   // non-tactical moves late in the move list close to the leaves are
   // candidates for pruning.
 
   // non-tactical moves late in the move list close to the leaves are
   // candidates for pruning.
 
-  bool ok_to_prune(const Position& pos, Move m, Move threat, Depth d, const History& H) {
+  bool ok_to_prune(const Position& pos, Move m, Move threat, Depth d) {
 
     assert(move_is_ok(m));
     assert(threat == MOVE_NONE || move_is_ok(threat));
 
     assert(move_is_ok(m));
     assert(threat == MOVE_NONE || move_is_ok(threat));
@@ -2354,7 +2355,7 @@ namespace {
   // update_history() registers a good move that produced a beta-cutoff
   // in history and marks as failures all the other moves of that ply.
 
   // update_history() registers a good move that produced a beta-cutoff
   // in history and marks as failures all the other moves of that ply.
 
-  void update_history(const Position& pos, Move m, Depth depth, History& H,
+  void update_history(const Position& pos, Move m, Depth depth,
                       Move movesSearched[], int moveCount) {
 
     H.success(pos.piece_on(move_from(m)), move_to(m), depth);
                       Move movesSearched[], int moveCount) {
 
     H.success(pos.piece_on(move_from(m)), move_to(m), depth);
index 558a6752da9c679cfa59f6c4b614356703df2680..dc839d441518d51f2f7204b7b6a5adbdbbcda8f7 100644 (file)
@@ -26,7 +26,6 @@
 //// Includes
 ////
 
 //// Includes
 ////
 
-#include "history.h"
 #include "lock.h"
 #include "movepick.h"
 #include "position.h"
 #include "lock.h"
 #include "movepick.h"
 #include "position.h"
@@ -74,7 +73,6 @@ struct Thread {
   volatile bool idle;
   volatile bool workIsWaiting;
   volatile bool printCurrentLine;
   volatile bool idle;
   volatile bool workIsWaiting;
   volatile bool printCurrentLine;
-  History H;
   unsigned char pad[64]; // set some distance among local data for each thread
 };
 
   unsigned char pad[64]; // set some distance among local data for each thread
 };