mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-26 12:06:22 +08: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:
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user