diff options
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -30,6 +30,14 @@ int main(int argc, char** argv) { threads_init(&engine_threads, ipc_state.uci_state.threads); threads_link(&engine_threads, &ipc_state); + // initialise the transposition table from the UCI "Hash" option (in MiB). + // pick the smallest power of two (>= 2^4) that fills at least that much memory. + size_t hash_mb = (size_t)ipc_state.uci_state.hash; + u64 buckets = (hash_mb * 1024 * 1024) / sizeof(tbucket_t); + int hash_log2 = 4; + while ((1ULL << (hash_log2 + 1)) <= buckets && hash_log2 < 30) hash_log2++; + ttable_init(&engine_threads.ttable, hash_log2); + engine_messages_init(&ipc_state.engine_messages); goto skip_refresh; waiting_for_go: |
