ddugovic / Stockfish

Retired multi-variant fork of popular UCI chess engine; please use Fairy-Stockfish instead
https://github.com/ianfab/Fairy-Stockfish
GNU General Public License v3.0
132 stars 44 forks source link

Crazyhouse Low-ply History #573

Closed ddugovic closed 4 years ago

ddugovic commented 4 years ago

I am unable to locally reproduce this @niklasf @ianfab . It's not caused by today's changes https://travis-ci.org/github/ddugovic/Stockfish/builds/697579147 https://travis-ci.org/github/ddugovic/Stockfish/builds shows when this started to occur.

niklasf commented 4 years ago

To reproduce:

$ cd src
$ export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG" # !!!
$ make clean && make -j2 ARCH=x86-64 optimize=no debug=yes build
$ ./stockfish bench all

Some debug info:

$ gdb --args ./stockfish bench all
[...]
Position: 75/207
info depth 1 seldepth 1 multipv 1 score cp 210 nodes 39 nps 39000 tbhits 0 time 1 pv d2d4
info depth 2 seldepth 2 multipv 1 score cp 256 nodes 78 nps 39000 tbhits 0 time 2 pv d2d4 f6e4 g1f3
info depth 3 seldepth 3 multipv 1 score cp 287 nodes 117 nps 58500 tbhits 0 time 2 pv d2d4 f6e4 c2c3
info depth 4 seldepth 4 multipv 1 score cp 310 nodes 157 nps 52333 tbhits 0 time 3 pv d2d4 f6e4 c2c3
info depth 5 seldepth 5 multipv 1 score cp 497 nodes 220 nps 55000 tbhits 0 time 4 pv d2d4 f6e4 g1f3

Thread 17 "stockfish" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff6652700 (LWP 1023071)]
0x00007ffff7aa8355 in raise () from /usr/lib/libc.so.6
(gdb) backtrace
#0  0x00007ffff7aa8355 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff7a91853 in abort () from /usr/lib/libc.so.6
#2  0x00005555555f7676 in std::__debug::array<StatsEntry<short, 10692>, 4096ul>::operator[] (this=0x55555595a728, __n=4108) at /usr/include/c++/10.1.0/debug/array:163
#3  0x00005555555f7117 in MovePicker::score<(GenType)1> (this=0x7ffff6648080) at movepick.cpp:129
#4  0x00005555555f5a29 in MovePicker::next_move (this=0x7ffff6648080, skipQuiets=false) at movepick.cpp:224
#5  0x0000555555615502 in (anonymous namespace)::search<(<unnamed>::NodeType)0>(Position &, Search::Stack *, Value, Value, Depth, bool) (pos=..., ss=0x7ffff664e738, alpha=639, beta=640, depth=3, cutNode=false)
    at search.cpp:1183
#6  0x00005555556167a6 in (anonymous namespace)::search<(<unnamed>::NodeType)0>(Position &, Search::Stack *, Value, Value, Depth, bool) (pos=..., ss=0x7ffff664e700, alpha=-640, beta=-639, depth=4, cutNode=true)
    at search.cpp:1500
#7  0x0000555555611bd8 in (anonymous namespace)::search<(<unnamed>::NodeType)1>(Position &, Search::Stack *, Value, Value, Depth, bool) (pos=..., ss=0x7ffff664e6c8, alpha=639, beta=1177, depth=5, cutNode=false)
    at search.cpp:1500
#8  0x000055555560ca28 in Thread::search (this=0x55555594fff0) at search.cpp:570
#9  0x000055555560b3c6 in MainThread::search (this=0x55555594fff0) at search.cpp:387
#10 0x000055555562f807 in Thread::idle_loop (this=0x55555594fff0) at thread.cpp:153
#11 0x000055555562eee7 in run_idle_loop (thread=0x55555594fff0) at thread.cpp:33
#12 0x00007ffff7f78422 in start_thread () from /usr/lib/libpthread.so.0
#13 0x00007ffff7b6bbf3 in clone () from /usr/lib/libc.so.6
niklasf commented 4 years ago

git bisect result:

There are only 'skip'ped commits left to test.
The first bad commit could be any of:

fd8e88427b1268bfddc0b2ab72f639f758b7be0b 15e190e9428b21fbfe29ce020c456077dc5fdd04 784263596ff9b01187341274b6f3cbd8971a2d2c d8d4b5256aa9df4090dcad5b3f39ded5584a71fb <- looks like this merge is the first bad commit

ianfab commented 4 years ago

Thanks for debugging. I think now it is clear, because LowPlyHistory also uses from_to as an index, so it needs to have the same dimensions for piece drops as ButterflyHistory:

https://github.com/ddugovic/Stockfish/blob/bd3e68127a249804cf681f1424f28f1169074b96/src/movepick.h#L89-L99

ddugovic commented 4 years ago

Yes, that LowPlyHistory definition must be the root cause and d8d4b52 is the first commit where bench all with default parameters happens to expose it.