Skip to content

fix(localsearch): resolve move_thread_count when the phase solves - #224

Merged
blackopsrepl merged 1 commit into
mainfrom
feature/221-lazy-move-threads
Nov 8, 2026
Merged

blackopsrepl merged 1 commit into
mainfrom
feature/221-lazy-move-threads

Conversation

@blackopsrepl

Copy link
Copy Markdown
Collaborator

Closes #221.

Lowering a local-search phase called rayon::current_num_threads(), which starts the global Rayon pool outside one, so compiling any runner with the default move_thread_count = "auto" spawned a thread per core before solving. The lowered phase now keeps the configured MoveThreadCount and resolves it when it solves, on the pool it solves in.

  • Zero-regression gate, cartesian vs v0.24.0: no threads started; allocations, bytes and peak live equal in every trial (main had +4 allocations in 32/51 trials).
  • Test: crates/solverforge-solver/tests/runner_compile_threads.rs (its own binary; fails when lowering resolves the policy).
  • Local gate: EXIT 0, 0 failed.

Lowering a local-search phase resolved move_thread_count through
rayon::current_num_threads(), which starts the global Rayon pool when called
outside one. Compiling any runner with an acceptor-forager local search and
the default move_thread_count = "auto" therefore spawned a thread per core
before anything was solved, and the policy followed the pool the runner was
compiled in rather than the one the phase solves in.

The lowered phase now keeps the configured MoveThreadCount and resolves it
when it solves, on the pool it solves in. The cartesian gate case, which
compiles a local-search runner without solving it, starts no threads again,
and its allocation counts match v0.24.0 in every trial.

Closes #221
@blackopsrepl
blackopsrepl force-pushed the feature/221-lazy-move-threads branch from d708935 to 4faa904 Compare November 8, 2026 21:28
@blackopsrepl
blackopsrepl merged commit 4faa904 into main Nov 8, 2026
14 checks passed
@blackopsrepl
blackopsrepl deleted the feature/221-lazy-move-threads branch November 8, 2026 21:47
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.

Compiling a runner with move_thread_count = "auto" starts the global Rayon pool

1 participant