Re: c++ class or a c wrapper for the syzygy egtb
Posted: Sat Nov 21, 2015 12:14 am
Seems to work pretty nice!
Thanks a lot!
Thanks a lot!
Computer Chess Club
https://talkchess.com/
Basically, except for qsearch. Also the result is stored in the TT to help minimize the TB queries. See the Gull Syzygy Patch. There are probably more optimal ways of doing it too.flok wrote:So when do you query it?
Do you check every node if total piece_count < x and then check it?
If you want to limit the number of probes, it is best to do that by only probing if remaining_depth >= y (and piece_count <= x), where y is the "probe depth" parameter.flok wrote:So when do you query it?
Do you check every node if total piece_count < x and then check it?
Code: Select all
#0 0x000000000042bf06 in decompress_pairs (d=0x10738b0, idx=<optimized out>) at tbcore.c:1481
#1 0x00000000004306e9 in probe_wdl_table (success=0x7fff50b0633c, pos=<optimized out>) at tbprobe.c:757
#2 probe_ab (pos=pos@entry=0x7fff50b05e90, alpha=alpha@entry=-2, beta=beta@entry=2, success=success@entry=0x7fff50b0633c) at tbprobe.c:1376
#3 0x000000000042ff44 in probe_ab (pos=pos@entry=0x7fff50b068c0, alpha=alpha@entry=-2, beta=beta@entry=2, success=success@entry=0x7fff50b0633c) at tbprobe.c:1362
#4 0x0000000000434161 in probe_dtz_no_ep (success=0x7fff50b0633c, pos=0x7fff50b068c0) at tbprobe.c:1451
#5 probe_dtz (pos=pos@entry=0x7fff50b068c0, success=success@entry=0x7fff50b0633c) at tbprobe.c:1573
#6 0x0000000000435c3e in probe_root (pos=pos@entry=0x7fff50b068c0, score=score@entry=0x7fff50b068bc, results=results@entry=0x7fff50b06990) at tbprobe.c:1660
#7 0x0000000000437a05 in tb_probe_root_impl (white=white@entry=281474977234944, black=black@entry=9024792111874048, kings=kings@entry=9007199255265280,
queens=queens@entry=536870912, rooks=rooks@entry=0, bishops=bishops@entry=0, knights=134217728, pawns=299067162755072, rule50=10, ep=0, turn=true,
results=0x7fff50b06990) at tbprobe.c:1861
#8 0x000000000042a287 in tb_probe_root (_results=0x7fff50b06990, _turn=<optimized out>, _ep=0, _castling=0, _rule50=10, _pawns=299067162755072,
_knights=134217728, _bishops=0, _rooks=0, _queens=536870912, _kings=9007199255265280, _black=9024792111874048, _white=281474977234944) at tbprobe.h:278
#9 query_syzygy_etb (fen=0xfaf270 "8/P4k2/4p3/8/3n1q2/3K4/8/8 w - - 10 1") at fathom.c:809
There is possibly some issue with 6-man (I could not test 6-man). Try recompiling with -fsanitize=address and see what it says if anything.flok wrote:I sometimes get a segfault in the syzygy code:
I agree with you, but i wouldn't call it a API. It's more or less a "proof of concept" and the code breaks a lot of "design" rules.Dann Corbit wrote: The published API has nothing to do with stockfish.
I wrote a bit of code to trigger the problem.basil00 wrote:There is possibly some issue with 6-man (I could not test 6-man). Try recompiling with -fsanitize=address and see what it says if anything.flok wrote:I sometimes get a segfault in the syzygy code:
I could not guess the problem from the stack trace.
Code: Select all
test: tbprobe.c:1504: probe_dtz_no_ep: Assertion `best != 0xFFFF' failed.
#0 0x00007ffff7a68107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007ffff7a694e8 in __GI_abort () at abort.c:89
#2 0x00007ffff7a61226 in __assert_fail_base (fmt=0x7ffff7b97d08 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=assertion@entry=0x40fef0 "best != 0xFFFF", file=file@entry=0x40fee6 "tbprobe.c", line=line@entry=1504,
function=function@entry=0x40f3a0 <__PRETTY_FUNCTION__.31539> "probe_dtz_no_ep") at assert.c:92
#3 0x00007ffff7a612d2 in __GI___assert_fail (assertion=assertion@entry=0x40fef0 "best != 0xFFFF", file=file@entry=0x40fee6 "tbprobe.c", line=line@entry=1504,
function=function@entry=0x40f3a0 <__PRETTY_FUNCTION__.31539> "probe_dtz_no_ep") at assert.c:101
#4 0x000000000040cde6 in probe_dtz_no_ep (success=0x7fffffffd16c, pos=0x7fffffffd170) at tbprobe.c:1504
#5 probe_dtz (pos=pos@entry=0x7fffffffd170, success=success@entry=0x7fffffffd16c) at tbprobe.c:1573
#6 0x000000000040d0f3 in probe_root (pos=pos@entry=0x7fffffffd6f0, score=score@entry=0x7fffffffd6ec, results=results@entry=0x7fffffffd800) at tbprobe.c:1686
#7 0x000000000040ec05 in tb_probe_root_impl (white=white@entry=4503599660925184, black=black@entry=4755801206503243776, kings=kings@entry=144115188075856128,
queens=queens@entry=0, rooks=rooks@entry=0, bishops=bishops@entry=0, knights=4503599627370496, pawns=4611686018460942336, rule50=10, ep=0, turn=true,
results=0x7fffffffd800) at tbprobe.c:1861
#8 0x0000000000401446 in tb_probe_root (_results=0x7fffffffd800, _turn=<optimized out>, _ep=0, _castling=0, _rule50=10, _pawns=4611686018460942336,
_knights=4503599627370496, _bishops=0, _rooks=0, _queens=0, _kings=144115188075856128, _black=4755801206503243776, _white=4503599660925184) at tbprobe.h:278
#9 query_syzygy_etb (fen=fen@entry=0x7fffffffe0a0 "1k4p1/4N3/8/8/1P6/8/K7/8 w - - 10 1") at fathom.c:776
#10 0x0000000000400edf in main (argc=<optimized out>, argv=<optimized out>) at fathom.c:927
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
decompress_pairs (d=0x722000, idx=<optimized out>) at tbcore.c:1515
1515 uint32 code = __builtin_bswap32(*ptr++);
(gdb) bt
#0 decompress_pairs (d=0x722000, idx=<optimized out>) at tbcore.c:1515
#1 0x00000000004078e9 in probe_wdl_table (success=0x7fffffffd16c, pos=<optimized out>) at tbprobe.c:757
#2 probe_ab (pos=pos@entry=0x7fffffffd6f0, alpha=alpha@entry=-2, beta=beta@entry=2, success=success@entry=0x7fffffffd16c) at tbprobe.c:1376
#3 0x000000000040b361 in probe_dtz_no_ep (success=0x7fffffffd16c, pos=0x7fffffffd6f0) at tbprobe.c:1451
#4 probe_dtz (pos=pos@entry=0x7fffffffd6f0, success=success@entry=0x7fffffffd16c) at tbprobe.c:1573
#5 0x000000000040ce3e in probe_root (pos=pos@entry=0x7fffffffd6f0, score=score@entry=0x7fffffffd6ec, results=results@entry=0x7fffffffd800) at tbprobe.c:1660
#6 0x000000000040ec05 in tb_probe_root_impl (white=white@entry=9241386435364261888, black=black@entry=320, kings=kings@entry=18014398509482240,
queens=queens@entry=0, rooks=rooks@entry=0, bishops=bishops@entry=0, knights=4096, pawns=9223372036854775872, rule50=10, ep=0, turn=false,
results=0x7fffffffd800) at tbprobe.c:1861
#7 0x0000000000401446 in tb_probe_root (_results=0x7fffffffd800, _turn=<optimized out>, _ep=0, _castling=0, _rule50=10, _pawns=9223372036854775872,
_knights=4096, _bishops=0, _rooks=0, _queens=0, _kings=18014398509482240, _black=320, _white=9241386435364261888) at tbprobe.h:278
#8 query_syzygy_etb (fen=fen@entry=0x7fffffffe0a0 "7P/6K1/8/8/8/8/k3N3/6p1 b - - 10 1") at fathom.c:776
#9 0x0000000000400edf in main (argc=<optimized out>, argv=<optimized out>) at fathom.c:927
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
0x0000000000403106 in decompress_pairs (d=0x6a6fe0, idx=<optimized out>) at tbcore.c:1481
1481 litidx += d->sizetable[--block] + 1;
(gdb) bt
#0 0x0000000000403106 in decompress_pairs (d=0x6a6fe0, idx=<optimized out>) at tbcore.c:1481
#1 0x00000000004078e9 in probe_wdl_table (success=0x7fffffffd16c, pos=<optimized out>) at tbprobe.c:757
#2 probe_ab (pos=pos@entry=0x7fffffffd6f0, alpha=alpha@entry=-2, beta=beta@entry=2, success=success@entry=0x7fffffffd16c) at tbprobe.c:1376
#3 0x000000000040b361 in probe_dtz_no_ep (success=0x7fffffffd16c, pos=0x7fffffffd6f0) at tbprobe.c:1451
#4 probe_dtz (pos=pos@entry=0x7fffffffd6f0, success=success@entry=0x7fffffffd16c) at tbprobe.c:1573
#5 0x000000000040ce3e in probe_root (pos=pos@entry=0x7fffffffd6f0, score=score@entry=0x7fffffffd6ec, results=results@entry=0x7fffffffd800) at tbprobe.c:1660
#6 0x000000000040ec05 in tb_probe_root_impl (white=white@entry=9232379236109516800, black=black@entry=537395232, kings=kings@entry=9007199254741024,
queens=queens@entry=536870912, rooks=rooks@entry=0, bishops=bishops@entry=0, knights=0, pawns=9223372036855300096, rule50=10, ep=0, turn=true,
results=0x7fffffffd800) at tbprobe.c:1861
#7 0x0000000000401446 in tb_probe_root (_results=0x7fffffffd800, _turn=<optimized out>, _ep=0, _castling=0, _rule50=10, _pawns=9223372036855300096,
_knights=0, _bishops=0, _rooks=0, _queens=536870912, _kings=9007199254741024, _black=537395232, _white=9232379236109516800) at tbprobe.h:278
#8 query_syzygy_etb (fen=fen@entry=0x7fffffffe0a0 "7P/5K2/8/8/5q2/3p4/8/5k2 w - - 10 1") at fathom.c:776
#9 0x0000000000400edf in main (argc=<optimized out>, argv=<optimized out>) at fathom.c:927
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
decompress_pairs (d=0x7534b0, idx=<optimized out>) at tbcore.c:1515
1515 uint32 code = __builtin_bswap32(*ptr++);
(gdb) bt
#0 decompress_pairs (d=0x7534b0, idx=<optimized out>) at tbcore.c:1515
#1 0x00000000004078e9 in probe_wdl_table (success=0x7fffffffd16c, pos=<optimized out>) at tbprobe.c:757
#2 probe_ab (pos=pos@entry=0x7fffffffd170, alpha=alpha@entry=-2, beta=beta@entry=2, success=success@entry=0x7fffffffd16c) at tbprobe.c:1376
#3 0x000000000040b361 in probe_dtz_no_ep (success=0x7fffffffd16c, pos=0x7fffffffd170) at tbprobe.c:1451
#4 probe_dtz (pos=pos@entry=0x7fffffffd170, success=success@entry=0x7fffffffd16c) at tbprobe.c:1573
#5 0x000000000040d0f3 in probe_root (pos=pos@entry=0x7fffffffd6f0, score=score@entry=0x7fffffffd6ec, results=results@entry=0x7fffffffd800) at tbprobe.c:1686
#6 0x000000000040ec05 in tb_probe_root_impl (white=white@entry=33554512, black=black@entry=32772, kings=kings@entry=68, queens=queens@entry=0,
rooks=rooks@entry=0, bishops=bishops@entry=0, knights=33554432, pawns=32784, rule50=10, ep=0, turn=true, results=0x7fffffffd800) at tbprobe.c:1861
#7 0x0000000000401446 in tb_probe_root (_results=0x7fffffffd800, _turn=<optimized out>, _ep=0, _castling=0, _rule50=10, _pawns=32784, _knights=33554432,
_bishops=0, _rooks=0, _queens=0, _kings=68, _black=32772, _white=33554512) at tbprobe.h:278
#8 query_syzygy_etb (fen=fen@entry=0x7fffffffe0a0 "8/8/8/8/1N6/8/7p/2k1P1K1 w - - 10 1") at fathom.c:776
#9 0x0000000000400edf in main (argc=<optimized out>, argv=<optimized out>) at fathom.c:927
Well this is invalid position with pawn on rank 1flok wrote:Some failing FEN-strings:
segfault:
8/R7/P4k2/8/8/8/8/2KP4 w - - 10 1