Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure bestmove is sent when aborting search #539

Merged
merged 3 commits into from
Nov 29, 2018

Conversation

borg323
Copy link
Member

@borg323 borg323 commented Nov 27, 2018

Winboard with polyglot, when stopping pondering, sends the position command very quickly after stop and then sends go while at the same time waiting for bestmove before continuing. This leads to time losses: In some cases lc0 doesn't send bestmove at all when stopping, so the one sent after the final go is taken to be the one after stop and both sides end up waiting until time runs out.

This ensures that a bestmove will always be sent when stopping the search (provided ok_to_respond_bestmove_ is true).

@borg323
Copy link
Member Author

borg323 commented Nov 29, 2018

As suggested on discord, this is replaced by a change to the search destructor that now calls Abort() only when stop_ is false.

@@ -644,7 +644,7 @@ void Search::Wait() {
}

Search::~Search() {
Abort();
if (!stop_.load(std::memory_order_acquire)) Abort();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some thought, I think it's even better to do that in Abort(). If stop_ is already true, just exit (maybe also output log message).
That way if Stop() was called before Abort(), stop wins. Otherwise Abort() wins.

But we don't have situations like this in the code now, so current way is totally fine too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure which version I prefer.

@mooskagh mooskagh merged commit f8f50c7 into LeelaChessZero:master Nov 29, 2018
@borg323 borg323 deleted the tinker branch November 29, 2018 19:18
@borg323 borg323 mentioned this pull request Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants