1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-02 01:29:36 +00:00

Copy only the search stack tail in split()

Only the previous, the current and the next ply SearchStack
are copied.

This reduces split overhead especially at low depth (high ply)
and with many threads.

Possibly no functional change (it is not easy to prove in SMP)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-01-25 11:07:30 +01:00
parent 5ed0a60203
commit 56e09b4cc8

View file

@ -2986,15 +2986,15 @@ namespace {
for (i = 0; i < ActiveThreads; i++)
splitPoint->slaves[i] = 0;
// Copy the current search stack to the master thread
memcpy(splitPoint->sstack[master], sstck, (ply+1) * sizeof(SearchStack));
// Copy the tail of current search stack to the master thread
memcpy(splitPoint->sstack[master] + ply - 1, sstck + ply - 1, 3 * sizeof(SearchStack));
Threads[master].splitPoint = splitPoint;
// Make copies of the current position and search stack for each thread
for (i = 0; i < ActiveThreads && splitPoint->cpus < MaxThreadsPerSplitPoint; i++)
if (thread_is_available(i, master))
{
memcpy(splitPoint->sstack[i], sstck, (ply+1) * sizeof(SearchStack));
memcpy(splitPoint->sstack[i] + ply - 1, sstck + ply - 1, 3 * sizeof(SearchStack));
Threads[i].splitPoint = splitPoint;
splitPoint->slaves[i] = 1;
splitPoint->cpus++;