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

Encode only MIR reachable from other crates #115306

Merged
merged 1 commit into from Sep 10, 2023

Conversation

tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Aug 28, 2023

Only reachable items might participate in the code generation in the
downstream crates. Omit redundant optimized MIR of unreachable items
from a crate metadata.

Additionally, include reachable closures in reachable set, so that
unreachable closures can be omitted on the same basis.

@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 Aug 28, 2023
@tmiasko
Copy link
Contributor Author

tmiasko commented Aug 28, 2023

@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 Aug 28, 2023
@bors
Copy link
Contributor

bors commented Aug 28, 2023

⌛ Trying commit 7a2b2ca0a9f3c45e766138547f81d4a130ba09d4 with merge 524a72e9fbc25be53b017952c3f2520a769c65c0...

@tmiasko
Copy link
Contributor Author

tmiasko commented Aug 28, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 28, 2023

⌛ Trying commit 18f8aa6acb7bdb7bbee9ddd47b74d6453c879a08 with merge 8befefe0eeb75ffb3138d26537e90703d068ea2a...

@bors
Copy link
Contributor

bors commented Aug 28, 2023

💔 Test failed - checks-actions

@rust-log-analyzer

This comment has been minimized.

@bors bors 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 28, 2023
@tmiasko
Copy link
Contributor Author

tmiasko commented Aug 28, 2023

@rust-timer build 524a72e9fbc25be53b017952c3f2520a769c65c0

@rust-timer

This comment has been minimized.

@tmiasko
Copy link
Contributor Author

tmiasko commented Aug 28, 2023

Toolchain Bytes
41cb42a 490193897
524a72e9fbc25be53b017952c3f2520a769c65c0 479937961

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (524a72e9fbc25be53b017952c3f2520a769c65c0): 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-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.7% [0.4%, 2.6%] 30
Regressions ❌
(secondary)
1.5% [0.4%, 9.2%] 10
Improvements ✅
(primary)
-1.2% [-2.6%, -0.3%] 11
Improvements ✅
(secondary)
-0.9% [-1.1%, -0.8%] 3
All ❌✅ (primary) 0.2% [-2.6%, 2.6%] 41

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)
1.4% [0.9%, 1.9%] 5
Regressions ❌
(secondary)
2.1% [0.7%, 4.6%] 7
Improvements ✅
(primary)
-1.1% [-1.5%, -0.6%] 5
Improvements ✅
(secondary)
-0.6% [-0.6%, -0.6%] 2
All ❌✅ (primary) 0.2% [-1.5%, 1.9%] 10

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)
1.8% [1.4%, 3.0%] 7
Regressions ❌
(secondary)
5.0% [3.2%, 9.6%] 4
Improvements ✅
(primary)
-1.7% [-2.1%, -1.3%] 4
Improvements ✅
(secondary)
-2.4% [-2.5%, -2.4%] 2
All ❌✅ (primary) 0.6% [-2.1%, 3.0%] 11

Binary size

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)
- - 0
Improvements ✅
(primary)
-1.1% [-7.1%, -0.0%] 87
Improvements ✅
(secondary)
-1.0% [-3.7%, -0.0%] 37
All ❌✅ (primary) -1.1% [-7.1%, -0.0%] 87

Bootstrap: 631.418s -> 630.932s (-0.08%)
Artifact size: 316.30 MiB -> 315.75 MiB (-0.17%)

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

tmiasko commented Aug 30, 2023

@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 Aug 30, 2023
@bors
Copy link
Contributor

bors commented Aug 30, 2023

⌛ Trying commit 945cde202a1018cf8f93fea755db3da165f355bc with merge 69b9a1d784d7997066edd67bfea933c18927502e...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 30, 2023

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

@tmiasko tmiasko added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 7, 2023
@@ -1580,9 +1585,10 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
}

let tcx = self.tcx;
let reachable_set = tcx.reachable_set(());

let keys_and_jobs = tcx.mir_keys(()).iter().filter_map(|&def_id| {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we filter more aggressively using a .filter(|def_id| reachable_set.contains(def_id))?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reachable_set is used to filter the optimized MIR only. It might still be necessary to encode MIR for CTFE.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's my question: should we filter MIR for CTFE too according to the same rule?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reachable set cannot be used for the purpose. It contains items externally reachable in the linkage sense, or that could be code generated while building other crates, but it doesn't have much to say about items which might evaluated in other crates. Implementing this would require a separate analysis (I assume we don't want to include those in reachable set since that would be pessimization).

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a line explaining the logic around reachable_set and this exception to the doc-comment on should_encode_mir?
r=me then

@cjgillot cjgillot 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 Sep 9, 2023
@rust-log-analyzer

This comment has been minimized.

Only reachable items might participate in the code generation in the
downstream crates. Omit redundant optimized MIR of unreachable items
from a crate metadata.

Additionally, include reachable closures in reachable set, so that
unreachable closures can be omitted on the same basis.
@tmiasko
Copy link
Contributor Author

tmiasko commented Sep 10, 2023

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Sep 10, 2023

📌 Commit d99333e has been approved by cjgillot

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 Sep 10, 2023
@bors
Copy link
Contributor

bors commented Sep 10, 2023

⌛ Testing commit d99333e with merge 65b2ffd...

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 10, 2023
…llot

Encode only MIR reachable from other crates

Only reachable items might participate in the code generation in the
downstream crates. Omit redundant optimized MIR of unreachable items
from a crate metadata.

Additionally, include reachable closures in reachable set, so that
unreachable closures can be omitted on the same basis.
@bors
Copy link
Contributor

bors commented Sep 10, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 65b2ffd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 10, 2023
@bors
Copy link
Contributor

bors commented Sep 10, 2023

👀 Test was successful, but fast-forwarding failed: 422 Update is not a fast forward

@tmiasko
Copy link
Contributor Author

tmiasko commented Sep 10, 2023

@bors retry

@tmiasko tmiasko removed the merged-by-bors This PR was explicitly merged by bors. label Sep 10, 2023
@bors
Copy link
Contributor

bors commented Sep 10, 2023

⌛ Testing commit d99333e with merge 7418413...

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (65b2ffd): 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.8% [0.2%, 2.5%] 23
Regressions ❌
(secondary)
1.4% [0.4%, 9.2%] 12
Improvements ✅
(primary)
-2.0% [-2.8%, -0.8%] 6
Improvements ✅
(secondary)
-1.0% [-1.0%, -0.9%] 3
All ❌✅ (primary) 0.2% [-2.8%, 2.5%] 29

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)
1.5% [0.7%, 2.4%] 8
Regressions ❌
(secondary)
3.5% [1.3%, 6.3%] 5
Improvements ✅
(primary)
-1.5% [-1.6%, -1.3%] 2
Improvements ✅
(secondary)
-2.1% [-3.9%, -0.5%] 4
All ❌✅ (primary) 0.9% [-1.6%, 2.4%] 10

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)
2.0% [1.1%, 3.4%] 7
Regressions ❌
(secondary)
4.7% [2.1%, 9.1%] 5
Improvements ✅
(primary)
-1.7% [-1.8%, -1.6%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [-1.8%, 3.4%] 10

Binary size

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)
- - 0
Improvements ✅
(primary)
-1.2% [-7.5%, -0.0%] 78
Improvements ✅
(secondary)
-1.2% [-4.9%, -0.0%] 37
All ❌✅ (primary) -1.2% [-7.5%, -0.0%] 78

Bootstrap: 629.364s -> 629.035s (-0.05%)
Artifact size: 317.94 MiB -> 317.47 MiB (-0.15%)

@bors
Copy link
Contributor

bors commented Sep 10, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 7418413 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 10, 2023
@bors bors merged commit 7418413 into rust-lang:master Sep 10, 2023
12 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 10, 2023
@tmiasko tmiasko deleted the encode-reachable-mir branch September 10, 2023 18:19
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7418413): 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.8% [0.3%, 2.4%] 15
Regressions ❌
(secondary)
1.9% [0.3%, 9.1%] 7
Improvements ✅
(primary)
-1.3% [-2.7%, -0.4%] 12
Improvements ✅
(secondary)
-0.9% [-1.2%, -0.7%] 5
All ❌✅ (primary) -0.1% [-2.7%, 2.4%] 27

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)
1.7% [0.9%, 2.4%] 7
Regressions ❌
(secondary)
4.5% [2.4%, 6.1%] 3
Improvements ✅
(primary)
-1.4% [-2.4%, -0.6%] 4
Improvements ✅
(secondary)
-1.3% [-2.9%, -0.6%] 4
All ❌✅ (primary) 0.6% [-2.4%, 2.4%] 11

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)
2.0% [1.3%, 3.4%] 6
Regressions ❌
(secondary)
3.3% [1.7%, 8.7%] 7
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
-2.4% [-2.4%, -2.4%] 1
All ❌✅ (primary) 1.4% [-2.3%, 3.4%] 7

Binary size

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)
- - 0
Improvements ✅
(primary)
-1.2% [-7.5%, -0.0%] 79
Improvements ✅
(secondary)
-1.2% [-4.9%, -0.0%] 37
All ❌✅ (primary) -1.2% [-7.5%, -0.0%] 79

Bootstrap: 631.343s -> 629.704s (-0.26%)
Artifact size: 318.07 MiB -> 317.61 MiB (-0.15%)

@pnkfelix
Copy link
Member

  • the big (>1%) primary regressions were to three check-incr-unchanged cases: cranelift-codegen-0.82.1, html5ever-0.26.0, and hyper-0.14.18
  • the regressions seem unfortunate, but tolerable given the improvement to linked artifact sizes
  • marking as triaged

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 13, 2023
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
Development

Successfully merging this pull request may close these issues.

None yet

7 participants