Skip to content

[experimental, do not merge!] a faster implementation of Polonius and a more compact DenseBitSet implementation #141583

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

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

tage64
Copy link

@tage64 tage64 commented May 26, 2025

This is the union of #141326 and #141325, a Polonius experiment combined with a more compact version of DenseBitSet. I would like to get a perf-run of this @lqd.

r? lqd

Tage Johansson added 12 commits May 21, 2025 10:02
This commit modifies DenseBitSet so that it only uses one word on the
stack instead of 4 words as before, allowing for faster clones. The
downside is that it may at most store 63 elements on the stack as aposed
to 128 for the previous implementation.
sizes are different

The new implementation of DenseBitSet doesn't store the exact domain
size, so of course the hash values for identical sets with different
domain sizes may be equal.
… dependency to be required instead of optional
…erialize dependency to be required instead of optional", and introduce conditional compilation instead.
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 26, 2025

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

Some changes occurred in src/tools/compiletest

cc @jieyouxu

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in coverage instrumentation.

cc @Zalathar

@lqd lqd marked this pull request as draft May 26, 2025 12:45
@lqd
Copy link
Member

lqd commented May 26, 2025

For perf tests, your PRs should be drafts so they’re not merged and also they won’t ping a lot of people until you want them to do so for review.

@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 May 26, 2025
bors added a commit that referenced this pull request May 26, 2025
[experimental, do not merge!] a faster implementation of Polonius and a more compact DenseBitSet implementation

This is the union of #141326 and #141325, a Polonius experiment combined with a more compact version of `DenseBitSet`. I would like to get a perf-run of this `@lqd.`

r? lqd
@bors
Copy link
Collaborator

bors commented May 26, 2025

⌛ Trying commit f2585eb with merge 16435a6...

@bors
Copy link
Collaborator

bors commented May 26, 2025

☀️ Try build successful - checks-actions
Build commit: 16435a6 (16435a66301a7d82ae6ff183f6d9a7005cb3f471)

@rust-timer

This comment has been minimized.

@Kobzol
Copy link
Contributor

Kobzol commented May 26, 2025

For perf tests, your PRs should be drafts so they’re not merged and also they won’t ping a lot of people until you want them to do so for review.

I think that drafts still ping ppl right now, although they shouldn't request a reviewer.

@lqd
Copy link
Member

lqd commented May 26, 2025

Sometimes we don't want to ping people, so I hope that's incorrect and they still don't ping.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (16435a6): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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 the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
2.1% [0.1%, 5.1%] 7
Regressions ❌
(secondary)
1.4% [0.3%, 3.6%] 12
Improvements ✅
(primary)
-0.5% [-3.0%, -0.1%] 69
Improvements ✅
(secondary)
-1.0% [-2.9%, -0.1%] 47
All ❌✅ (primary) -0.3% [-3.0%, 5.1%] 76

Max RSS (memory usage)

Results (primary 70.8%, secondary 25.3%)

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)
76.9% [0.9%, 191.0%] 12
Regressions ❌
(secondary)
25.3% [2.3%, 44.2%] 8
Improvements ✅
(primary)
-2.2% [-2.2%, -2.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 70.8% [-2.2%, 191.0%] 13

Cycles

Results (primary 1.4%, secondary 1.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)
2.4% [1.0%, 3.6%] 16
Regressions ❌
(secondary)
2.5% [1.9%, 3.3%] 5
Improvements ✅
(primary)
-1.6% [-2.8%, -0.9%] 5
Improvements ✅
(secondary)
-1.6% [-2.0%, -1.3%] 3
All ❌✅ (primary) 1.4% [-2.8%, 3.6%] 21

Binary size

Results (primary 0.0%, secondary 0.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.0% [0.0%, 0.1%] 46
Regressions ❌
(secondary)
0.1% [0.0%, 0.1%] 29
Improvements ✅
(primary)
-1.1% [-1.1%, -1.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-1.1%, 0.1%] 47

Bootstrap: 776.359s -> 774.569s (-0.23%)
Artifact size: 366.28 MiB -> 366.23 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 May 26, 2025
@lqd
Copy link
Member

lqd commented May 27, 2025

cranelift-codegen is still seeing a big +5% hit but funnily enough I likely have a -10% improvement for it.

I haven't looked into the code yet apart from our discussions and walkthrough, are the max-rss increases expected?

@tage64
Copy link
Author

tage64 commented May 28, 2025

cranelift-codegen is still seeing a big +5% hit but funnily enough I likely have a -10% improvement for it.

Great! How do you get that improvement? In the borrow checker, or somewhere else?

I haven't looked into the code yet apart from our discussions and walkthrough, are the max-rss increases expected?

No The max-rss increase in a few crates is not expected. I don't know what it comes from. It is at least not the DenseBitSet implementation because we see the same regression in #141326 which is same as this pr minus the DenseBitSet-changes. It has to be investigated further.

@lqd
Copy link
Member

lqd commented May 28, 2025

In move/init for liveness in the borrowck, #141667

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

6 participants