More accurate 'go nodes' searches at low count
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 13 Nov 2016 10:08:30 +0000 (11:08 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 19 Nov 2016 07:47:41 +0000 (08:47 +0100)
Makes the actual number of nodes searched match closely
the number of nodes requested, by increasing the frequency
of checking the number of nodes searched at low node count.
All other searches retain the default checking frequency of
once per 4096 nodes, and are thus unaffected.

Passed STC as non-regression
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 26643 W: 4766 L: 4655 D: 17222

No functional change.

src/search.cpp

index a74e3f256833c576c4e11f19462367af32f91119..5dff67f2a86f0c0f6d4b2d3375af5676a7507f47 100644 (file)
@@ -573,9 +573,13 @@ namespace {
     if (thisThread->resetCalls.load(std::memory_order_relaxed))
     {
         thisThread->resetCalls = false;
     if (thisThread->resetCalls.load(std::memory_order_relaxed))
     {
         thisThread->resetCalls = false;
-        thisThread->callsCnt = 0;
+        // At low node count increase the checking rate to about 0.1% of nodes
+        // otherwise use a default value.
+        thisThread->callsCnt = Limits.nodes ? std::min(4096LL, Limits.nodes / 1024)
+                                            : 4096;
     }
     }
-    if (++thisThread->callsCnt > 4096)
+
+    if (--thisThread->callsCnt <= 0)
     {
         for (Thread* th : Threads)
             th->resetCalls = true;
     {
         for (Thread* th : Threads)
             th->resetCalls = true;