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

aligns the behavior to that prior to #118311 #118411

Closed

Conversation

bvanjoi
Copy link
Contributor

@bvanjoi bvanjoi commented Nov 28, 2023

After #118311, it seems that due to an oversight some alignments were unintentionally omitted, possibly leading the code into different branches. This PR attempts to restore those alignments and aims to fix the regression reported at #118319 (comment)

@rustbot
Copy link
Collaborator

rustbot commented Nov 28, 2023

r? @b-naber

(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 28, 2023
@compiler-errors
Copy link
Member

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

bors commented Nov 28, 2023

⌛ Trying commit 4307541 with merge 3c773cd...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 28, 2023
…e_2, r=<try>

aligns the behavior to that prior to rust-lang#118311

After rust-lang#118311, it seems that due to an oversight some alignments were unintentionally omitted, possibly leading the code into different branches. This PR attempts to restore those alignments and aims to fix the regression reported at rust-lang#118319 (comment)
@bors
Copy link
Contributor

bors commented Nov 28, 2023

☀️ Try build successful - checks-actions
Build commit: 3c773cd (3c773cd98dc6c897d38d307de1cd50c92d2ad74e)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3c773cd): 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

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

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: 672.731s -> 673.339s (0.09%)
Artifact size: 313.33 MiB -> 313.36 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 28, 2023
@bvanjoi bvanjoi force-pushed the merge_coroutinue_into_closure_2 branch from 4307541 to 77f9a77 Compare November 29, 2023 16:05
@rustbot
Copy link
Collaborator

rustbot commented Nov 29, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@bvanjoi
Copy link
Contributor Author

bvanjoi commented Nov 29, 2023

I can confirm that it's not equivalent between ExprKind::Closure(Closure { movability: Some(_), .. }) => DefKind::Coroutine and tcx.coroutine_kind(def_id).is_some() for the same def_id.(Additionally, I'm curious as to why the test suite passed without issues)

So, the latest patch modifies tcx.is_coroutine to be more similar to the def_kind prior to #118188, with the hope that it will have a positive impact on performance.

@bvanjoi
Copy link
Contributor Author

bvanjoi commented Nov 29, 2023

hi @compiler-errors could you help rerun this perf test?

@compiler-errors
Copy link
Member

@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 Dec 5, 2023
@bors
Copy link
Contributor

bors commented Dec 5, 2023

⌛ Trying commit 77f9a77 with merge 205cae8...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 5, 2023
…e_2, r=<try>

aligns the behavior to that prior to rust-lang#118311

After rust-lang#118311, it seems that due to an oversight some alignments were unintentionally omitted, possibly leading the code into different branches. This PR attempts to restore those alignments and aims to fix the regression reported at rust-lang#118319 (comment)
@bors
Copy link
Contributor

bors commented Dec 5, 2023

☀️ Try build successful - checks-actions
Build commit: 205cae8 (205cae860ab28f4327b8e9127118187c4a411c3d)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (205cae8): 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)
4.4% [0.3%, 14.2%] 6
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.7%, -0.1%] 21
Improvements ✅
(secondary)
-0.5% [-0.8%, -0.2%] 7
All ❌✅ (primary) 0.7% [-0.7%, 14.2%] 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)
5.8% [5.8%, 5.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-4.7% [-7.5%, -1.7%] 4
Improvements ✅
(secondary)
-2.6% [-2.6%, -2.6%] 1
All ❌✅ (primary) -2.6% [-7.5%, 5.8%] 5

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)
5.3% [2.0%, 13.4%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.6% [-0.8%, -0.5%] 2
All ❌✅ (primary) 5.3% [2.0%, 13.4%] 5

Binary size

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

Bootstrap: 675.58s -> 673.858s (-0.25%)
Artifact size: 314.11 MiB -> 314.16 MiB (0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 5, 2023
@bvanjoi bvanjoi mentioned this pull request Dec 6, 2023
@apiraino
Copy link
Contributor

apiraino commented Dec 28, 2023

IIUC this is waiting on a decision in #118436, so I'll earmark this PR as waiting on author to mark this to unblock it. thanks

@rustbot author

@rustbot rustbot 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 Dec 28, 2023
@wesleywiser wesleywiser 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 Dec 28, 2023
@petrochenkov
Copy link
Contributor

r? @compiler-errors as the author of #119174 #119258 #119198

@rustbot rustbot assigned compiler-errors and unassigned b-naber Dec 28, 2023
@compiler-errors
Copy link
Member

@bvanjoi:

I can confirm that it's not equivalent between ExprKind::Closure(Closure { movability: Some(_), .. }) => DefKind::Coroutine and tcx.coroutine_kind(def_id).is_some() for the same def_id.(Additionally, I'm curious as to why the test suite passed without issues)

In what case is this not true?

@compiler-errors
Copy link
Member

In any case, it's certainly true now, and any coroutines that had movability: None (or worse, closures that had movability: Some(_)) were being treated incorrectly by the compiler previously.

@@ -474,7 +474,9 @@ fn construct_fn<'tcx>(
};

let mut abi = fn_sig.abi;
if let DefKind::Closure = tcx.def_kind(fn_def) {
if let DefKind::Closure = tcx.def_kind(fn_def)
&& !tcx.is_coroutine(fn_def)
Copy link
Member

Choose a reason for hiding this comment

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

This concerns me, since I hope that coroutines don't have abi::RustCall.

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, DefKind included both DefKind::Closure and DefKind::Coroutine. This change is simply to ensure that they are treated the same.

@bvanjoi
Copy link
Contributor Author

bvanjoi commented Dec 28, 2023

In what case is this not true?

I forgot about this case and I will investigate it again tomorrow

@compiler-errors
Copy link
Member

Also, TyCtxt::is_closure probably has some call sites that are wrong -- could you check those too, if you haven't already?

@bvanjoi bvanjoi force-pushed the merge_coroutinue_into_closure_2 branch from 77f9a77 to 4fda2d8 Compare January 2, 2024 14:50
@bvanjoi
Copy link
Contributor Author

bvanjoi commented Jan 2, 2024

A considerable amount of time has passed, so I need to go over it again:


I can confirm that it's not equivalent....

I'm currently unable to reproduce it..🤦

@bvanjoi
Copy link
Contributor Author

bvanjoi commented Jan 2, 2024

@compiler-errors could you help in rerunning this performance test...

@compiler-errors
Copy link
Member

@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 Jan 2, 2024
@bors
Copy link
Contributor

bors commented Jan 2, 2024

⌛ Trying commit 4fda2d8 with merge 7236802...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 2, 2024
…e_2, r=<try>

aligns the behavior to that prior to rust-lang#118311

After rust-lang#118311, it seems that due to an oversight some alignments were unintentionally omitted, possibly leading the code into different branches. This PR attempts to restore those alignments and aims to fix the regression reported at rust-lang#118319 (comment)
@bors
Copy link
Contributor

bors commented Jan 2, 2024

☀️ Try build successful - checks-actions
Build commit: 7236802 (7236802464a37483410191928abfd490527a1473)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7236802): 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

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.8% [2.8%, 2.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.4% [-1.4%, -1.4%] 1
All ❌✅ (primary) 2.8% [2.8%, 2.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: 666.95s -> 667.828s (0.13%)
Artifact size: 311.74 MiB -> 311.79 MiB (0.01%)

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Jan 2, 2024
@compiler-errors
Copy link
Member

compiler-errors commented Jan 2, 2024

@bvanjoi:

Ultimately, I noticed some discrepancies between the usage of movability and tcx.coroutine_kind. These differences can be seen at

Do you mean performance discrepancies? Because there should be no behavioral discrepancies. This is what I meant by #118411 (comment).

Since it's evident that this PR is not going to restore the performance before #118311, is it worth landing this? Does this fix remaining any bugs?

@bvanjoi
Copy link
Contributor Author

bvanjoi commented Jan 3, 2024

Closing it as no substantial help has been provided.....

@bvanjoi bvanjoi closed this Jan 3, 2024
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.

9 participants