Skip to content

Commit 38adb48

Browse files
pb00068zamar
authored andcommitted
Distinct iteration paths for Lazy SMP threads
STC 5+0.1, threads 7 LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 6026 W: 1047 L: 901 D: 4078 LTC: 20+0.2, threads 7 LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 19739 W: 2910 L: 2721 D: 14108 STC 5+0.1, threads 20 LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 2493 W: 462 L: 331 D: 1700 LTC 30+0.3, threads 20 ELO: 8.86 +-3.7 (95%) LOS: 100.0% Total: 8000 W: 1076 L: 872 D: 6052 Bench: 8012530 Resolves #525
1 parent 2c1797a commit 38adb48

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/search.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,29 @@ void Thread::search() {
387387
// Iterative deepening loop until requested to stop or target depth reached
388388
while (++rootDepth < DEPTH_MAX && !Signals.stop && (!Limits.depth || rootDepth <= Limits.depth))
389389
{
390-
// Set up the new depth for the helper threads
390+
// Set up the new depth for the helper threads skipping in average each
391+
// 2nd ply (using a half density map similar to a Hadamard matrix).
391392
if (!isMainThread)
392-
rootDepth = std::min(DEPTH_MAX - ONE_PLY, Threads.main()->rootDepth + Depth(int(2.2 * log(1 + this->idx))));
393+
{
394+
int d = rootDepth + rootPos.game_ply();
395+
396+
if (idx <= 6 || idx > 24)
397+
{
398+
if (((d + idx) >> (msb(idx + 1) - 1)) % 2)
399+
continue;
400+
}
401+
else
402+
{
403+
// Table of values of 6 bits with 3 of them set
404+
static const int HalfDensityMap[] = {
405+
0x07, 0x0b, 0x0d, 0x0e, 0x13, 0x16, 0x19, 0x1a, 0x1c,
406+
0x23, 0x25, 0x26, 0x29, 0x2c, 0x31, 0x32, 0x34, 0x38
407+
};
408+
409+
if ((HalfDensityMap[idx - 7] >> (d % 6)) & 1)
410+
continue;
411+
}
412+
}
393413

394414
// Age out PV variability metric
395415
if (isMainThread)

0 commit comments

Comments
 (0)