You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rust: Prime crate def maps in dependency order before parallel extraction - #23330
↑ Unit tests cover the dependency closure, scheduling order, empty graph, cycles, panic propagation (mutation-checked) and real parallelism (22/22, repeated). ↑ QL subset at 4 threads and a 10k-term deep-expression database create --threads=2 pass; all extractor-tests passed before the rebase. ↓ Crate seeding from a real partial workspace is not tested; speedup of this layer alone not benchmarked; CI pending. ↑ Restacked onto L2 b2ac40c: run_on_threads takes the inline decision before clamping, so singleton batches in both parallel_map and dependency-order priming run on a large-stack worker; fmt, clippy and 22/22 unit tests pass on this head. ↓ QL and integration tests not re-run on this exact head; CI pending. ↑ Restacked onto L2 592a6fb (CI-only change) with the wording-only def-map priming log fix; range-diff otherwise identical; fmt, clippy and 22/22 unit tests pass on this head. ↓ QL and integration tests not re-run on this exact head; CI pending.
Stacked on #23324. Before parallel extraction of the main workspace, computes the def maps of the crates being extracted and their dependencies on the worker threads, in crate-graph dependency order, so workers don't block on the same salsa queries.
New parallel::for_each_in_dependency_order scheduler; spawning shares layer 2's sized-stack helper (run_on_threads) with parallel_map.
Skipped with one thread, and not done in the dependency loop.
Panics while priming are swallowed: the same def map is recomputed and fails as before during extraction. A worker panic in the scheduler stops other workers and propagates.
Timing is an info! log rather than an extraction step, to keep extractor_steps output unchanged.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The scheduler unnecessarily wakes all idle workers on serial dependency chains and treats failed def-map queries as successful, triggering costly retries across dependent crates.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Skip dependents of failed def-map queries
rust/extractor/src/main.rs:295
A failed def-map query is reported to the scheduler as a successful completion, so it starts all of that crate's dependents. If those crates need the failed map, each retries the same failing query and emits another panic before extraction can retry it; a widely shared dependency can therefore turn one failure into many expensive retries. Please mark failed nodes and skip their dependents during priming, while leaving extraction to retry them as intended.
Wake only workers needed for newly ready nodes
rust/extractor/src/parallel.rs:182
On a long dependency chain, each completion makes only one node ready, but this wakes every idle worker to compete for the mutex. With many extraction threads that produces up to one wakeup per worker per crate on the serial critical path. Please wake workers only for newly ready nodes, and broadcast when aborting or when no work remains.
…tion
With more than one extraction thread, compute all crate def maps of a
freshly loaded workspace in dependency order on that many threads. Otherwise
extraction workers compute them lazily and mostly serialize on them.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5d1bdb3a2b3c43ce80bf533edd8fc893
Also synchronize the panic test on worker unwinding instead of a sleep.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5d1bdb3a2b3c43ce80bf533edd8fc893
The count includes crates whose def map failed or was skipped in a cycle.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5d1bdb3a2b3c43ce80bf533edd8fc893
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
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
4d971dc48efe73338ce9a423533166d6d0d603a4↑ QL subset at 4 threads and a 10k-term deep-expression
database create --threads=2pass; all extractor-tests passed before the rebase.↓ Crate seeding from a real partial workspace is not tested; speedup of this layer alone not benchmarked; CI pending.
↑ Restacked onto L2
b2ac40c:run_on_threadstakes the inline decision before clamping, so singleton batches in bothparallel_mapand dependency-order priming run on a large-stack worker; fmt, clippy and 22/22 unit tests pass on this head.↓ QL and integration tests not re-run on this exact head; CI pending.
↑ Restacked onto L2
592a6fb(CI-only change) with the wording-only def-map priming log fix; range-diff otherwise identical; fmt, clippy and 22/22 unit tests pass on this head.↓ QL and integration tests not re-run on this exact head; CI pending.
Stacked on #23324. Before parallel extraction of the main workspace, computes the def maps of the crates being extracted and their dependencies on the worker threads, in crate-graph dependency order, so workers don't block on the same salsa queries.
parallel::for_each_in_dependency_orderscheduler; spawning shares layer 2's sized-stack helper (run_on_threads) withparallel_map.info!log rather than an extraction step, to keepextractor_stepsoutput unchanged.