1
0
Fork 0

Small clean-up, Sept 2021

Closes https://github.com/official-stockfish/Stockfish/pull/3485

No functional change
pull/3734/head
xoto10 2021-05-27 16:04:47 +01:00 committed by Stéphane Nicolet
parent 54a989930e
commit f21a66f70d
7 changed files with 15 additions and 15 deletions

View File

@ -21,6 +21,7 @@ Alexander Kure
Alexander Pagel (Lolligerhans) Alexander Pagel (Lolligerhans)
Alfredo Menezes (lonfom169) Alfredo Menezes (lonfom169)
Ali AlZhrani (Cooffe) Ali AlZhrani (Cooffe)
Andrei Vetrov (proukornew)
Andrew Grant (AndyGrant) Andrew Grant (AndyGrant)
Andrey Neporada (nepal) Andrey Neporada (nepal)
Andy Duplain Andy Duplain

View File

@ -88,7 +88,7 @@ endif
# at the end of the line for flag values. # at the end of the line for flag values.
# #
# Example of use for these flags: # Example of use for these flags:
# make build ARCH=x86-64-avx512 debug=on sanitize="address undefined" # make build ARCH=x86-64-avx512 debug=yes sanitize="address undefined"
### 2.1. General and architecture defaults ### 2.1. General and architecture defaults
@ -517,7 +517,7 @@ ifeq ($(bits),64)
CXXFLAGS += -DIS_64BIT CXXFLAGS += -DIS_64BIT
endif endif
### 3.5 prefetch ### 3.5 prefetch and popcount
ifeq ($(prefetch),yes) ifeq ($(prefetch),yes)
ifeq ($(sse),yes) ifeq ($(sse),yes)
CXXFLAGS += -msse CXXFLAGS += -msse
@ -526,7 +526,6 @@ else
CXXFLAGS += -DNO_PREFETCH CXXFLAGS += -DNO_PREFETCH
endif endif
### 3.6 popcnt
ifeq ($(popcnt),yes) ifeq ($(popcnt),yes)
ifeq ($(arch),$(filter $(arch),ppc64 armv7 armv8 arm64)) ifeq ($(arch),$(filter $(arch),ppc64 armv7 armv8 arm64))
CXXFLAGS += -DUSE_POPCNT CXXFLAGS += -DUSE_POPCNT
@ -537,6 +536,7 @@ ifeq ($(popcnt),yes)
endif endif
endif endif
### 3.6 SIMD architectures
ifeq ($(avx2),yes) ifeq ($(avx2),yes)
CXXFLAGS += -DUSE_AVX2 CXXFLAGS += -DUSE_AVX2
ifeq ($(comp),$(filter $(comp),gcc clang mingw)) ifeq ($(comp),$(filter $(comp),gcc clang mingw))

View File

@ -61,7 +61,7 @@ namespace Stockfish {
namespace Eval { namespace Eval {
bool useNNUE; bool useNNUE;
string eval_file_loaded = "None"; string currentEvalFileName = "None";
/// NNUE::init() tries to load a NNUE network at startup time, or when the engine /// NNUE::init() tries to load a NNUE network at startup time, or when the engine
/// receives a UCI command "setoption name EvalFile value nn-[a-z0-9]{12}.nnue" /// receives a UCI command "setoption name EvalFile value nn-[a-z0-9]{12}.nnue"
@ -90,13 +90,13 @@ namespace Eval {
#endif #endif
for (string directory : dirs) for (string directory : dirs)
if (eval_file_loaded != eval_file) if (currentEvalFileName != eval_file)
{ {
if (directory != "<internal>") if (directory != "<internal>")
{ {
ifstream stream(directory + eval_file, ios::binary); ifstream stream(directory + eval_file, ios::binary);
if (load_eval(eval_file, stream)) if (load_eval(eval_file, stream))
eval_file_loaded = eval_file; currentEvalFileName = eval_file;
} }
if (directory == "<internal>" && eval_file == EvalFileDefaultName) if (directory == "<internal>" && eval_file == EvalFileDefaultName)
@ -111,7 +111,7 @@ namespace Eval {
istream stream(&buffer); istream stream(&buffer);
if (load_eval(eval_file, stream)) if (load_eval(eval_file, stream))
eval_file_loaded = eval_file; currentEvalFileName = eval_file;
} }
} }
} }
@ -123,7 +123,7 @@ namespace Eval {
if (eval_file.empty()) if (eval_file.empty())
eval_file = EvalFileDefaultName; eval_file = EvalFileDefaultName;
if (useNNUE && eval_file_loaded != eval_file) if (useNNUE && currentEvalFileName != eval_file)
{ {
string msg1 = "If the UCI option \"Use NNUE\" is set to true, network evaluation parameters compatible with the engine must be available."; string msg1 = "If the UCI option \"Use NNUE\" is set to true, network evaluation parameters compatible with the engine must be available.";
@ -1081,7 +1081,7 @@ Value Eval::evaluate(const Position& pos) {
Value v; Value v;
if (!Eval::useNNUE) if (!useNNUE)
v = Evaluation<NO_TRACE>(pos).value(); v = Evaluation<NO_TRACE>(pos).value();
else else
{ {

View File

@ -34,7 +34,7 @@ namespace Eval {
Value evaluate(const Position& pos); Value evaluate(const Position& pos);
extern bool useNNUE; extern bool useNNUE;
extern std::string eval_file_loaded; extern std::string currentEvalFileName;
// The default net name MUST follow the format nn-[SHA256 first 12 digits].nnue // The default net name MUST follow the format nn-[SHA256 first 12 digits].nnue
// for the build process (profile-build and fishtest) to work. Do not change the // for the build process (profile-build and fishtest) to work. Do not change the

View File

@ -89,8 +89,8 @@ enum StatsType { NoCaptures, Captures };
typedef Stats<int16_t, 13365, COLOR_NB, int(SQUARE_NB) * int(SQUARE_NB)> ButterflyHistory; typedef Stats<int16_t, 13365, COLOR_NB, int(SQUARE_NB) * int(SQUARE_NB)> ButterflyHistory;
/// At higher depths LowPlyHistory records successful quiet moves near the root /// At higher depths LowPlyHistory records successful quiet moves near the root
/// and quiet moves which are/were in the PV (ttPv). It is cleared with each new /// and quiet moves which are/were in the PV (ttPv). LowPlyHistory is populated during
/// search and filled during iterative deepening. /// iterative deepening and at each new search the data is shifted down by 2 plies
constexpr int MAX_LPH = 4; constexpr int MAX_LPH = 4;
typedef Stats<int16_t, 10692, MAX_LPH, int(SQUARE_NB) * int(SQUARE_NB)> LowPlyHistory; typedef Stats<int16_t, 10692, MAX_LPH, int(SQUARE_NB) * int(SQUARE_NB)> LowPlyHistory;

View File

@ -396,7 +396,7 @@ namespace Stockfish::Eval::NNUE {
actualFilename = filename.value(); actualFilename = filename.value();
else else
{ {
if (eval_file_loaded != EvalFileDefaultName) if (currentEvalFileName != EvalFileDefaultName)
{ {
msg = "Failed to export a net. A non-embedded net can only be saved if the filename is specified"; msg = "Failed to export a net. A non-embedded net can only be saved if the filename is specified";

View File

@ -790,7 +790,6 @@ namespace {
else else
{ {
// In case of null move search use previous static eval with a different sign // In case of null move search use previous static eval with a different sign
// and addition of two tempos
if ((ss-1)->currentMove != MOVE_NULL) if ((ss-1)->currentMove != MOVE_NULL)
ss->staticEval = eval = evaluate(pos); ss->staticEval = eval = evaluate(pos);
else else
@ -1187,6 +1186,7 @@ moves_loop: // When in check, search starts here
{ {
Depth r = reduction(improving, depth, moveCount, rangeReduction > 2); Depth r = reduction(improving, depth, moveCount, rangeReduction > 2);
// Decrease reduction if on the PV (~1 Elo)
if (PvNode) if (PvNode)
r--; r--;
@ -1499,7 +1499,6 @@ moves_loop: // When in check, search starts here
} }
else else
// In case of null move search use previous static eval with a different sign // In case of null move search use previous static eval with a different sign
// and addition of two tempos
ss->staticEval = bestValue = ss->staticEval = bestValue =
(ss-1)->currentMove != MOVE_NULL ? evaluate(pos) (ss-1)->currentMove != MOVE_NULL ? evaluate(pos)
: -(ss-1)->staticEval; : -(ss-1)->staticEval;