Expose the lazy threshold for the feature transformer PSQT as a parameter.

Definition of the lazy threshold moved to evaluate.cpp where all others are.
Lazy threshold only used for real searches, not used for the "eval" call.
This preserves the purity of NNUE evaluation, which is useful to verify
consistency between the engine and the NNUE trainer.

closes https://github.com/official-stockfish/Stockfish/pull/3499

No functional change
This commit is contained in:
Tomasz Sobczyk
2021-05-25 13:09:40 +02:00
committed by Joost VandeVondele
parent e044068b43
commit 9d53129075
4 changed files with 12 additions and 13 deletions

View File

@@ -134,7 +134,7 @@ namespace Stockfish::Eval::NNUE {
}
// Evaluation function. Perform differential calculation.
Value evaluate(const Position& pos, bool adjusted) {
Value evaluate(const Position& pos, bool adjusted, Value lazyThreshold) {
// We manually align the arrays on the stack because with gcc < 9.3
// overaligning stack variables with alignas() doesn't work correctly.
@@ -158,7 +158,7 @@ namespace Stockfish::Eval::NNUE {
ASSERT_ALIGNED(buffer, alignment);
const std::size_t bucket = (pos.count<ALL_PIECES>() - 1) / 4;
const auto [psqt, lazy] = featureTransformer->transform(pos, transformedFeatures, bucket);
const auto [psqt, lazy] = featureTransformer->transform(pos, transformedFeatures, bucket, lazyThreshold);
if (lazy)
return static_cast<Value>(psqt / OutputScale);