forked from official-stockfish/Stockfish
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make just one reductions array be used by all workers instead of havi…
…ng separate instances No functional change bench: 2180675
- Loading branch information
Showing
4 changed files
with
15 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d04a538
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.
I think the reason it is not like this is that this would be a problem with the 'library' development, since different instances of the engine, with different number of threads would have different values in the array. It would probably need to be stored at the 'engine' level. @Disservin ?
d04a538
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.
I asked here official-stockfish#4968 (comment) but yes I'm not sure what place is best for the library version. Maybe for the library version Search will be an actual class instead of a namespace?
d04a538
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.
Yeah that version wont do it for the lib version. This might fit into the
SharedState
struct. Tbh the array isn't really that large and the current version might allowfor modifications if someone wants to create different reductions for the different threads. Bit unsure
d04a538
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.
Hmm ok but it looks like the SharedState isn't really stored anywhere. It's just temporarily constructed when setting the ThreadPool.
void Engine::resize_threads() { threads.set({options, threads, tt, networks}, updateContext); }
Seems like we would want to have someplace to store stuff shared by threads eventually so it would be good to figure out where?
Regardless of this patch I mean.
d04a538
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.
mh that is true, im open for ideas otherwise ill have a look in the coming days
d04a538
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.
Thanks. Maybe Search would become a class instead of a namespace so the library version can have multiple instances. We could also keep the SharedState around instead of it being temporary. Not sure what is best though. Sorry if I'm not up to speed on all the functionality the library version is intended to support.
d04a538
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.
We are kinda figuring that out as we make progress right now. One thing we want to avoid is exposing the internal chess logic to user, because otherwise feature requests and what not would start appearing from people who use stockfish as a chess library instead of just using it to communicate with stockfish and full chess support is way more than we need in stockfish really.
Which parts are you referring here to, we already have this class around most of the search related logic
https://github.com/official-stockfish/Stockfish/blob/master/src/search.h#L236
d04a538
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.
I was referring to the Search namespace which could become a class and have one instance per SF instance. The Worker is per thread. Anyway best ignore my suggestions on this right now as I haven't familiarized myself w/ the library stuff much so far.