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

Verify that query keys result in unique dep nodes #122227

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Mar 9, 2024

This implements checking that query keys result into unique dep nodes as mentioned in #112469.

We could do a perf check to see how expensive this is.

r? @michaelwoerister

@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 9, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Mar 9, 2024

@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 9, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 9, 2024
Verify that query keys result in unique dep nodes

This implements checking that query keys result into unique dep nodes as mentioned in rust-lang#112469.

We could do a perf check to see how expensive this is.

r? `@michaelwoerister`
@bors
Copy link
Contributor

bors commented Mar 9, 2024

⌛ Trying commit eae7593 with merge d8a5ccf...

@bors
Copy link
Contributor

bors commented Mar 9, 2024

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d8a5ccf): comparison URL.

Overall result: ❌ regressions - 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)
2.0% [0.2%, 7.6%] 200
Regressions ❌
(secondary)
2.4% [0.2%, 7.9%] 146
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.0% [0.2%, 7.6%] 200

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)
3.6% [0.9%, 7.5%] 32
Regressions ❌
(secondary)
4.7% [2.2%, 9.2%] 31
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) 3.6% [0.9%, 7.5%] 32

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)
2.4% [0.9%, 7.4%] 86
Regressions ❌
(secondary)
3.9% [1.1%, 7.6%] 55
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.1%, -2.1%] 1
All ❌✅ (primary) 2.4% [0.9%, 7.4%] 86

Binary size

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

Bootstrap: 649.534s -> 651.184s (0.25%)
Artifact size: 172.59 MiB -> 173.04 MiB (0.26%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 9, 2024
@Zoxc Zoxc force-pushed the query-hash-verify branch 2 times, most recently from a43d029 to 8099206 Compare March 9, 2024 23:33
@Zoxc Zoxc marked this pull request as ready for review March 10, 2024 08:58
@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 10, 2024

I've made -Z incremental_verify_ich or cfg!(debug_assertions) enable these checks.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 10, 2024

@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 10, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 10, 2024
Verify that query keys result in unique dep nodes

This implements checking that query keys result into unique dep nodes as mentioned in rust-lang#112469.

We could do a perf check to see how expensive this is.

r? `@michaelwoerister`
@bors
Copy link
Contributor

bors commented Mar 10, 2024

⌛ Trying commit 8099206 with merge 8455f36...

@bors
Copy link
Contributor

bors commented Mar 10, 2024

☀️ Try build successful - checks-actions
Build commit: 8455f36 (8455f36495442921566585d0db4fd9d0b344e255)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8455f36): comparison URL.

Overall result: ❌ regressions - 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)
2.0% [0.2%, 7.8%] 193
Regressions ❌
(secondary)
2.7% [0.4%, 7.8%] 129
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.0% [0.2%, 7.8%] 193

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)
3.6% [0.8%, 9.2%] 42
Regressions ❌
(secondary)
4.3% [0.9%, 15.1%] 115
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.6% [0.8%, 9.2%] 42

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)
2.3% [0.9%, 8.4%] 98
Regressions ❌
(secondary)
4.2% [1.2%, 8.5%] 61
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.3% [0.9%, 8.4%] 98

Binary size

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

Bootstrap: 648.949s -> 648.36s (-0.09%)
Artifact size: 310.01 MiB -> 310.47 MiB (0.15%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 10, 2024
@lqd
Copy link
Member

lqd commented Mar 10, 2024

(random passerby note about these last results, they show the worst case: for stability reasons the perf runs are done with incremental hash verification turned on all the time, instead of the default lower verification frequency)

Copy link
Member

@michaelwoerister michaelwoerister left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @Zoxc! Looks good to me.

One thing we could try to reduce the perf impact is skipping any DefId query keys because for these we already do exhaustive collision checking when constructing the DefPathHash map. I'm not sure if we are as thorough with other query keys that map to a DefPathHash. But we could do a perf run that skips queries with FingerprintStyle::reconstructible() == true to see what impact that has.

compiler/rustc_query_impl/src/plumbing.rs Outdated Show resolved Hide resolved
@michaelwoerister
Copy link
Member

(random passerby note about these last results, they show the worst case: for stability reasons the perf runs are done with incremental hash verification turned on all the time, instead of the default lower verification frequency)

Thanks for the hint, @lqd! That's really good to know.

@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 12, 2024

One thing we could try to reduce the perf impact

Not sure if it's worth optimizing given that it's opt-in.

@michaelwoerister
Copy link
Member

Yes, I agree. The overall perf impact is low enough not to make a real difference for compilers with debug assertions enabled and regular compilers won't be affected at all.

@bors r+

As per @lqd's comment, the performance cost will be visible to perf.rlo but that is an artificial side effect of perf.rlo enabling fingerprint verification. Regular users of the compiler won't be affected.

@rustbot label: +perf-regression-triaged

@bors
Copy link
Contributor

bors commented Mar 12, 2024

📌 Commit 55ba7a7 has been approved by michaelwoerister

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 12, 2024
@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Mar 12, 2024
@bors
Copy link
Contributor

bors commented Mar 13, 2024

⌛ Testing commit 55ba7a7 with merge d3555f3...

@bors
Copy link
Contributor

bors commented Mar 13, 2024

☀️ Test successful - checks-actions
Approved by: michaelwoerister
Pushing d3555f3 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 13, 2024
@bors bors merged commit d3555f3 into rust-lang:master Mar 13, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 13, 2024
@Zoxc Zoxc deleted the query-hash-verify branch March 13, 2024 04:47
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d3555f3): comparison URL.

Overall result: ❌ regressions - 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)
2.0% [0.2%, 7.8%] 193
Regressions ❌
(secondary)
2.4% [0.3%, 7.8%] 153
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.3% [-1.3%, -1.3%] 1
All ❌✅ (primary) 2.0% [0.2%, 7.8%] 193

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)
3.3% [0.9%, 7.2%] 30
Regressions ❌
(secondary)
7.1% [2.4%, 11.7%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.3% [0.9%, 7.2%] 30

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)
2.3% [0.7%, 7.9%] 117
Regressions ❌
(secondary)
4.3% [1.4%, 8.1%] 60
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.3% [0.7%, 7.9%] 117

Binary size

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

Bootstrap: 673.298s -> 674.552s (0.19%)
Artifact size: 310.29 MiB -> 310.77 MiB (0.15%)

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

7 participants