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

privacy: Fix more (potential) issues with effective visibilities #104602

Merged
merged 5 commits into from
Nov 25, 2022

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Nov 19, 2022

Continuation of #103965.
See individual commits for more detailed description of the changes.

The shortcuts removed in 4eb63f6 and c7c7d16 could actually be correct (or correct after some tweaks), but they used global reasoning like "we can skip this update because if the code compiles then some other update should do the same thing eventually".
I have some expertise in this area, but I still have doubt whether such global reasoning was correct or not, especially in presence of all possible exotic cases with imports.
After this PR all table changes should be "locally correct" after every update, even if it may be overcautious.
If similar optimizations are introduced again they will need detailed comments explaining why it's legal to do what they do and providing proofs.

Fixes #104249.
Fixes #104539.

@rustbot
Copy link
Collaborator

rustbot commented Nov 19, 2022

r? @nagisa

(rustbot has picked a reviewer for you, use r? to override)

@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 Nov 19, 2022
@petrochenkov
Copy link
Contributor Author

@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 Nov 19, 2022
@bors
Copy link
Contributor

bors commented Nov 19, 2022

⌛ Trying commit 9d70899ddc863e2b3d3088dcd36a6ec456aea7a5 with merge 2538668a84d818163fa59473d73ecfc72e8dddc2...

@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 19, 2022
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Nov 19, 2022

☀️ Try build successful - checks-actions
Build commit: 2538668a84d818163fa59473d73ecfc72e8dddc2 (2538668a84d818163fa59473d73ecfc72e8dddc2)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2538668a84d818163fa59473d73ecfc72e8dddc2): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.3%] 10
Regressions ❌
(secondary)
2.0% [0.3%, 3.6%] 19
Improvements ✅
(primary)
-0.9% [-1.0%, -0.7%] 9
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.3% [-1.0%, 0.3%] 19

Max RSS (memory usage)

Results

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
Regressions ❌
(secondary)
2.9% [2.6%, 3.3%] 10
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
-3.6% [-6.1%, -1.1%] 5
All ❌✅ (primary) -0.4% [-0.4%, -0.4%] 1

Cycles

Results

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
Regressions ❌
(secondary)
5.2% [4.4%, 6.7%] 12
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

@rustbot rustbot added perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 19, 2022
@petrochenkov petrochenkov 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 Nov 19, 2022
@petrochenkov
Copy link
Contributor Author

@bors try @rust-timer queue
I'll add #103688 on top of this PR if the performance is not good enough.

@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 Nov 23, 2022
@bors
Copy link
Contributor

bors commented Nov 23, 2022

⌛ Trying commit c7c7d1672739e38c8d39ae861b284486aefd5b48 with merge 22c1292b3b7f95dc90d94f455d9e747fce27dbe4...

@petrochenkov petrochenkov changed the title [perf] Effective visibilities perf testing privacy: Fix more (potential) issues with effective visibilities Nov 23, 2022
@bors
Copy link
Contributor

bors commented Nov 23, 2022

☀️ Try build successful - checks-actions
Build commit: 22c1292b3b7f95dc90d94f455d9e747fce27dbe4 (22c1292b3b7f95dc90d94f455d9e747fce27dbe4)

@rust-timer

This comment has been minimized.

@petrochenkov petrochenkov removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 23, 2022
@bors
Copy link
Contributor

bors commented Nov 23, 2022

⌛ Trying commit 47cd844 with merge d275439274b5b544b04409b58bdae60e2d5afdbc...

@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 23, 2022
@bors
Copy link
Contributor

bors commented Nov 24, 2022

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d275439274b5b544b04409b58bdae60e2d5afdbc): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.2% [0.2%, 0.3%] 6
Regressions ❌
(secondary)
1.8% [0.2%, 3.5%] 20
Improvements ✅
(primary)
-1.1% [-1.4%, -0.5%] 13
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.7% [-1.4%, 0.3%] 19

Max RSS (memory usage)

Results

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)
2.4% [2.4%, 2.4%] 1
Regressions ❌
(secondary)
3.2% [2.6%, 4.0%] 12
Improvements ✅
(primary)
-1.3% [-1.3%, -1.3%] 1
Improvements ✅
(secondary)
-1.6% [-2.6%, -1.0%] 3
All ❌✅ (primary) 0.5% [-1.3%, 2.4%] 2

Cycles

Results

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
Regressions ❌
(secondary)
4.3% [3.0%, 5.9%] 11
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 24, 2022
@petrochenkov
Copy link
Contributor Author

I'm not a fan of mixing correctness and performance changes, but I've added one optimization commit on top of this PR, and it didn't change much. I can remove it again if requested.
unused-warnings is basically a stress test for this pass - it contains tens of thousands of import chains.

r? @oli-obk @Bryanskiy @cjgillot
@rustbot ready

@rustbot rustbot assigned oli-obk and unassigned nagisa Nov 24, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Nov 24, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Nov 24, 2022

📌 Commit 47cd844 has been approved by oli-obk

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 Nov 24, 2022
@bors
Copy link
Contributor

bors commented Nov 25, 2022

⌛ Testing commit 47cd844 with merge 41e0363...

@bors
Copy link
Contributor

bors commented Nov 25, 2022

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 41e0363 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 25, 2022
@bors bors merged commit 41e0363 into rust-lang:master Nov 25, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 25, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (41e0363): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.3%] 8
Regressions ❌
(secondary)
2.2% [0.3%, 3.6%] 17
Improvements ✅
(primary)
-1.0% [-1.4%, -0.5%] 13
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-1.4%, 0.3%] 21

Max RSS (memory usage)

Results

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
Regressions ❌
(secondary)
3.0% [2.2%, 4.1%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.5% [-3.5%, -3.5%] 1
All ❌✅ (primary) - - 0

Cycles

Results

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
Regressions ❌
(secondary)
4.0% [3.2%, 5.0%] 12
Improvements ✅
(primary)
-1.2% [-1.4%, -1.0%] 3
Improvements ✅
(secondary)
-2.6% [-2.6%, -2.6%] 2
All ❌✅ (primary) -1.2% [-1.4%, -1.0%] 3

@nnethercote
Copy link
Contributor

This fixes correctness issues, and the regressions are mostly in unused-warnings which is a stress test where 3% doesn't really matter. Plus libc got a bit faster. So overall, not a performance concern.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Nov 27, 2022
petrochenkov added a commit to petrochenkov/rust that referenced this pull request Mar 31, 2023
Something similar was previously removed as a part of rust-lang#104602, but after this PR all table changes should also be "locally correct" after every update.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 5, 2023
resolve: Restore some effective visibility optimizations

Something similar was previously removed as a part of rust-lang#104602.
So we can see [bitmaps-3.1.0](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/bitmaps-3.1.0), [match-stress](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/match-stress) and [unused-warnings](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/unused-warnings) in regressions there, and in improvements in this PR.
After this PR all table changes should also be "locally correct" after every update.
saethlin pushed a commit to saethlin/miri that referenced this pull request Apr 10, 2023
resolve: Restore some effective visibility optimizations

Something similar was previously removed as a part of rust-lang/rust#104602.
So we can see [bitmaps-3.1.0](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/bitmaps-3.1.0), [match-stress](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/match-stress) and [unused-warnings](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/unused-warnings) in regressions there, and in improvements in this PR.
After this PR all table changes should also be "locally correct" after every update.
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. perf-regression-triaged The performance regression has been triaged. 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.
Projects
None yet
8 participants