Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nonlinear2 committed Dec 22, 2024
2 parents 03e1530 + f656fdf commit 6da8372
Show file tree
Hide file tree
Showing 11 changed files with 300 additions and 181 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,28 @@ jobs:
sanitizers:
- name: Run with thread sanitizer
make_option: sanitize=thread
cxx_extra_flags: ""
instrumented_option: sanitizer-thread
- name: Run with UB sanitizer
make_option: sanitize=undefined
cxx_extra_flags: ""
instrumented_option: sanitizer-undefined
- name: Run under valgrind
make_option: ""
cxx_extra_flags: ""
instrumented_option: valgrind
- name: Run under valgrind-thread
make_option: ""
cxx_extra_flags: ""
instrumented_option: valgrind-thread
- name: Run non-instrumented
make_option: ""
cxx_extra_flags: ""
instrumented_option: none
- name: Run with glibcxx assertions
make_option: ""
cxx_extra_flags: -D_GLIBCXX_ASSERTIONS
instrumented_option: non
defaults:
run:
working-directory: src
Expand Down Expand Up @@ -72,7 +81,7 @@ jobs:

- name: ${{ matrix.sanitizers.name }}
run: |
export CXXFLAGS="-O1 -fno-inline"
export CXXFLAGS="-O1 -fno-inline ${{ matrix.sanitizers.cxx_extra_flags }}"
make clean
make -j4 ARCH=x86-64-sse41-popcnt ${{ matrix.sanitizers.make_option }} debug=yes optimize=no build > /dev/null
python3 ../tests/instrumented.py --${{ matrix.sanitizers.instrumented_option }} ./stockfish
8 changes: 0 additions & 8 deletions src/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ Engine::Engine(std::optional<std::string> path) :
NN::NetworkBig({EvalFileDefaultNameBig, "None", ""}, NN::EmbeddedNNUEType::BIG),
NN::NetworkSmall({EvalFileDefaultNameSmall, "None", ""}, NN::EmbeddedNNUEType::SMALL))) {
pos.set(StartFEN, false, &states->back());
capSq = SQ_NONE;

options["Debug Log File"] << Option("", [](const Option& o) {
start_logger(o);
Expand Down Expand Up @@ -125,7 +124,6 @@ std::uint64_t Engine::perft(const std::string& fen, Depth depth, bool isChess960
void Engine::go(Search::LimitsType& limits) {
assert(limits.perft == 0);
verify_networks();
limits.capSq = capSq;

threads.start_thinking(options, pos, states, limits);
}
Expand Down Expand Up @@ -168,7 +166,6 @@ void Engine::set_position(const std::string& fen, const std::vector<std::string>
states = StateListPtr(new std::deque<StateInfo>(1));
pos.set(fen, options["UCI_Chess960"], &states->back());

capSq = SQ_NONE;
for (const auto& move : moves)
{
auto m = UCIEngine::to_move(pos, move);
Expand All @@ -178,11 +175,6 @@ void Engine::set_position(const std::string& fen, const std::vector<std::string>

states->emplace_back();
pos.do_move(m, states->back());

capSq = SQ_NONE;
DirtyPiece& dp = states->back().dirtyPiece;
if (dp.dirty_num > 1 && dp.to[1] == SQ_NONE)
capSq = m.to_sq();
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@

namespace Stockfish {

enum Square : int;

class Engine {
public:
using InfoShort = Search::InfoShort;
Expand Down Expand Up @@ -116,7 +114,6 @@ class Engine {

Position pos;
StateListPtr states;
Square capSq;

OptionsMap options;
ThreadPool threads;
Expand Down
2 changes: 1 addition & 1 deletion src/history.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ using LowPlyHistory = Stats<int16_t, 7183, LOW_PLY_HISTORY_SIZE, int(SQUARE_NB)
using CapturePieceToHistory = Stats<int16_t, 10692, PIECE_NB, SQUARE_NB, PIECE_TYPE_NB>;

// PieceToHistory is like ButterflyHistory but is addressed by a move's [piece][to]
using PieceToHistory = Stats<int16_t, 29952, PIECE_NB, SQUARE_NB>;
using PieceToHistory = Stats<int16_t, 30000, PIECE_NB, SQUARE_NB>;

// ContinuationHistory is the combined history of a given pair of moves, usually
// the current one given a previous one. The nested history table is based on
Expand Down
Loading

0 comments on commit 6da8372

Please sign in to comment.