]> git.sesse.net Git - stockfish/commitdiff
Replace simple eval with psqt in re-eval condition
authorLinmiao Xu <linmiao.xu@gmail.com>
Wed, 17 Jul 2024 04:03:10 +0000 (00:03 -0400)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Tue, 23 Jul 2024 17:24:00 +0000 (19:24 +0200)
As a result, re-eval depends only on smallnet outputs
so an extra call to simple eval can be removed.

Passed non-regression STC:
https://tests.stockfishchess.org/tests/view/669743054ff211be9d4ec232
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 214912 W: 55801 L: 55777 D: 103334
Ptnml(0-2): 746, 24597, 56760, 24593, 760

https://github.com/official-stockfish/Stockfish/pull/5501

Bench: 1440277

src/evaluate.cpp

index d0c553ffc8adee556ba827d53eb73d40c18bd343..221ccde8b8b4d9309087c4eabcc8c52430709b50 100644 (file)
@@ -59,8 +59,7 @@ Value Eval::evaluate(const Eval::NNUE::Networks&    networks,
 
     assert(!pos.checkers());
 
-    int  simpleEval = simple_eval(pos, pos.side_to_move());
-    bool smallNet   = use_smallnet(pos);
+    bool smallNet = use_smallnet(pos);
     int  v;
 
     auto [psqt, positional] = smallNet ? networks.small.evaluate(pos, &caches.small)
@@ -69,7 +68,7 @@ Value Eval::evaluate(const Eval::NNUE::Networks&    networks,
     Value nnue = (125 * psqt + 131 * positional) / 128;
 
     // Re-evaluate the position when higher eval accuracy is worth the time spent
-    if (smallNet && (nnue * simpleEval < 0 || std::abs(nnue) < 227))
+    if (smallNet && (nnue * psqt < 0 || std::abs(nnue) < 227))
     {
         std::tie(psqt, positional) = networks.big.evaluate(pos, &caches.big);
         nnue                       = (125 * psqt + 131 * positional) / 128;