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

Only track mentioned places for jump threading #127087

Merged
merged 4 commits into from
Jul 14, 2024
Merged

Conversation

cjgillot
Copy link
Contributor

This PR aims to reduce the state space size in jump threading and dataflow const-prop opts.

The current implementation walks the types of all locals, and creates a place for each possible projection. This can easily lead to a large number of places and tracked values, most being useless to the actual pass.

With this PR, we instead collect places that appear syntactically in the MIR (first commit). However, this is not sufficient (second commit), and we miss places that we could track in aggregate assignments. The third commit tracks such assignments to mirror place projections, see the inline comment.

This is complementary to #127036

r? @oli-obk

@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 Jun 28, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jun 28, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@cjgillot
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 Jun 28, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 28, 2024
Only track mentionned places for jump threading

This PR aims to reduce the state space size in jump threading and dataflow const-prop opts.

The current implementation walks the types of all locals, and creates a place for each possible projection. This can easily lead to a large number of places and tracked values, most being useless to the actual pass.

With this PR, we instead collect places that appear syntactically in the MIR (first commit). However, this is not sufficient (second commit), and we miss places that we could track in aggregate assignments. The third commit tracks such assignments to mirror place projections, see the inline comment.

This is complementary to rust-lang#127036

r? `@oli-obk`
@bors
Copy link
Contributor

bors commented Jun 28, 2024

⌛ Trying commit 845d318 with merge fa4f9fd...

@cjgillot cjgillot added the A-mir-opt Area: MIR optimizations label Jun 28, 2024
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jun 28, 2024

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (fa4f9fd): 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.5%, 1.2%] 3
Regressions ❌
(secondary)
0.3% [0.2%, 0.4%] 9
Improvements ✅
(primary)
-0.6% [-1.2%, -0.2%] 8
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.2% [-1.2%, 1.2%] 11

Max RSS (memory usage)

Results (primary 1.2%)

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.9% [2.1%, 3.7%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.2% [-2.3%, 3.7%] 3

Cycles

Results (primary 0.9%, secondary 2.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.9% [0.6%, 1.2%] 2
Regressions ❌
(secondary)
2.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [0.6%, 1.2%] 2

Binary size

Results (primary -0.1%, secondary -0.4%)

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%, 1.5%] 31
Regressions ❌
(secondary)
0.2% [0.0%, 0.4%] 2
Improvements ✅
(primary)
-0.4% [-1.0%, -0.0%] 18
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.2%] 38
All ❌✅ (primary) -0.1% [-1.0%, 1.5%] 49

Bootstrap: 696.308s -> 697.033s (0.10%)
Artifact size: 326.72 MiB -> 326.78 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 Jun 28, 2024
@tgross35
Copy link
Contributor

(s/mentionned/mentioned in the PR title before you merge)

@cjgillot cjgillot changed the title Only track mentionned places for jump threading Only track mentioned places for jump threading Jun 28, 2024
@cjgillot
Copy link
Contributor Author

cjgillot commented Jun 29, 2024

Perf: for the 2 most prominent regressions (syn and ripgrep), the time in jump-threading is reduced -40%, and extra time is spent in LLVM.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jul 3, 2024

☔ The latest upstream changes (presumably #127036) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@oli-obk oli-obk 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 (needs rebase)

@rustbot
Copy link
Collaborator

rustbot commented Jul 4, 2024

Some changes occurred in coverage tests.

cc @Zalathar

@cjgillot
Copy link
Contributor Author

cjgillot commented Jul 4, 2024

Second perf run to evaluate the effect of #127036

@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 Jul 4, 2024
@cjgillot
Copy link
Contributor Author

cjgillot commented Jul 4, 2024

Second perf run to evaluate the effect of #127036

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jul 4, 2024

⌛ Trying commit 82b6247 with merge 53ab1ce...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 4, 2024
Only track mentioned places for jump threading

This PR aims to reduce the state space size in jump threading and dataflow const-prop opts.

The current implementation walks the types of all locals, and creates a place for each possible projection. This can easily lead to a large number of places and tracked values, most being useless to the actual pass.

With this PR, we instead collect places that appear syntactically in the MIR (first commit). However, this is not sufficient (second commit), and we miss places that we could track in aggregate assignments. The third commit tracks such assignments to mirror place projections, see the inline comment.

This is complementary to rust-lang#127036

r? `@oli-obk`
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jul 4, 2024

☀️ Try build successful - checks-actions
Build commit: 53ab1ce (53ab1ce601eaa1e91fba073d3b73aa8c47ad648a)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (53ab1ce): 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)
1.0% [0.4%, 2.6%] 4
Regressions ❌
(secondary)
0.6% [0.2%, 1.6%] 29
Improvements ✅
(primary)
-0.3% [-0.6%, -0.2%] 5
Improvements ✅
(secondary)
-0.9% [-1.7%, -0.3%] 12
All ❌✅ (primary) 0.3% [-0.6%, 2.6%] 9

Max RSS (memory usage)

Results (primary 1.9%, secondary -1.4%)

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)
3.3% [2.3%, 4.8%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.1% [-2.1%, -2.1%] 1
Improvements ✅
(secondary)
-1.4% [-3.0%, -0.6%] 7
All ❌✅ (primary) 1.9% [-2.1%, 4.8%] 4

Cycles

Results (primary 0.6%, secondary 2.4%)

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.3% [2.3%, 2.3%] 1
Regressions ❌
(secondary)
2.4% [1.8%, 2.7%] 6
Improvements ✅
(primary)
-1.1% [-1.1%, -1.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [-1.1%, 2.3%] 2

Binary size

Results (primary -0.0%, secondary -0.4%)

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.2% [0.0%, 1.5%] 23
Regressions ❌
(secondary)
0.2% [0.0%, 0.4%] 2
Improvements ✅
(primary)
-0.2% [-1.0%, -0.0%] 28
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.2%] 38
All ❌✅ (primary) -0.0% [-1.0%, 1.5%] 51

Bootstrap: 738.413s -> 726.291s (-1.64%)
Artifact size: 328.22 MiB -> 327.70 MiB (-0.16%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 4, 2024
@bors
Copy link
Contributor

bors commented Jul 13, 2024

☔ The latest upstream changes (presumably #127665) made this pull request unmergeable. Please resolve the merge conflicts.

@cjgillot
Copy link
Contributor Author

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Jul 13, 2024

📌 Commit 6e3cff7 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 Jul 13, 2024
@bors
Copy link
Contributor

bors commented Jul 14, 2024

⌛ Testing commit 6e3cff7 with merge 0ffbddd...

@bors
Copy link
Contributor

bors commented Jul 14, 2024

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 14, 2024
@bors bors merged commit 0ffbddd into rust-lang:master Jul 14, 2024
7 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jul 14, 2024
@cjgillot cjgillot deleted the small-map branch July 14, 2024 11:49
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0ffbddd): 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.5% [0.4%, 0.6%] 3
Regressions ❌
(secondary)
1.1% [0.2%, 1.6%] 7
Improvements ✅
(primary)
-0.6% [-1.3%, -0.2%] 6
Improvements ✅
(secondary)
-0.6% [-2.0%, -0.3%] 8
All ❌✅ (primary) -0.2% [-1.3%, 0.6%] 9

Max RSS (memory usage)

Results (primary -3.2%)

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)
4.0% [4.0%, 4.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-5.0% [-8.6%, -2.2%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.2% [-8.6%, 4.0%] 5

Cycles

Results (primary -1.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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.1% [-1.3%, -0.8%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.1% [-1.3%, -0.8%] 2

Binary size

Results (primary -0.1%, secondary -0.4%)

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.2% [0.0%, 1.5%] 22
Regressions ❌
(secondary)
0.2% [0.0%, 0.4%] 2
Improvements ✅
(primary)
-0.2% [-1.0%, -0.0%] 30
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.2%] 38
All ❌✅ (primary) -0.1% [-1.0%, 1.5%] 52

Bootstrap: 704.399s -> 702.957s (-0.20%)
Artifact size: 328.72 MiB -> 328.69 MiB (-0.01%)

@rylev
Copy link
Member

rylev commented Jul 17, 2024

The perf impact was expected given the pre-merge runs and is less severe than it was pre-merge.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations 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.

8 participants