Skip to content

ignore head usages from ignored candidates #144991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 15, 2025

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Aug 6, 2025

Fixes rust-lang/trait-system-refactor-initiative#210. The test now takes 0.8s to compile, which seems good enough to me. We are actually still walking the entire graph here, we're just avoiding unnecessary reruns.

The basic idea is that if we've only accessed a cycle head inside of a candidate which didn't impact the final result of our goal, we don't need to rerun that cycle head even if is the used provisional result differs from the final result.

We also use this information when rebasing goals over their cycle heads. If a goal doesn't actually depend on the result of that cycle head, rebasing always succeeds. However, we still need to make sure we track the fact that we relied on the cycle head at all to avoid query instability.

It is implemented by tracking the number of HeadUsages for every head while evaluating goals. We then also track the head usages while evaluating a single candidate, which the search graph returns as CandidateHeadUsages. If there is now an always applicable candidate candidate we know that all other candidates with that source did not matter. We then call fn ignore_candidate_head_usages to remove the usages while evaluating this single candidate from the total. If the final HeadUsages end up empty, we know that the result of this cycle head did not matter when evaluating its nested goals.

@lcnr lcnr marked this pull request as draft August 6, 2025 09:54
@rustbot
Copy link
Collaborator

rustbot commented Aug 6, 2025

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 6, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Aug 6, 2025

r? @compiler-errors @BoxyUwU

@rustbot rustbot assigned compiler-errors and unassigned SparrowLii Aug 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 6, 2025

compiler-errors is not on the review rotation at the moment.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@lcnr
Copy link
Contributor Author

lcnr commented Aug 6, 2025

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Aug 6, 2025
…=<try>

ignore usages from ignored candidates
@rust-bors
Copy link

rust-bors bot commented Aug 6, 2025

⌛ Trying commit d49499e with merge 5c09e88

To cancel the try build, run the command @bors try cancel.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 6, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Aug 6, 2025

☀️ Try build successful (CI)
Build commit: 5c09e88 (5c09e883643532880d70eb19836fb01847e0e5f5, parent: dc0bae1db725fbba8524f195f74f680995fd549e)

@rust-timer

This comment has been minimized.

@lcnr lcnr force-pushed the ignore-usages-from-ignored-candidates branch from 420245d to 32de28a Compare August 6, 2025 13:33
@rust-log-analyzer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5c09e88): comparison URL.

Overall result: ❌ regressions - 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.7% [0.2%, 1.1%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 2.5%, 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.5% [2.0%, 3.1%] 2
Regressions ❌
(secondary)
2.8% [2.8%, 2.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.5% [2.0%, 3.1%] 2

Cycles

Results (secondary 0.4%)

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)
2.6% [2.4%, 2.9%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.0% [-3.7%, -2.3%] 2
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 463.057s -> 466.661s (0.78%)
Artifact size: 377.38 MiB -> 377.62 MiB (0.06%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 6, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Aug 7, 2025

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Aug 7, 2025

⌛ Trying commit 2d42758 with merge 3a46227

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Aug 7, 2025
…=<try>

ignore usages from ignored candidates
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 7, 2025
rust-bors bot added a commit that referenced this pull request Aug 12, 2025
…=<try>

ignore head usages from ignored candidates
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 12, 2025
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the ignore-usages-from-ignored-candidates branch from 1bb82cc to 613842e Compare August 12, 2025 10:31
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the ignore-usages-from-ignored-candidates branch from 613842e to c2e2c9e Compare August 12, 2025 11:00
@rust-bors
Copy link

rust-bors bot commented Aug 12, 2025

☀️ Try build successful (CI)
Build commit: 546cb5f (546cb5ff81bf3b99c56bc90236840949825cc3c0, parent: a1531335fe2807715fff569904d99602022643a7)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (546cb5f): 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.1% [0.1%, 0.1%] 2
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 2
Improvements ✅
(secondary)
-0.3% [-0.4%, -0.3%] 3
All ❌✅ (primary) -0.2% [-0.2%, -0.2%] 2

Max RSS (memory usage)

Results (primary 1.3%, secondary 1.4%)

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

mean range count
Regressions ❌
(primary)
1.3% [1.3%, 1.3%] 2
Regressions ❌
(secondary)
1.4% [1.3%, 1.4%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.3% [1.3%, 1.3%] 2

Cycles

Results (primary -2.4%, secondary -4.9%)

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)
- - 0
Improvements ✅
(primary)
-2.4% [-2.7%, -2.0%] 3
Improvements ✅
(secondary)
-4.9% [-4.9%, -4.9%] 1
All ❌✅ (primary) -2.4% [-2.7%, -2.0%] 3

Binary size

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

Bootstrap: 465.439s -> 465.953s (0.11%)
Artifact size: 377.34 MiB -> 377.51 MiB (0.05%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 12, 2025
@lcnr lcnr force-pushed the ignore-usages-from-ignored-candidates branch from c2e2c9e to 37ebce3 Compare August 14, 2025 13:24
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the ignore-usages-from-ignored-candidates branch from 37ebce3 to aa3691e Compare August 14, 2025 13:32
@lcnr lcnr force-pushed the ignore-usages-from-ignored-candidates branch from 7e3e956 to 8afe306 Compare August 14, 2025 14:07
@BoxyUwU
Copy link
Member

BoxyUwU commented Aug 14, 2025

r=me if CI passes

@BoxyUwU BoxyUwU added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 14, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Aug 14, 2025

@bors r=BoxyUwU

uwu

@bors
Copy link
Collaborator

bors commented Aug 14, 2025

📌 Commit 8afe306 has been approved by BoxyUwU

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 14, 2025
@bors
Copy link
Collaborator

bors commented Aug 15, 2025

⌛ Testing commit 8afe306 with merge c018ae5...

@bors
Copy link
Collaborator

bors commented Aug 15, 2025

☀️ Test successful - checks-actions
Approved by: BoxyUwU
Pushing c018ae5 to master...

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

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 ba412a6 (parent) -> c018ae5 (this PR)

Test differences

Show 20 test diffs

Stage 1

  • [ui] tests/ui/traits/next-solver/cycles/many-where-clauses-with-aliases-hang.rs: [missing] -> pass (J0)

Stage 2

  • [ui] tests/ui/traits/next-solver/cycles/many-where-clauses-with-aliases-hang.rs: [missing] -> pass (J1)

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

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard c018ae5389c49cc4bcb8343d80dd8e7323325410 --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. x86_64-apple-1: 6601.9s -> 10539.6s (59.6%)
  2. x86_64-apple-2: 5668.3s -> 3988.7s (-29.6%)
  3. aarch64-apple: 5284.3s -> 6232.4s (17.9%)
  4. dist-powerpc64le-linux-gnu: 5219.4s -> 5755.5s (10.3%)
  5. dist-x86_64-apple: 11475.4s -> 10343.9s (-9.9%)
  6. dist-loongarch64-linux: 6182.5s -> 6767.6s (9.5%)
  7. aarch64-gnu-llvm-19-1: 3643.9s -> 3958.1s (8.6%)
  8. pr-check-1: 1673.6s -> 1794.1s (7.2%)
  9. dist-loongarch64-musl: 5461.5s -> 5077.1s (-7.0%)
  10. dist-aarch64-apple: 7866.2s -> 7324.3s (-6.9%)
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.

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. perf-regression Performance regression. 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.

exponential blowup when rerunning due to changed provisional results
8 participants