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 use the new node hashmap for anonymous nodes #138629

Merged
merged 9 commits into from
Mar 24, 2025

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Mar 17, 2025

This is a rebase of #112469.

cc @cjgillot

@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 18, 2025

I've done some tweaks and added the check for duplicate dep nodes when loading the previous graph, which was the main thing missing in #112469.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 19, 2025

@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 19, 2025
@bors
Copy link
Contributor

bors commented Mar 19, 2025

⌛ Trying commit 6737653 with merge c4c8ab2...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 19, 2025
Only use the new node hashmap for anonymous nodes

This is a rebase of rust-lang#112469.

cc `@cjgillot`
@bors
Copy link
Contributor

bors commented Mar 19, 2025

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

@rust-timer

This comment has been minimized.

@Zoxc Zoxc force-pushed the graph-anon-hashmap branch from 6737653 to 2736a2a Compare March 19, 2025 20:31
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c4c8ab2): 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)
0.3% [0.2%, 0.5%] 16
Regressions ❌
(secondary)
0.4% [0.2%, 0.8%] 15
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.4%, -0.2%] 3
All ❌✅ (primary) 0.3% [0.2%, 0.5%] 16

Max RSS (memory usage)

Results (primary 1.1%, secondary 2.6%)

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.6% [0.6%, 3.4%] 13
Regressions ❌
(secondary)
6.8% [5.2%, 7.3%] 4
Improvements ✅
(primary)
-1.6% [-1.9%, -1.4%] 2
Improvements ✅
(secondary)
-1.5% [-2.3%, -1.1%] 4
All ❌✅ (primary) 1.1% [-1.9%, 3.4%] 15

Cycles

Results (primary -1.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
Regressions ❌
(secondary)
2.9% [2.1%, 3.8%] 2
Improvements ✅
(primary)
-1.0% [-1.1%, -0.8%] 3
Improvements ✅
(secondary)
-3.8% [-4.1%, -3.5%] 2
All ❌✅ (primary) -1.0% [-1.1%, -0.8%] 3

Binary size

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

Bootstrap: 773.717s -> 774.014s (0.04%)
Artifact size: 365.52 MiB -> 365.71 MiB (0.05%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 20, 2025
@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 20, 2025

There are some incr-full instruction regressions, but they don't show up in cycles and wall-time. incr-unchanged and incr-patched have decent improvements in cycles and wall-time however.

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 24, 2025
Remove `prev_index_to_index` field from `CurrentDepGraph`

The dep graph currently has 2 ways to map a previous index into a current index. The `prev_index_to_index` map stores the current index equivalent of a previous index. For indices which are marked green, we also store the same information in the `DepNodeColorMap`. We actually only need to known the mapping for green nodes however, so this PR removes `prev_index_to_index` and instead makes use of the `DepNodeColorMap`.

To avoid racing when promoting a node from the previous session, the encoder lock is now used to ensure only one thread encodes the promoted node. This was previously done by the lock in `prev_index_to_index`.

This also changes `nodes_newly_allocated_in_current_session` used to detect duplicate dep nodes to contain both new and previous nodes, which is simpler and can better catch duplicates.

The dep node index encoding used in `DepNodeColorMap` is tweak to avoid subtraction / addition to optimize accessing the current equivalent of a previous index.

This is based on rust-lang#138629.

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

oli-obk commented Mar 24, 2025

@bors r+

@bors
Copy link
Contributor

bors commented Mar 24, 2025

📌 Commit 2736a2a 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 Mar 24, 2025
@bors
Copy link
Contributor

bors commented Mar 24, 2025

⌛ Testing commit 2736a2a with merge 4510e86...

@bors
Copy link
Contributor

bors commented Mar 24, 2025

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 24, 2025
@bors bors merged commit 4510e86 into rust-lang:master Mar 24, 2025
7 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 24, 2025
Copy link

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 90f5eab (parent) -> 4510e86 (this PR)

Test differences

No test diffs found

@Zoxc Zoxc deleted the graph-anon-hashmap branch March 24, 2025 18:57
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4510e86): comparison URL.

Overall result: ❌ regressions - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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)
0.3% [0.1%, 0.5%] 31
Regressions ❌
(secondary)
0.4% [0.1%, 0.8%] 17
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) 0.3% [0.1%, 0.5%] 31

Max RSS (memory usage)

Results (primary 1.7%, secondary 3.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)
1.9% [0.8%, 4.4%] 23
Regressions ❌
(secondary)
3.5% [1.1%, 7.5%] 12
Improvements ✅
(primary)
-2.2% [-2.2%, -2.2%] 1
Improvements ✅
(secondary)
-2.1% [-2.1%, -2.1%] 1
All ❌✅ (primary) 1.7% [-2.2%, 4.4%] 24

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: 774.602s -> 777.981s (0.44%)
Artifact size: 365.58 MiB -> 365.75 MiB (0.05%)

@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 24, 2025

I forgot that perf turns on incremental-verify-ich, that would explain the regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. 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.

None yet

6 participants