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

fast path for process_obligations #108815

Merged
merged 1 commit into from
Mar 18, 2023

Conversation

the8472
Copy link
Member

@the8472 the8472 commented Mar 6, 2023

Speeds up keccak and cranelift-codegen in perf.rlo.

@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 6, 2023
@the8472
Copy link
Member Author

the8472 commented Mar 6, 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 Mar 6, 2023
@bors
Copy link
Contributor

bors commented Mar 6, 2023

⌛ Trying commit 747d50200281b735d9e784ef6b5cef2d04d11afe with merge daea843df4fa566ae112b712b35a41efcea4fcb3...

@bors
Copy link
Contributor

bors commented Mar 6, 2023

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

@rust-timer

This comment has been minimized.

@the8472
Copy link
Member Author

the8472 commented Mar 6, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Mar 6, 2023

⌛ Trying commit a9eb3b0966b8c5eb293ff719a553001de8b66da2 with merge 98d316111d364b2293252d46701b0a0609624c0d...

@bors
Copy link
Contributor

bors commented Mar 6, 2023

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

@rust-timer
Copy link
Collaborator

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

Warning ⚠: The following benchmark(s) failed to build:

  • rustc

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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.7% [-5.0%, -0.3%] 8
Improvements ✅
(secondary)
-8.4% [-12.9%, -0.4%] 8
All ❌✅ (primary) -1.7% [-5.0%, -0.3%] 8

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)
-1.2% [-1.2%, -1.2%] 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)
2.6% [2.6%, 2.6%] 1
Improvements ✅
(primary)
-2.7% [-3.0%, -2.4%] 2
Improvements ✅
(secondary)
-9.5% [-11.0%, -8.6%] 6
All ❌✅ (primary) -2.7% [-3.0%, -2.4%] 2

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 7, 2023
@the8472
Copy link
Member Author

the8472 commented Mar 7, 2023

ena PR: rust-lang/ena#45

@rust-log-analyzer

This comment has been minimized.

@the8472
Copy link
Member Author

the8472 commented Mar 8, 2023

@rust-timer build 98d316111d364b2293252d46701b0a0609624c0d

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

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

Warning ⚠: The following benchmark(s) failed to build:

  • rustc

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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.0% [-8.6%, -0.3%] 13
Improvements ✅
(secondary)
-11.6% [-21.9%, -0.5%] 10
All ❌✅ (primary) -2.0% [-8.6%, -0.3%] 13

Max RSS (memory usage)

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

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)
- - 0
Improvements ✅
(primary)
-2.7% [-3.8%, -1.1%] 3
Improvements ✅
(secondary)
-11.1% [-12.7%, -10.3%] 6
All ❌✅ (primary) -2.7% [-3.8%, -1.1%] 3

@the8472 the8472 force-pushed the process-obligations-fast-skip branch from a9eb3b0 to 0093338 Compare March 8, 2023 23:12
@the8472
Copy link
Member Author

the8472 commented Mar 8, 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 Mar 8, 2023
@bors

This comment was marked as outdated.

@the8472
Copy link
Member Author

the8472 commented Mar 9, 2023

I have cleaned up the PR and it should be ready for review. We still need the ena PR merged, but that won't change the substance of this one.

The relevant perf results are in #108815 (comment)

@the8472 the8472 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 9, 2023
@rust-log-analyzer

This comment has been minimized.

let mut index = 0;

let mut index =
processor.skippable_obligations(self.nodes.iter().map(|n| &n.obligation));
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment above this line is now out of date. Could you please update it? Probably just removing the entire second paragraph would be good enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not really out of date, it's just on the wrong line. The loop later still uses while because it can be mutated.

@nnethercote
Copy link
Contributor

The information in the commit log is very useful and should be put into a comment somewhere.

I'm amused that process_obligations used to have a fast past and a slow path. It now has a really fast path, a fast path, and a slow path.

Very nice work overall! r+ once the minor comments are addressed.

@bors delegate=the8472

@bors
Copy link
Contributor

bors commented Mar 10, 2023

✌️ @the8472 can now approve this pull request

@nnethercote
Copy link
Contributor

ena 0.14.2 is now out, with rust-lang/ena#45 in it.

- only borrow the refcell once per loop
- avoid complex matches to reduce branch paths in the hot loop
- use a by-ref fast path that avoids mutations at the expense of having false negatives
@the8472 the8472 force-pushed the process-obligations-fast-skip branch from 3792bf6 to 7cce618 Compare March 17, 2023 18:56
@the8472
Copy link
Member Author

the8472 commented Mar 17, 2023

@bors r=nnethercote rollup=never

@bors
Copy link
Contributor

bors commented Mar 17, 2023

📌 Commit 7cce618 has been approved by nnethercote

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. S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Mar 17, 2023
@bors
Copy link
Contributor

bors commented Mar 18, 2023

⌛ Testing commit 7cce618 with merge df61fca...

@bors
Copy link
Contributor

bors commented Mar 18, 2023

☀️ Test successful - checks-actions
Approved by: nnethercote
Pushing df61fca to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 18, 2023
@bors bors merged commit df61fca into rust-lang:master Mar 18, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 18, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (df61fca): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
1.5% [1.5%, 1.5%] 1
Improvements ✅
(primary)
-2.6% [-8.6%, -0.3%] 9
Improvements ✅
(secondary)
-12.7% [-21.9%, -7.8%] 6
All ❌✅ (primary) -2.3% [-8.6%, 0.5%] 10

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% [1.0%, 2.0%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.0% [-1.5%, -0.5%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [-1.5%, 2.0%] 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)
0.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.3% [-3.5%, -0.5%] 3
Improvements ✅
(secondary)
-11.6% [-11.9%, -11.2%] 2
All ❌✅ (primary) -1.6% [-3.5%, 0.6%] 4

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

7 participants