1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00
BadFish/src
gab8192 49ef4c935a Implement accumulator refresh table
For each thread persist an accumulator cache for the network, where each
cache contains multiple entries for each of the possible king squares.
When the accumulator needs to be refreshed, the cached entry is used to more
efficiently update the accumulator, instead of rebuilding it from scratch.
This idea, was first described by Luecx (author of Koivisto) and
is commonly referred to as "Finny Tables".

When the accumulator needs to be refreshed, instead of filling it with
biases and adding every piece from scratch, we...

1. Take the `AccumulatorRefreshEntry` associated with the new king bucket
2. Calculate the features to activate and deactivate (from differences
   between bitboards in the entry and bitboards of the actual position)
3. Apply the updates on the refresh entry
4. Copy the content of the refresh entry accumulator to the accumulator
   we were refreshing
5. Copy the bitboards from the position to the refresh entry, to match
   the newly updated accumulator

Results at STC:
https://tests.stockfishchess.org/tests/view/662301573fe04ce4cefc1386
(first version)
https://tests.stockfishchess.org/tests/view/6627fa063fe04ce4cefc6560
(final)

Non-Regression between first and final:
https://tests.stockfishchess.org/tests/view/662801e33fe04ce4cefc660a

STC SMP:
https://tests.stockfishchess.org/tests/view/662808133fe04ce4cefc667c

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

No functional change
2024-04-24 18:38:20 +02:00
..
incbin Cleanup comments 2023-12-31 19:54:27 +01:00
nnue Implement accumulator refresh table 2024-04-24 18:38:20 +02:00
syzygy Remove global TB variables from search.cpp 2024-01-17 18:05:00 +01:00
benchmark.cpp Restore NPS output for Perft 2024-04-24 18:20:55 +02:00
benchmark.h Restore NPS output for Perft 2024-04-24 18:20:55 +02:00
bitboard.cpp Remove global TB variables from search.cpp 2024-01-17 18:05:00 +01:00
bitboard.h Assorted cleanups 2024-02-11 19:52:00 +01:00
engine.cpp Restore NPS output for Perft 2024-04-24 18:20:55 +02:00
engine.h Restore NPS output for Perft 2024-04-24 18:20:55 +02:00
evaluate.cpp Implement accumulator refresh table 2024-04-24 18:38:20 +02:00
evaluate.h Implement accumulator refresh table 2024-04-24 18:38:20 +02:00
main.cpp Transform search output to engine callbacks 2024-04-05 21:03:58 +02:00
Makefile Remove COMPILER from Makefile 2024-04-11 22:41:35 +02:00
misc.cpp Split UCI into UCIEngine and Engine 2024-04-04 00:15:17 +02:00
misc.h Split UCI into UCIEngine and Engine 2024-04-04 00:15:17 +02:00
movegen.cpp Change the Move enum to a class 2024-01-04 15:51:04 +01:00
movegen.h Change the Move enum to a class 2024-01-04 15:51:04 +01:00
movepick.cpp Tune Search Parameters 2024-04-24 18:24:01 +02:00
movepick.h Add cmath header to movepick.h 2024-03-20 16:36:18 +01:00
perft.h Restore NPS output for Perft 2024-04-24 18:20:55 +02:00
position.cpp Update outdated comments 2024-04-21 14:32:26 +02:00
position.h Assorted cleanups 2024-02-11 19:52:00 +01:00
score.cpp Fix wrong sign for 200 TB score 2024-04-13 22:05:19 +02:00
score.h Fix wrong sign for 200 TB score 2024-04-13 22:05:19 +02:00
search.cpp Implement accumulator refresh table 2024-04-24 18:38:20 +02:00
search.h Implement accumulator refresh table 2024-04-24 18:38:20 +02:00
thread.cpp Remove duplicated Position object in UCIEngine 2024-04-12 19:37:39 +02:00
thread.h Transform search output to engine callbacks 2024-04-05 21:03:58 +02:00
thread_win32_osx.h Refactor NativeThread start_routine 2024-01-21 12:21:01 +01:00
timeman.cpp Refactor elapsed time checks in search 2024-04-21 14:35:01 +02:00
timeman.h Refactor elapsed time checks in search 2024-04-21 14:35:01 +02:00
tt.cpp Tweak TT aging and replacement strategies 2024-04-21 14:50:04 +02:00
tt.h Document TT code more 2024-03-03 15:21:57 +01:00
tune.cpp Consistent use of anonymous namespace 2024-03-20 16:15:37 +01:00
tune.h Split UCI into UCIEngine and Engine 2024-04-04 00:15:17 +02:00
types.h Improve thread voting inefficiencies 2024-02-11 19:55:26 +01:00
uci.cpp Restore NPS output for Perft 2024-04-24 18:20:55 +02:00
uci.h Restore NPS output for Perft 2024-04-24 18:20:55 +02:00
ucioption.cpp Move OnChange callback in Option ctors 2024-01-26 21:00:41 +01:00
ucioption.h Refactor global variables 2024-01-13 19:40:53 +01:00