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

feed def_span in resolver #118633

Closed
wants to merge 1 commit into from
Closed

Conversation

bvanjoi
Copy link
Contributor

@bvanjoi bvanjoi commented Dec 5, 2023

Fixes #118552

This PR removes provider.def_span and instead introduces it during the definition collection process

r? @cjgillot

@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 Dec 5, 2023
@cjgillot
Copy link
Contributor

cjgillot commented Dec 5, 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 Dec 5, 2023
@bors
Copy link
Contributor

bors commented Dec 5, 2023

⌛ Trying commit c49fec5 with merge 167da5e...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 5, 2023
feed `def_span` in resolver

Fixes rust-lang#118552

This PR removes `provider.def_span` and instead introduces it during the definition collection process

r? `@cjgillot`
@bors
Copy link
Contributor

bors commented Dec 5, 2023

☀️ Try build successful - checks-actions
Build commit: 167da5e (167da5e5d5acfa513f782c9e7ae8a3f87609e2e7)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (167da5e): 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)
3.0% [0.3%, 19.6%] 22
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.3% [-0.6%, -0.1%] 20
Improvements ✅
(secondary)
-0.3% [-0.8%, -0.1%] 21
All ❌✅ (primary) 1.4% [-0.6%, 19.6%] 42

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)
7.6% [7.6%, 7.6%] 1
Regressions ❌
(secondary)
3.1% [2.3%, 4.2%] 3
Improvements ✅
(primary)
-1.3% [-2.1%, -0.7%] 3
Improvements ✅
(secondary)
-3.2% [-4.5%, -1.7%] 7
All ❌✅ (primary) 0.9% [-2.1%, 7.6%] 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)
4.7% [1.7%, 19.3%] 15
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.1% [-2.1%, -2.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.3% [-2.1%, 19.3%] 16

Binary size

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.3% [0.0%, 1.0%] 22
Regressions ❌
(secondary)
0.4% [0.2%, 0.7%] 12
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 2
Improvements ✅
(secondary)
-0.6% [-0.7%, -0.6%] 2
All ❌✅ (primary) 0.2% [-0.0%, 1.0%] 24

Bootstrap: 675.321s -> 675.595s (0.04%)
Artifact size: 314.15 MiB -> 314.19 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 5, 2023
@oli-obk
Copy link
Contributor

oli-obk commented Dec 5, 2023

I think this needs #115613 in order to not be a perf regression in some incremental cases

Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

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

I think this needs #115613 in order to not be a perf regression in some incremental cases

On the contrary, I think this is due to spans not being marked relative, as lowering does it.

compiler/rustc_middle/src/hir/map/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/lib.rs Outdated Show resolved Hide resolved
@bvanjoi bvanjoi force-pushed the fix-118552 branch 2 times, most recently from 9376503 to 7a8e550 Compare December 6, 2023 06:50
@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor

cjgillot commented Dec 7, 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 Dec 7, 2023
@bors
Copy link
Contributor

bors commented Dec 7, 2023

⌛ Trying commit e4c5f03 with merge e344b7c...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 7, 2023
feed `def_span` in resolver

Fixes rust-lang#118552

This PR removes `provider.def_span` and instead introduces it during the definition collection process

r? `@cjgillot`
@bors
Copy link
Contributor

bors commented Dec 7, 2023

☀️ Try build successful - checks-actions
Build commit: e344b7c (e344b7cc1f0649c320f336591df26ddf4fd0eaaf)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e344b7c): 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)
1.7% [0.1%, 19.5%] 44
Regressions ❌
(secondary)
1.1% [0.2%, 2.4%] 8
Improvements ✅
(primary)
-0.6% [-1.2%, -0.2%] 3
Improvements ✅
(secondary)
-0.3% [-0.6%, -0.2%] 17
All ❌✅ (primary) 1.5% [-1.2%, 19.5%] 47

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)
2.2% [0.5%, 7.7%] 11
Regressions ❌
(secondary)
2.0% [0.6%, 4.8%] 9
Improvements ✅
(primary)
-1.8% [-4.0%, -0.6%] 3
Improvements ✅
(secondary)
-3.4% [-4.1%, -2.0%] 6
All ❌✅ (primary) 1.4% [-4.0%, 7.7%] 14

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)
4.6% [0.5%, 19.2%] 15
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.6% [0.5%, 19.2%] 15

Binary size

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.2% [0.0%, 1.0%] 38
Regressions ❌
(secondary)
0.9% [0.0%, 1.5%] 14
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.5% [-0.5%, -0.5%] 2
All ❌✅ (primary) 0.2% [0.0%, 1.0%] 38

Bootstrap: 675.831s -> 672.572s (-0.48%)
Artifact size: 314.22 MiB -> 314.24 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 7, 2023
@petrochenkov
Copy link
Contributor

Why on earth does it affect mir_borrowck so much, of all things.

@bvanjoi bvanjoi force-pushed the fix-118552 branch 2 times, most recently from 6043a9f to 12376e0 Compare December 24, 2023 05:16
path.span.find_ancestor_in_same_ctxt(item.span).unwrap_or(item.span)
}
_ => named_span(item.span, item.ident, item.kind.generics()),
},
Node::Variant(variant) => named_span(variant.span, variant.ident, None),
Copy link
Contributor Author

@bvanjoi bvanjoi Dec 25, 2023

Choose a reason for hiding this comment

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

Only the parent of the constructor can enter Node::Variant(_) => xxxx

@@ -1227,16 +1228,19 @@ impl<'tcx> Resolver<'_, 'tcx> {
// FIXME: remove `def_span` body, pass in the right spans here and call `tcx.at().create_def()`
let def_id = self.tcx.create_def(parent, name, def_kind);

// Create the definition.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't actually deleted; rather, it's marked as removed in git and is consequently moved below (This is a result of moving self.tcx.untracked().source_span.push(span); a few lines ahead)

@bors
Copy link
Contributor

bors commented Jan 13, 2024

☔ The latest upstream changes (presumably #118947) made this pull request unmergeable. Please resolve the merge conflicts.

@apiraino
Copy link
Contributor

apiraino commented Feb 1, 2024

@bvanjoi : probably still needs perf triaging. thanks!

@rustbot author

@rustbot rustbot 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 1, 2024
@Dylan-DPC
Copy link
Member

@bvanjoi any updates on this? thanks

@bvanjoi
Copy link
Contributor Author

bvanjoi commented Feb 19, 2024

This PR was intended to feed the span during resolution, but it unexpectedly caused a performance regression in mir_borrowck under incremental builds. Unfortunately, I'm uncertain on how to debug it locally to find an appropriate solution.

@cjgillot Do you have any thoughts or suggestions regarding this? If not, I may consider closing it...

(Perhaps we could rerun this performance test, as I have addressed the previous comments?)

@Dylan-DPC
Copy link
Member

thanks let's give it a try

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 20, 2024
@bors
Copy link
Contributor

bors commented Feb 20, 2024

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout fix-118552 (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self fix-118552 --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging compiler/rustc_resolve/src/lib.rs
Auto-merging compiler/rustc_resolve/src/def_collector.rs
CONFLICT (content): Merge conflict in compiler/rustc_resolve/src/def_collector.rs
Auto-merging compiler/rustc_monomorphize/src/collector.rs
Auto-merging compiler/rustc_middle/src/hir/mod.rs
CONFLICT (content): Merge conflict in compiler/rustc_middle/src/hir/mod.rs
Auto-merging compiler/rustc_middle/src/hir/map/mod.rs
CONFLICT (content): Merge conflict in compiler/rustc_middle/src/hir/map/mod.rs
Auto-merging compiler/rustc_interface/src/queries.rs
Auto-merging compiler/rustc_ast_lowering/src/lib.rs
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 1571 and retry the command.
Automatic merge failed; fix conflicts and then commit the result.

@Dylan-DPC
Copy link
Member

gah..

@bvanjoi you would need to resolve the conflicts so we can run another perf run

@oskgo
Copy link
Contributor

oskgo commented Jul 26, 2024

@bvanjoi

Ping from triage: I'm closing this due to inactivity, Please reopen when you are ready to continue with this.
Note: if you are going to continue please open the PR BEFORE you push to it, else you won't be able to reopen - this is a quirk of github.
Thanks for your contribution.

@rustbot label: +S-inactive

@oskgo oskgo closed this Jul 26, 2024
@rustbot rustbot added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-perf Status: Waiting on a perf run to be completed. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Investigate feeding def_span in the resolver