Solver context reuse#193
Draft
tameware wants to merge 5 commits into
Draft
Conversation
Add a non-owning SolverContext::thread_ptr() accessor and use it at the hot ThreadData access sites in ab_search, quick_tricks, and later_tricks instead of copying the shared_ptr returned by thread(). This removes the atomic reference-count traffic from the inner search loop. Measured on dtest -f hands/list100.txt -s solve -n 14 (14 cores), interleaved against develop to cancel machine drift: ~3-4% lower user and system time with tighter run-to-run variance. Behavior is unchanged; the pointer lifetime is tied to the owning context. Co-authored-by: Cursor <cursoragent@cursor.com>
Honor SetResources thread limits again so batch calc uses strain-aware scheduling and reuses per-slot SolverContexts instead of fresh std::thread workers on every CalcAllTables call. Co-authored-by: Cursor <cursoragent@cursor.com>
Share a worker context pool across calc and solve, route SolveAllBoards through scheduler workers with per-thread thrId, and have dtest call the batch API so parallel solve no longer races on slot 0. Co-authored-by: Cursor <cursoragent@cursor.com>
Delegating to CalcPar/CalcDDtable hit the shared worker pool with TT state left over from earlier tests, breaking CalcParContextVsNonContext on CI. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Provides some significant speedup for most cases. Still not as fast as v2.9. I am mildly concerned about the slowdown for the single-solve non-threaded case, but I figure most uses will be multi-threaded. Some benchmarks – n is number of threads.
thin-lto-speedier branch
solver-context-reuse branch