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

Improve niche placement by trying two strategies and picking the better result #108106

Merged
merged 8 commits into from
Apr 29, 2023

Conversation

the8472
Copy link
Member

@the8472 the8472 commented Feb 16, 2023

Fixes #104807
Fixes #105371

Determining which sort order is better requires calculating the struct size (so we can calculate the niche offset). But that in turn depends on the field order, so happens after sorting. So the simple way to solve that is to run the whole thing twice and pick the better result.

1st commit is just code motion, the meat is in the later ones.

@rustbot
Copy link
Collaborator

rustbot commented Feb 16, 2023

r? @Nilstrieb

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

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

bors commented Feb 16, 2023

⌛ Trying commit 552fd837688a2b7c9197527c90de7aa89475cfc7 with merge 38dc63170b19f9212a1cefea8fd5368ab4322886...

@bors
Copy link
Contributor

bors commented Feb 17, 2023

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

1 similar comment
@bors
Copy link
Contributor

bors commented Feb 17, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (38dc63170b19f9212a1cefea8fd5368ab4322886): 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.6% [0.3%, 1.1%] 89
Regressions ❌
(secondary)
0.9% [0.3%, 2.6%] 20
Improvements ✅
(primary)
-0.8% [-1.1%, -0.5%] 2
Improvements ✅
(secondary)
-0.9% [-1.7%, -0.2%] 17
All ❌✅ (primary) 0.5% [-1.1%, 1.1%] 91

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.7% [2.2%, 3.7%] 3
Improvements ✅
(primary)
-1.5% [-1.5%, -1.5%] 1
Improvements ✅
(secondary)
-4.4% [-5.8%, -3.1%] 3
All ❌✅ (primary) -1.5% [-1.5%, -1.5%] 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)
2.6% [2.4%, 2.8%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 17, 2023
@rust-log-analyzer

This comment has been minimized.

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

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

bors commented Mar 4, 2023

⌛ Trying commit f0e024d22db7492c0848a05e15da88300bb7de96 with merge 8123ebf2c5823201a7c31a8ad8c32332ea3b8b57...

@bors
Copy link
Contributor

bors commented Mar 4, 2023

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

1 similar comment
@bors
Copy link
Contributor

bors commented Mar 4, 2023

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

@rust-timer

This comment has been minimized.

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

bors commented Apr 27, 2023

⌛ Testing commit a141f5b87bd94eb022e074cf7bce4fcb6d10d406 with merge 8f97ac75df44edcab355eabae3a6fbde6950c57e...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Apr 28, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 28, 2023
the8472 added 3 commits April 28, 2023 23:08
For start-biased layout we want to avoid overpromoting so that
the niche doesn't get pushed back.
For end-biased layout we want to avoid promoting fields that
may contain one of the niches of interest.
@the8472
Copy link
Member Author

the8472 commented Apr 28, 2023

excluded 32bit targets on a codegen tests because llvm seems to make different choices there (memset vs. stores)

@bors r=wesleywiser

@bors
Copy link
Contributor

bors commented Apr 28, 2023

📌 Commit 61fb5a9 has been approved by wesleywiser

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

bors commented Apr 29, 2023

⌛ Testing commit 61fb5a9 with merge f229949...

@bors
Copy link
Contributor

bors commented Apr 29, 2023

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing f229949 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 29, 2023
@bors bors merged commit f229949 into rust-lang:master Apr 29, 2023
@rustbot rustbot added this to the 1.71.0 milestone Apr 29, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f229949): 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.4% [0.2%, 0.6%] 7
Regressions ❌
(secondary)
0.7% [0.4%, 1.0%] 12
Improvements ✅
(primary)
-2.6% [-8.5%, -0.2%] 4
Improvements ✅
(secondary)
-1.2% [-2.8%, -0.3%] 31
All ❌✅ (primary) -0.7% [-8.5%, 0.6%] 11

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.8% [0.8%, 0.8%] 1
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
-5.1% [-8.9%, -2.8%] 3
Improvements ✅
(secondary)
-2.1% [-4.3%, -0.5%] 5
All ❌✅ (primary) -3.6% [-8.9%, 0.8%] 4

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.9% [1.1%, 3.8%] 60
Regressions ❌
(secondary)
2.9% [2.1%, 4.2%] 14
Improvements ✅
(primary)
-3.7% [-8.4%, -1.0%] 3
Improvements ✅
(secondary)
-6.3% [-9.2%, -1.2%] 9
All ❌✅ (primary) 1.6% [-8.4%, 3.8%] 63

@pnkfelix
Copy link
Member

pnkfelix commented May 3, 2023

  • addresses a real performance regression (#102750 regresses layout size of Cow<> #105371) to how we laid out niches.
  • primary big benefit to syn. rest of primary changes may be noise; the secondary improvements are nice to have.
  • marking as triaged.

@rustbot label: +perf-regression-triaged

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.

#102750 regresses layout size of Cow<> Niche placement heuristic: place at beginning or end of type
9 participants