Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix LazySMP when searching to a fixed depth.
Currently, helper threads will only search up to the specified depth limit. Now let them search until the main thread has finished the specified depth. On the other hand, we don't want to pick a thread with a higher search depth. This may be considered cheating. ;-) No functional change.
- Loading branch information
dc0030d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcostalba: How is this a "fix" ? There was no bug to begin with. If the user asks to limit the search depth, SF must obey, and I don't see why helper threads should be exempted.
dc0030d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasart this is a bit a philosophical case. For instance, when SF is asked for a limited depth search, should we disable singular extension if it goes beyond depth? Should we disable all qsearch above the limit depth? Well, we don't.
Indeed helper threads with lazy SMP scheme are more similar to the "extension" case; they live mainly to prefill the TT for the main thread to search faster. It is different from the classical YBWC concept in which each slave threads searches a disjointed sub-tree and the best move is peeked out of the best sub-tree. In case of YBWC this patch would probably be not ok, but lazy SMP uses the threads in a very different way: it is only the main thread that returns the best move (note that @joergoster disabled the final "best move loop" in case of depth limit).
dc0030d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to keep the helper threads running as long as the main thread runs but just keep looping them at the Limits.depth and not allow them deeper. That way the main thread can't pull any results from the TT that are based on a deeper search than requested. If you like this approach let me know. I'm happy to attempt the patch.
dc0030d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mstembera But why should we do this? When we are searching with time limit we don't restrict the helper threads either, and all time management decisions are handled by the main thread. This is how SMP in SF is now working. Now we do the same when searching with depth limit. Quite logical imho.
And if somebody wants to measure Stockfish's SMP performance with fixed depth testing, he now gets 100% and not only 70 or 80%. :-)
dc0030d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joergoster
In order to keep the result from being polluted by searches deeper than what was requested. As Marco points out it is a bit philosophical and I agree with him. I'm simply pointing out we have another option is all.
dc0030d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.