eagerly compute sub_unification_table again#140375
Conversation
cb71df2 to
a0fef49
Compare
This comment has been minimized.
This comment has been minimized.
a0fef49 to
46487b0
Compare
This comment has been minimized.
This comment has been minimized.
46487b0 to
54a32a1
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
eagerly compute `sub_relations` again We still only using them for diagnostics with the old solver. We could use them for cycle detection in generalization and it seems desirable to do so in the future. However, this is unsound with the old trait solver as its cache does not track these `sub_relations` in any way. We would also need to consider them when canonicalizing as otherwise instantiating the canonical response may fail. Necessary for type inference guidance due to not-yet defined opaque types, cc rust-lang/trait-system-refactor-initiative#182. r? `@compiler-errors`
611d7ae to
26f4ee0
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
eagerly compute `sub_relations` again We still only using them for diagnostics with the old solver. We could use them for cycle detection in generalization and it seems desirable to do so in the future. However, this is unsound with the old trait solver as its cache does not track these `sub_relations` in any way. We would also need to consider them when canonicalizing as otherwise instantiating the canonical response may fail. Necessary for type inference guidance due to not-yet defined opaque types, cc rust-lang/trait-system-refactor-initiative#182. r? `@compiler-errors`
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (e184142): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -0.6%, secondary -4.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary 0.0%, secondary -1.6%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 765.701s -> 765.069s (-0.08%) |
26f4ee0 to
c629527
Compare
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #140474) made this pull request unmergeable. Please resolve the merge conflicts. |
|
see perf run in #140480 (comment) |
|
comparing these two perf runs, tracking sub_relations in canonical inputs does slightly worsen performance: https://perf.rust-lang.org/compare.html?start=e1841428183d264d2f48328b3de5c0f25654315a&end=9613271ee15ea18ed41f396fc7aaf4c1f760410a&stat=instructions%3Au |
|
☔ The latest upstream changes (presumably #146113) made this pull request unmergeable. Please resolve the merge conflicts. |
| && goal.param_env.visit_with(&mut visitor).is_continue() | ||
| } | ||
|
|
||
| pub(super) fn sub_ty_vids_raw(&self, a: ty::TyVid, b: ty::TyVid) { |
There was a problem hiding this comment.
renaming to something that doesnt sound "directional". we only care about whether two vars are related to eachother in some way, but not whether its a <: b or b <: a. maybe "sub_unify_ty_vids_raw` or smth idk :3
| /// ```text | ||
| /// exists X. (a <: X || X <: a) && (b <: X || X <: b) | ||
| /// ``` | ||
| pub(crate) fn sub_root_var(&mut self, vid: ty::TyVid) -> ty::TyVid { |
There was a problem hiding this comment.
similarly sub_root_var is confusing. it makes it sound like its the root of a directed graph of subtyping relations which then makes me start thinking about what cases that can get invalidated :>
but in reality nothing here is directed so we can just arbitrarily pick some var as the root and its fine forever. no idea what a better name is
There was a problem hiding this comment.
sub_relations_representative maybe. Renamed it to sub_relations_root_var for now
| } | ||
|
|
||
| #[inline] | ||
| fn sub_relations(&mut self) -> super::UnificationTable<'_, 'tcx, TyVidSubKey> { |
There was a problem hiding this comment.
i guess same kinda thing here... sub relations makes me think of something else than what this is? no idea what a better name is, also aware that this was the name we had before we removed it :>
| /// We knowingly ignore the `sub_root` of our inference variables here. This means we | ||
| /// may not reevaluate a goal even though a change to the `sub_root` could cause a goal | ||
| /// to make progress. Tracking them adds additional complexity for an incredibly minor | ||
| /// type inference improvement. We could look into properly handling this in the future. |
There was a problem hiding this comment.
slightly iffy but ok
?
f84f3f6 to
76283ec
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
sub_relations againsub_unification_table again
2c123f5 to
1262693
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
☀️ Test successful - checks-actions |
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 a78f9aa (parent) -> 9c27f27 (this PR) Test differencesShow 20 test diffsStage 1
Stage 2
Additionally, 18 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 9c27f27ea3bab79a2fec827ef3ae0009959d60f4 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (9c27f27): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowOur benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -1.3%, secondary -0.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.0%, secondary -1.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 466.425s -> 467.433s (0.22%) |
|
Unfortunately an expected perf regression, spent a while trying to reduce the impact. Necessary for the new solver |
|
Marking as triaged. @rustbot label: +perf-regression-triaged |
Previously called
sub_relations. We still only using them for diagnostics right now. This mostly reverts #119989. Necessary for type inference guidance due to not-yet defined opaque types, cc rust-lang/trait-system-refactor-initiative#182.We could use them for cycle detection in generalization and it seems desirable to do so in the future. However, this is unsound with the old trait solver as its cache does not track these
sub_unification_tablein any way.We now properly track the
sub_unification_tablewhen canonicalizing so using them in the new solver is totally sound and the performance impact is far more manageable than I thought back in #119989.r? @compiler-errors