Skip to content

Optimize region constraints #144446

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 2 commits into from
Aug 1, 2025
Merged

Conversation

nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Jul 25, 2025

r? @lcnr

@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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jul 25, 2025
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jul 27, 2025
@rust-bors
Copy link

rust-bors bot commented Jul 27, 2025

⌛ Trying commit c7ec775 with merge eb4c1dc

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 Jul 27, 2025
@rust-bors
Copy link

rust-bors bot commented Jul 28, 2025

☀️ Try build successful (CI)
Build commit: eb4c1dc (eb4c1dc9331b928cb400f7da5ada2051b02ac7c5, parent: f8e355c230c6eb7b78ffce6a92fd81f78c890524)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (eb4c1dc): 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)
1.0% [0.7%, 1.2%] 9
Improvements ✅
(primary)
-0.1% [-0.2%, -0.1%] 5
Improvements ✅
(secondary)
-0.7% [-1.0%, -0.3%] 18
All ❌✅ (primary) -0.1% [-0.2%, -0.1%] 5

Max RSS (memory usage)

Results (primary 2.4%, secondary -4.5%)

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

mean range count
Regressions ❌
(primary)
2.4% [1.7%, 3.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.5% [-4.5%, -4.5%] 1
All ❌✅ (primary) 2.4% [1.7%, 3.1%] 2

Cycles

Results (primary -3.6%, secondary -5.3%)

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)
-3.6% [-3.6%, -3.6%] 1
Improvements ✅
(secondary)
-5.3% [-7.3%, -3.4%] 3
All ❌✅ (primary) -3.6% [-3.6%, -3.6%] 1

Binary size

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

Bootstrap: 465.942s -> 467.491s (0.33%)
Artifact size: 376.74 MiB -> 376.87 MiB (0.04%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 28, 2025
@nnethercote nnethercote marked this pull request as ready for review July 30, 2025 22:29
@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 Jul 30, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 30, 2025

Some changes occurred to the core trait solver

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

@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Jul 30, 2025

⌛ Trying commit c7ec775 with merge 047aa5d

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

rust-bors bot added a commit that referenced this pull request Jul 30, 2025
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 30, 2025
@rust-bors
Copy link

rust-bors bot commented Jul 31, 2025

☀️ Try build successful (CI)
Build commit: 047aa5d (047aa5de0f87659075675f4173cfd968f0daeebc, parent: 3048886e59c94470e726ecaaf2add7242510ac11)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (047aa5d): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@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
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 5
Improvements ✅
(secondary)
-0.7% [-1.1%, -0.1%] 19
All ❌✅ (primary) -0.1% [-0.1%, -0.1%] 5

Max RSS (memory usage)

Results (primary -0.3%, secondary 2.9%)

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

mean range count
Regressions ❌
(primary)
1.8% [1.3%, 2.7%] 3
Regressions ❌
(secondary)
2.9% [2.9%, 2.9%] 1
Improvements ✅
(primary)
-2.3% [-3.5%, -0.8%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.3% [-3.5%, 2.7%] 6

Cycles

Results (secondary -2.3%)

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)
- - 0
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 470.294s -> 469.489s (-0.17%)
Artifact size: 376.85 MiB -> 376.89 MiB (0.01%)

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Jul 31, 2025
}
VarValue::Value(a_region) => {
let b_data = var_values.value_mut(b_vid);
VarValue::Value(a_region) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VarValue::Value(a_region) => {
VarValue::Value(sub_region) => {

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, then r=me

If the two regions are the same, we can skip it. This is a small perf win.
This commit changes it to store a `Region` instead of a `RegionVid` for the `Var` cases:
- We avoid having to call `Region::new_var` to re-create `Region`s from
  `RegionVid`s in a few places, avoiding the interning process, giving a
  small perf win. (At the cost of the type allowing some invalid
  combinations of values.)
- All the cases now store two `Region`s, so the commit also separates
  the `ConstraintKind` (a new type) from the `sub` and `sup` arguments
  in `Constraint`.
@nnethercote nnethercote force-pushed the opt-region-constraints branch from c7ec775 to 066a973 Compare July 31, 2025 10:10
@nnethercote
Copy link
Contributor Author

I addressed the nit.

@bors r=lcnr

@bors
Copy link
Collaborator

bors commented Jul 31, 2025

📌 Commit 066a973 has been approved by lcnr

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 Jul 31, 2025
bors added a commit that referenced this pull request Jul 31, 2025
@bors
Copy link
Collaborator

bors commented Jul 31, 2025

⌛ Testing commit 066a973 with merge ffb8b2f...

@bors
Copy link
Collaborator

bors commented Jul 31, 2025

💔 Test failed - checks-actions

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

Looks like some kind of network issue.

@bors retry

@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 Jul 31, 2025
@bors
Copy link
Collaborator

bors commented Aug 1, 2025

⌛ Testing commit 066a973 with merge 6c02dd4...

@bors
Copy link
Collaborator

bors commented Aug 1, 2025

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing 6c02dd4 to master...

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

github-actions bot commented Aug 1, 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 adcb3d3 (parent) -> 6c02dd4 (this PR)

Test differences

Show 1 test diff

1 doctest diff were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 6c02dd4eae83befde07dc4782395e2005055e9fa --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: 4568.7s -> 6259.9s (37.0%)
  2. x86_64-apple-2: 5867.8s -> 4262.9s (-27.4%)
  3. dist-apple-various: 5496.8s -> 4528.8s (-17.6%)
  4. dist-x86_64-freebsd: 4928.1s -> 5728.2s (16.2%)
  5. x86_64-apple-1: 7959.0s -> 8791.6s (10.5%)
  6. pr-check-1: 1695.4s -> 1862.3s (9.8%)
  7. dist-aarch64-apple: 5187.9s -> 5594.5s (7.8%)
  8. aarch64-gnu-llvm-19-1: 3930.2s -> 3630.5s (-7.6%)
  9. dist-sparcv9-solaris: 5437.9s -> 5060.4s (-6.9%)
  10. x86_64-gnu-tools: 4004.7s -> 3729.7s (-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.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6c02dd4): 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
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 2
Improvements ✅
(secondary)
-0.5% [-1.0%, -0.3%] 12
All ❌✅ (primary) -0.1% [-0.1%, -0.1%] 2

Max RSS (memory usage)

Results (primary 0.9%, 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.9% [1.4%, 4.5%] 2
Regressions ❌
(secondary)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
-3.0% [-3.0%, -3.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [-3.0%, 4.5%] 3

Cycles

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

Binary size

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

Bootstrap: 468.61s -> 467.393s (-0.26%)
Artifact size: 376.82 MiB -> 376.76 MiB (-0.02%)

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. T-rustdoc Relevant to the rustdoc 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.

5 participants