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

give the resolver access to TyCtxt #105462

Merged
merged 15 commits into from
Feb 21, 2023
Merged

give the resolver access to TyCtxt #105462

merged 15 commits into from
Feb 21, 2023

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Dec 8, 2022

The resolver is now created after TyCtxt is created. Then macro expansion and name resolution are run and the results fed into queries just like before this PR.

Since the resolver had (before this PR) mutable access to the CStore and the source span table, these two datastructures are now behind a RwLock. To ensure that these are not mutated anymore after the resolver is done, a read lock to them is leaked right after the resolver finishes.

PRs split out of this one and leading up to it:

@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 8, 2022
@oli-obk

This comment was marked as resolved.

@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 Dec 8, 2022
@bors
Copy link
Contributor

bors commented Dec 8, 2022

⌛ Trying commit 9b27fe51e70e1ef01326b1b1ffd1e399f51dea39 with merge 150b43a8f421dbd33945aa017aafcb12a093bbcb...

@petrochenkov petrochenkov self-assigned this Dec 8, 2022
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

this is amazing ❤️

compiler/rustc_interface/src/queries.rs Outdated Show resolved Hide resolved
src/librustdoc/core.rs Outdated Show resolved Hide resolved
@bors

This comment was marked as resolved.

@rust-timer

This comment has been minimized.

@rust-timer

This comment was marked as outdated.

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 8, 2022
@oli-obk oli-obk force-pushed the feeding_full branch 2 times, most recently from 50311de to dce8058 Compare December 9, 2022 22:10
@oli-obk

This comment was marked as resolved.

@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 Dec 9, 2022
@bors

This comment was marked as resolved.

@bors

This comment was marked as resolved.

@rust-timer

This comment has been minimized.

@rust-timer

This comment was marked as outdated.

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 10, 2022
@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 20, 2023

@bors r=cjgillot,petrochenkov

@bors
Copy link
Contributor

bors commented Feb 20, 2023

📌 Commit 0847b79 has been approved by cjgillot,petrochenkov

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 20, 2023
@bors
Copy link
Contributor

bors commented Feb 21, 2023

⌛ Testing commit 0847b79 with merge 2deff71...

@bors
Copy link
Contributor

bors commented Feb 21, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot,petrochenkov
Pushing 2deff71 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 21, 2023
@bors bors merged commit 2deff71 into rust-lang:master Feb 21, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 21, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2deff71): 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)
0.4% [0.2%, 1.4%] 94
Regressions ❌
(secondary)
0.6% [0.2%, 2.6%] 25
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.2%, 1.4%] 94

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)
1.2% [0.8%, 1.6%] 3
Regressions ❌
(secondary)
2.9% [1.2%, 5.5%] 12
Improvements ✅
(primary)
-1.5% [-1.5%, -1.4%] 2
Improvements ✅
(secondary)
-2.3% [-3.5%, -1.4%] 5
All ❌✅ (primary) 0.1% [-1.5%, 1.6%] 5

Cycles

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

@oli-obk oli-obk deleted the feeding_full branch February 21, 2023 07:49
@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 21, 2023

the 2.6% regression (deep-vector opt) is noise (it shows LLVM changes, which this PR can't cause in opt builds).

The other regressions are expected due to the additional locking, I am already working on removing some of the locking, but we decided to land this PR regardless as

  • it opens up using queries in the resolver, getting us better caching and thus incremental wins
  • we're actively working on reducing the locking, but that seems an orthogonal change that should not be part of this refactoring.

@Mark-Simulacrum Mark-Simulacrum added the perf-regression-triaged The performance regression has been triaged. label Feb 21, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2023
Use a lock-free datastructure for source_span

follow up to the perf regression in rust-lang#105462

The main regression is likely the CStore, but let's evaluate the perf impact of this on its own
@the8472
Copy link
Member

the8472 commented Feb 23, 2023

Note that, compared to instructions, this lead to a much bigger (real) wall-time regression in incremental builds. So you might want to keep an eye on that in PRs that try to recover performance.

@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 23, 2023

Ah! that's where the failed parallelism for dep-graph loading disappeared to. Will look at wall times in the follow up PRs.

RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 20, 2024
rustc/rustdoc: Perform name resolver cleanups enabled by #94857

Unblocks rust-lang/rust#105462.
r? `@oli-obk`
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
rustc/rustdoc: Perform name resolver cleanups enabled by #94857

Unblocks rust-lang/rust#105462.
r? `@oli-obk`
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. T-rustdoc Relevant to the rustdoc 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