Skip to content
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

Various local trait item iteration cleanups #139018

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Mar 27, 2025

Adding a trait impl for Foo unconditionally affected all queries that are interested in a completely independent trait Bar. Perf has no effect on this. We probably don't have a good perf test for this tho.

r? @compiler-errors

I am unsure about 9d05efb as it doesn't improve anything wrt incremental, because we still do all the checks for valid Drop impls, which subsequently will still invoke many queries and basically keep the depgraph the same.

I want to do

// FIXME: This depends on the set of all impls for the trait. That is

but would leave that to a follow-up PR, this one changes enough things as it is

@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. labels Mar 27, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Mar 27, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 27, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2025
…try>

Decouple trait impls of different traits wrt incremental

Adding a trait impl for `Foo` unconditionally affected all queries that are interested in a completely independent trait `Bar`. Let's see if perf has any effect on this. If not, we can land it and I poke further at it to see if we can decouple things further. We probably don't have a good perf test for it tho.

r? `@ghost`
@bors
Copy link
Collaborator

bors commented Mar 27, 2025

⌛ Trying commit f391497 with merge 6e1b141...

@bors
Copy link
Collaborator

bors commented Mar 27, 2025

☀️ Try build successful - checks-actions
Build commit: 6e1b141 (6e1b1415674df8a0a976d5a0804159b129f3868b)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6e1b141): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking 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.

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

Instruction count

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

Max RSS (memory usage)

Results (primary 1.8%, secondary -0.1%)

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.

mean range count
Regressions ❌
(primary)
1.8% [1.8%, 1.8%] 1
Regressions ❌
(secondary)
2.1% [1.9%, 2.3%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-3.0%, -1.5%] 2
All ❌✅ (primary) 1.8% [1.8%, 1.8%] 1

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: 779.46s -> 778.12s (-0.17%)
Artifact size: 365.95 MiB -> 365.95 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 27, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Mar 27, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 27, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2025
…try>

Decouple trait impls of different traits wrt incremental

Adding a trait impl for `Foo` unconditionally affected all queries that are interested in a completely independent trait `Bar`. Let's see if perf has any effect on this. If not, we can land it and I poke further at it to see if we can decouple things further. We probably don't have a good perf test for it tho.

r? `@ghost`
@bors
Copy link
Collaborator

bors commented Mar 27, 2025

⌛ Trying commit 9d05efb with merge b82ca8c...

@bors
Copy link
Collaborator

bors commented Mar 27, 2025

☀️ Try build successful - checks-actions
Build commit: b82ca8c (b82ca8cbd7c181a1f538c8a2bda13bae748efe04)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b82ca8c): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking 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.

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

Instruction count

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.7%, secondary -0.3%)

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.

mean range count
Regressions ❌
(primary)
0.7% [0.6%, 0.7%] 3
Regressions ❌
(secondary)
2.0% [1.7%, 2.3%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-3.1%, -1.0%] 4
All ❌✅ (primary) 0.7% [0.6%, 0.7%] 3

Cycles

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

Binary size

Results (primary 0.1%, secondary 0.0%)

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.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.2%] 52
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.0%, 0.2%] 52

Bootstrap: 779.46s -> 778.646s (-0.10%)
Artifact size: 365.95 MiB -> 365.95 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 27, 2025
match self.tcx.adt_destructor(def_id) {
Some(_) => None,
None => Some(def_id),
match self.tcx.type_of(def_id).skip_binder().ty_adt_def().map(|adt| adt.has_dtor(self.tcx))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

previously this was using the def_id of the const, which accidentally worked because the query invoked type_of on it internally.

@oli-obk oli-obk force-pushed the incremental-trait-impls branch from 9d05efb to b1402f7 Compare April 1, 2025 11:20
@oli-obk oli-obk changed the title Decouple trait impls of different traits wrt incremental Various local trait item iteration cleanups Apr 1, 2025
@oli-obk oli-obk marked this pull request as ready for review April 1, 2025 11:25
@rustbot
Copy link
Collaborator

rustbot commented Apr 1, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

HIR ty lowering was modified

cc @fmease

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

r=me after question

match self.tcx.adt_destructor(def_id) {
Some(_) => None,
None => Some(def_id),
match self.tcx.type_of(def_id).skip_binder().ty_adt_def().map(|adt| adt.has_dtor(self.tcx))
Copy link
Member

Choose a reason for hiding this comment

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

This logic seems kinda sketch lol. Do we want to check that the type of the const needs_drop rather than just checking if it has a dtor directly?

Copy link
Member

Choose a reason for hiding this comment

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

I guess it's preexisting.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe fixme here rather than changing it, since it's possibly public facing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll check if we want direct impls explicitly and leave a fixme if that's so or a comment otherwise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants