Skip to content

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Aug 28, 2025

There's some cruft left over from when we had deep proof trees. We never encounter overflow when evaluating proof trees. Even if the recursion limit is 0, we still only hit the overflow limit when evaluating nested goals of the root. The root goal simply inherits the root_depth of the SearchGraph.

Split evaluate_root_goal_for_proof_tree from the rest of the trait solver. This enables us to simplify the implementation of evaluate_goal_raw and the ProofTreeBuilder as we no longer need to manually track the state of the builder and can instead use separate types for that. It does require making a few internal methods into associated functions taking a delegate and a span instead of the EvalCtxt itself.

I've also split SearchGraph::evaluate_goal and SearchGraph::evaluate_root_goal_for_proof_tree for the same reason. Both functions don't actually share too much code, so by splitting them each version gets significantly easier to read.

Add a query evaluate_root_goal_for_proof_tree_raw to cache proof tree building. This requires arena allocating inspect::Probe. I've added a new type alias I::ProbeRef for this. We may need to adapt this for rust-analyzer? It would definitely be easy to remove the Copy bound here 🤔

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Aug 28, 2025
@lcnr lcnr force-pushed the proof-tree-as-query branch from 095c024 to db6498a Compare August 28, 2025 08:33
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the proof-tree-as-query branch from db6498a to 158414f Compare August 28, 2025 08:54
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr changed the title cleanup proof tree building cleanup proof tree building + prrrrf Aug 28, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Aug 28, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Aug 28, 2025
cleanup proof tree building + prrrrf
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 28, 2025
@rust-bors
Copy link

rust-bors bot commented Aug 28, 2025

☀️ Try build successful (CI)
Build commit: 7f35a84 (7f35a84b7d91434e46c83ca284931b8a93251b56, parent: b41634205b549a62cfa55363d1e00c4143d30033)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7f35a84): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.0%, 0.6%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.2% [-5.8%, -0.8%] 14
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -0.5%, secondary 1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.5% [1.5%, 1.5%] 1
Regressions ❌
(secondary)
3.5% [0.9%, 10.5%] 6
Improvements ✅
(primary)
-1.2% [-1.6%, -0.6%] 3
Improvements ✅
(secondary)
-3.4% [-4.6%, -2.5%] 3
All ❌✅ (primary) -0.5% [-1.6%, 1.5%] 4

Cycles

Results (primary 2.7%, secondary -2.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.7% [2.7%, 2.8%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-3.7%, -1.4%] 13
All ❌✅ (primary) 2.7% [2.7%, 2.8%] 2

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 468.353s -> 465.542s (-0.60%)
Artifact size: 390.65 MiB -> 390.62 MiB (-0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 28, 2025
@lcnr lcnr force-pushed the proof-tree-as-query branch 4 times, most recently from e6f9e26 to b5f4d62 Compare August 29, 2025 07:27
@lcnr lcnr changed the title cleanup proof tree building + prrrrf cleanup and cache proof tree building Aug 29, 2025
@lcnr lcnr marked this pull request as ready for review August 29, 2025 07:27
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 29, 2025

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@lcnr lcnr force-pushed the proof-tree-as-query branch from 936c027 to 0edb22c Compare August 29, 2025 07:35
@compiler-errors
Copy link
Member

@bors r+ rollup=never

@bors
Copy link
Collaborator

bors commented Sep 2, 2025

📌 Commit 0edb22c has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 2, 2025
@bors
Copy link
Collaborator

bors commented Sep 2, 2025

⌛ Testing commit 0edb22c with merge a2c8b0b...

@bors
Copy link
Collaborator

bors commented Sep 2, 2025

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing a2c8b0b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 2, 2025
@bors bors merged commit a2c8b0b into rust-lang:master Sep 2, 2025
11 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Sep 2, 2025
Copy link
Contributor

github-actions bot commented Sep 2, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing f6df223 (parent) -> a2c8b0b (this PR)

Test differences

Show 2 test diffs

2 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard a2c8b0b92c14b02f0b3f96a0d5296f1090dc286b --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. aarch64-apple: 5368.0s -> 6870.7s (28.0%)
  2. x86_64-gnu-llvm-19: 2434.2s -> 2938.5s (20.7%)
  3. x86_64-rust-for-linux: 2609.8s -> 3045.6s (16.7%)
  4. dist-aarch64-apple: 6143.6s -> 7088.5s (15.4%)
  5. x86_64-gnu-llvm-20-1: 3254.3s -> 3710.5s (14.0%)
  6. x86_64-gnu-tools: 3386.3s -> 3788.5s (11.9%)
  7. aarch64-gnu-llvm-19-1: 3309.0s -> 3697.8s (11.8%)
  8. x86_64-gnu-debug: 7409.2s -> 8230.8s (11.1%)
  9. pr-check-2: 2188.9s -> 2427.4s (10.9%)
  10. x86_64-gnu-miri: 4418.9s -> 4838.2s (9.5%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a2c8b0b): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.0% [-5.7%, -0.1%] 15
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -1.5%, secondary 3.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.1% [1.3%, 9.6%] 14
Improvements ✅
(primary)
-1.5% [-1.5%, -1.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.5% [-1.5%, -1.5%] 1

Cycles

Results (primary 2.1%, secondary -2.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.1% [2.1%, 2.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-3.8%, -1.4%] 10
All ❌✅ (primary) 2.1% [2.1%, 2.1%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 467.107s -> 465.026s (-0.45%)
Artifact size: 388.34 MiB -> 388.33 MiB (-0.00%)

@rustbot rustbot removed the perf-regression Performance regression. label Sep 2, 2025
@lcnr lcnr deleted the proof-tree-as-query branch September 3, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants