1
0
Fork 0

Small clean-ups

- Comment for Countemove pruning -> Continuation history
- Fix comment in input_slice.h
- Shorter lines in Makefile
- Comment for scale factor
- Fix comment for pinners in see_ge()
- Change Thread.id() signature to size_t
- Trailing space in reprosearch.sh
- Add Douglas Matos Gomes to the AUTHORS file
- Introduce comment for undo_null_move()
- Use Stockfish coding style for export_net()
- Change date in AUTHORS file

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

No functional change
pull/3470/head
Stéphane Nicolet 2021-05-17 09:13:34 +02:00
parent 61e1c66b7c
commit f90274d8ce
8 changed files with 31 additions and 26 deletions

View File

@ -1,4 +1,4 @@
# List of authors for Stockfish, as of March 31, 2021 # List of authors for Stockfish, as of May 17, 2021
# Founders of the Stockfish project and fishtest infrastructure # Founders of the Stockfish project and fishtest infrastructure
Tord Romstad (romstad) Tord Romstad (romstad)
@ -52,6 +52,7 @@ Dieter Dobbelaere (ddobbelaere)
DiscanX DiscanX
Dominik Schlösser (domschl) Dominik Schlösser (domschl)
double-beep double-beep
Douglas Matos Gomes (dsmsgms)
Eduardo Cáceres (eduherminio) Eduardo Cáceres (eduherminio)
Eelco de Groot (KingDefender) Eelco de Groot (KingDefender)
Elvin Liu (solarlight2) Elvin Liu (solarlight2)

View File

@ -96,8 +96,7 @@ endif
ifeq ($(ARCH), $(filter $(ARCH), \ ifeq ($(ARCH), $(filter $(ARCH), \
x86-64-vnni512 x86-64-vnni256 x86-64-avx512 x86-64-bmi2 x86-64-avx2 \ x86-64-vnni512 x86-64-vnni256 x86-64-avx512 x86-64-bmi2 x86-64-avx2 \
x86-64-sse41-popcnt x86-64-modern x86-64-ssse3 x86-64-sse3-popcnt \ x86-64-sse41-popcnt x86-64-modern x86-64-ssse3 x86-64-sse3-popcnt \
x86-64 x86-32-sse41-popcnt x86-32-sse2 x86-32 ppc-64 ppc-32 \ x86-64 x86-32-sse41-popcnt x86-32-sse2 x86-32 ppc-64 ppc-32 e2k \
e2k \
armv7 armv7-neon armv8 apple-silicon general-64 general-32)) armv7 armv7-neon armv8 apple-silicon general-64 general-32))
SUPPORTED_ARCH=true SUPPORTED_ARCH=true
else else
@ -840,8 +839,7 @@ config-sanity: net
@test "$(optimize)" = "yes" || test "$(optimize)" = "no" @test "$(optimize)" = "yes" || test "$(optimize)" = "no"
@test "$(SUPPORTED_ARCH)" = "true" @test "$(SUPPORTED_ARCH)" = "true"
@test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \ @test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \
test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || \ test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || test "$(arch)" = "e2k" || \
test "$(arch)" = "e2k" || \
test "$(arch)" = "armv7" || test "$(arch)" = "armv8" || test "$(arch)" = "arm64" test "$(arch)" = "armv7" || test "$(arch)" = "armv8" || test "$(arch)" = "arm64"
@test "$(bits)" = "32" || test "$(bits)" = "64" @test "$(bits)" = "32" || test "$(bits)" = "64"
@test "$(prefetch)" = "yes" || test "$(prefetch)" = "no" @test "$(prefetch)" = "yes" || test "$(prefetch)" = "no"

View File

@ -114,24 +114,28 @@ namespace Eval {
} }
} }
/// NNUE::export_net() exports the currently loaded network to a file
void NNUE::export_net(const std::optional<std::string>& filename) { void NNUE::export_net(const std::optional<std::string>& filename) {
std::string actualFilename; std::string actualFilename;
if (filename.has_value()) {
actualFilename = filename.value(); if (filename.has_value())
} else { actualFilename = filename.value();
if (eval_file_loaded != EvalFileDefaultName) { else
sync_cout << "Failed to export a net. A non-embedded net can only be saved if the filename is specified." << sync_endl; {
return; if (eval_file_loaded != EvalFileDefaultName)
} {
actualFilename = EvalFileDefaultName; sync_cout << "Failed to export a net. A non-embedded net can only be saved if the filename is specified." << sync_endl;
return;
}
actualFilename = EvalFileDefaultName;
} }
ofstream stream(actualFilename, std::ios_base::binary); ofstream stream(actualFilename, std::ios_base::binary);
if (save_eval(stream)) {
if (save_eval(stream))
sync_cout << "Network saved successfully to " << actualFilename << "." << sync_endl; sync_cout << "Network saved successfully to " << actualFilename << "." << sync_endl;
} else { else
sync_cout << "Failed to export a net." << sync_endl; sync_cout << "Failed to export a net." << sync_endl;
}
} }
/// NNUE::verify() verifies that the last net used was loaded successfully /// NNUE::verify() verifies that the last net used was loaded successfully
@ -927,7 +931,7 @@ namespace {
Color strongSide = eg > VALUE_DRAW ? WHITE : BLACK; Color strongSide = eg > VALUE_DRAW ? WHITE : BLACK;
int sf = me->scale_factor(pos, strongSide); int sf = me->scale_factor(pos, strongSide);
// If scale factor is not already specific, scale down via general heuristics // If scale factor is not already specific, scale up/down via general heuristics
if (sf == SCALE_FACTOR_NORMAL) if (sf == SCALE_FACTOR_NORMAL)
{ {
if (pos.opposite_bishops()) if (pos.opposite_bishops())

View File

@ -53,7 +53,7 @@ class InputSlice {
return true; return true;
} }
// Read network parameters // Write network parameters
bool write_parameters(std::ostream& /*stream*/) const { bool write_parameters(std::ostream& /*stream*/) const {
return true; return true;
} }

View File

@ -988,7 +988,7 @@ void Position::do_castling(Color us, Square from, Square& to, Square& rfrom, Squ
} }
/// Position::do(undo)_null_move() is used to do(undo) a "null move": it flips /// Position::do_null_move() is used to do a "null move": it flips
/// the side to move without executing any move on the board. /// the side to move without executing any move on the board.
void Position::do_null_move(StateInfo& newSt) { void Position::do_null_move(StateInfo& newSt) {
@ -1027,6 +1027,9 @@ void Position::do_null_move(StateInfo& newSt) {
assert(pos_is_ok()); assert(pos_is_ok());
} }
/// Position::undo_null_move() must be used to undo a "null move"
void Position::undo_null_move() { void Position::undo_null_move() {
assert(!checkers()); assert(!checkers());
@ -1092,8 +1095,8 @@ bool Position::see_ge(Move m, Value threshold) const {
if (!(stmAttackers = attackers & pieces(stm))) if (!(stmAttackers = attackers & pieces(stm)))
break; break;
// Don't allow pinned pieces to attack (except the king) as long as // Don't allow pinned pieces to attack as long as there are
// there are pinners on their original square. // pinners on their original square.
if (pinners(~stm) & occupied) if (pinners(~stm) & occupied)
stmAttackers &= ~blockers_for_king(stm); stmAttackers &= ~blockers_for_king(stm);

View File

@ -862,7 +862,6 @@ namespace {
&& ttValue != VALUE_NONE && ttValue != VALUE_NONE
&& ttValue < probCutBeta)) && ttValue < probCutBeta))
{ {
assert(probCutBeta < VALUE_INFINITE); assert(probCutBeta < VALUE_INFINITE);
MovePicker mp(pos, ttMove, probCutBeta - ss->staticEval, &captureHistory); MovePicker mp(pos, ttMove, probCutBeta - ss->staticEval, &captureHistory);
@ -1025,7 +1024,7 @@ moves_loop: // When in check, search starts from here
} }
else else
{ {
// Countermoves based pruning (~20 Elo) // Continuation history based pruning (~20 Elo)
if ( lmrDepth < 4 if ( lmrDepth < 4
&& (*contHist[0])[movedPiece][to_sq(move)] < CounterMovePruneThreshold && (*contHist[0])[movedPiece][to_sq(move)] < CounterMovePruneThreshold
&& (*contHist[1])[movedPiece][to_sq(move)] < CounterMovePruneThreshold) && (*contHist[1])[movedPiece][to_sq(move)] < CounterMovePruneThreshold)
@ -1528,7 +1527,7 @@ moves_loop: // When in check, search starts from here
[pos.moved_piece(move)] [pos.moved_piece(move)]
[to_sq(move)]; [to_sq(move)];
// CounterMove based pruning // Continuation history based pruning
if ( !captureOrPromotion if ( !captureOrPromotion
&& bestValue > VALUE_TB_LOSS_IN_MAX_PLY && bestValue > VALUE_TB_LOSS_IN_MAX_PLY
&& (*contHist[0])[pos.moved_piece(move)][to_sq(move)] < CounterMovePruneThreshold && (*contHist[0])[pos.moved_piece(move)][to_sq(move)] < CounterMovePruneThreshold

View File

@ -55,7 +55,7 @@ public:
void idle_loop(); void idle_loop();
void start_searching(); void start_searching();
void wait_for_search_finished(); void wait_for_search_finished();
int id() const { return idx; } size_t id() const { return idx; }
Pawns::Table pawnsTable; Pawns::Table pawnsTable;
Material::Table materialTable; Material::Table materialTable;