Compare commits
2 Commits
7ae6604e10
...
7e65fbc205
Author | SHA1 | Date | |
---|---|---|---|
7e65fbc205 | |||
cf77a78aa6 |
20
Makefile
20
Makefile
@@ -159,22 +159,22 @@ ifeq ($(build),release)
|
||||
#CFLAGS += -g
|
||||
#CFLAGS += -ginline-points # inlined funcs debug info
|
||||
LDFLAGS += -flto
|
||||
else ifeq ($(build),perf)
|
||||
CFLAGS += -O3
|
||||
CFLAGS += -ggdb0 # symbols (gdb, perf, etc.)
|
||||
CFLAGS += -ginline-points # inlined funcs debug info
|
||||
CFLAGS += -funroll-loops
|
||||
else ifeq ($(build),dev)
|
||||
CFLAGS += -Og
|
||||
CFLAGS += -g # symbols (gdb, perf, etc.)
|
||||
CFLAGS += -O1
|
||||
CFLAGS += -ggdb # symbols (gdb, perf, etc.)
|
||||
CFLAGS += -ginline-points # inlined funcs debug info
|
||||
#CFLAGS += -pg # gprof
|
||||
# Next one may be useful for valgrind (when invalid instructions)
|
||||
#CFLAGS += -mno-tbm
|
||||
else ifeq ($(build),perf)
|
||||
CFLAGS += -O3
|
||||
CFLAGS += -g # symbols (gdb, perf, etc.)
|
||||
CFLAGS += -ginline-points # inlined funcs debug info
|
||||
CFLAGS += -funroll-loops
|
||||
else ifeq ($(build),debug)
|
||||
CFLAGS += -Og
|
||||
CFLAGS += -g # symbols (gdb, perf, etc.)
|
||||
CFLAGS += -ginline-points # inlined funcs debug info
|
||||
CFLAGS += -O0 # -Og hides some variables
|
||||
CFLAGS += -ggdb3 # symbols (including macro)
|
||||
#CFLAGS += -ginline-points # inlined funcs debug info
|
||||
# for gprof
|
||||
#CFLAGS += -pg
|
||||
# Next one may be useful for valgrind (when invalid instructions)
|
||||
|
@@ -16,9 +16,10 @@
|
||||
|
||||
#include <brlib.h> /* brlib types */
|
||||
|
||||
#define ONE 1ul
|
||||
#define U64(const_u64) const_u64##UL
|
||||
#define BIT(i) ( (u64) (ONE << (i)) )
|
||||
#define BIT(i) ( U64(1) << (i) )
|
||||
#define BIT_NONE ( U64(0) )
|
||||
#define BIT_ALL ( ~BIT_NONE )
|
||||
|
||||
#define BOARDSIZE (8*8)
|
||||
#define GAMESIZE 1024 /* max game size (512 moves) */
|
||||
|
@@ -256,8 +256,7 @@ static const struct pst {
|
||||
* A1 ..... H1
|
||||
*/
|
||||
[PAWN] = {
|
||||
{ /* H1 H8 */
|
||||
/* midgame */
|
||||
{ /* midgame */
|
||||
+0, 0, 0, 0, 0, 0, 0, 0,
|
||||
50, 50, 50, 50, 50, 50, 50, 50,
|
||||
10, 10, 20, 30, 30, 20, 10, 10,
|
||||
@@ -575,8 +574,8 @@ void pst_init(int set)
|
||||
eval_t mid_pc = piece_midval(pt);
|
||||
eval_t end_pc = piece_endval(pt);
|
||||
for (square_t sq = 0; sq < SQUARE_NB; ++sq) {
|
||||
eval_t mid_pst = pst->val[MIDGAME][pt][sq];
|
||||
eval_t end_pst = pst->val[ENDGAME][pt][sq];
|
||||
eval_t mid_pst = pst->val[pt][MIDGAME][sq];
|
||||
eval_t end_pst = pst->val[pt][ENDGAME][sq];
|
||||
|
||||
pst_mg[BLACK][pt][sq] = (mid_pc * wmat + mid_pst * wpst) / 100;
|
||||
pst_eg[BLACK][pt][sq] = (end_pc * wmat + end_pst * wpst) / 100;
|
||||
|
@@ -202,7 +202,7 @@ int tt_create(s32 sizemb)
|
||||
hash_tt.bytes = hash_tt.nbuckets * sizeof(bucket_t);
|
||||
hash_tt.mb = hash_tt.bytes / 1024 / 1024;
|
||||
|
||||
hash_tt.mask = -1ull >> (64 - nbits);
|
||||
hash_tt.mask = BIT_ALL >> (64 - nbits);
|
||||
|
||||
hash_tt.keys = safe_alloc_aligned_hugepage(hash_tt.bytes);
|
||||
|
||||
@@ -295,6 +295,7 @@ hentry_t *tt_probe_perft(const hkey_t key, const u16 depth)
|
||||
/* find key in buckets */
|
||||
for (i = 0; i < ENTRIES_PER_BUCKET; ++i) {
|
||||
entry = bucket->entry + i;
|
||||
bug_on(entry->key && (key & hash_tt.mask) != (entry->key & hash_tt.mask));
|
||||
if (key == entry->key && HASH_PERFT_DEPTH(entry->data) == depth) {
|
||||
hash_tt.hits++;
|
||||
/*
|
||||
@@ -390,7 +391,7 @@ hentry_t *tt_store_perft(const hkey_t key, const u16 depth, const u64 nodes)
|
||||
void tt_info()
|
||||
{
|
||||
if (hash_tt.keys) {
|
||||
printf("TT: Mb:%d buckets:%'lu (bits:%u mask:%#x) entries:%'lu\n",
|
||||
printf("TT: Mb:%d buckets:%'lu (bits:%u mask:%#lx) entries:%'lu\n",
|
||||
hash_tt.mb, hash_tt.nbuckets, hash_tt.nbits,
|
||||
hash_tt.mask, hash_tt.nkeys);
|
||||
} else {
|
||||
|
10
src/hash.h
10
src/hash.h
@@ -76,15 +76,15 @@ typedef struct {
|
||||
|
||||
/* memory size in bytes/mb */
|
||||
size_t bytes;
|
||||
u32 mb;
|
||||
u32 mb;
|
||||
|
||||
/* size in buckets/keys */
|
||||
size_t nbuckets;
|
||||
size_t nkeys; /* nbuckets * NBUCKETS */
|
||||
|
||||
/* internal representation */
|
||||
u32 nbits; /* #buckets in bits, power of 2 */
|
||||
u32 mask; /* nbuckets - 1, key mask */
|
||||
u32 nbits; /* #buckets in bits, power of 2 */
|
||||
u64 mask; /* nbuckets - 1, bucket mask */
|
||||
|
||||
/* stats - unsure about usage */
|
||||
//size_t used_buckets;
|
||||
@@ -106,8 +106,8 @@ typedef struct {
|
||||
|
||||
extern hkey_t zobrist_pieces[16][64];
|
||||
extern hkey_t zobrist_castling[4 * 4 + 1];
|
||||
extern hkey_t zobrist_turn; /* for black, XOR each ply */
|
||||
extern hkey_t zobrist_ep[9]; /* 0-7: ep file, 8: SQUARE_NONE */
|
||||
extern hkey_t zobrist_turn; /* for black, XOR each ply */
|
||||
extern hkey_t zobrist_ep[9]; /* 0-7: ep file, 8: SQUARE_NONE */
|
||||
|
||||
extern hasht_t hash_tt; /* main transposition table */
|
||||
|
||||
|
@@ -198,6 +198,10 @@ struct fentest {
|
||||
/*****************************************************
|
||||
* tests from talkchess *
|
||||
*****************************************************/
|
||||
{ __LINE__, FEN | MOVEGEN | MOVEDO | PERFT,
|
||||
"https://talkchess.com/viewtopic.php?t=21343",
|
||||
"8/k7/3p4/p2P1p2/P2P1P2/8/8/K7 w - - 0 1"
|
||||
},
|
||||
{ __LINE__, FEN | MOVEGEN | MOVEDO | PERFT,
|
||||
"https://www.talkchess.com/forum3/viewtopic.php?f=7&t=71379",
|
||||
"8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1"
|
||||
|
Reference in New Issue
Block a user