Skip to content

feed def_span in resolver#118633

Closed
bvanjoi wants to merge 1 commit into
rust-lang:masterfrom
bvanjoi:fix-118552
Closed

feed def_span in resolver#118633
bvanjoi wants to merge 1 commit into
rust-lang:masterfrom
bvanjoi:fix-118552

Conversation

@bvanjoi

@bvanjoi bvanjoi commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

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

cjgillot commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

@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

bors commented Dec 5, 2023

Copy link
Copy Markdown
Collaborator

⌛ 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

bors commented Dec 5, 2023

Copy link
Copy Markdown
Collaborator

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

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
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

oli-obk commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

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

@cjgillot cjgillot left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread compiler/rustc_middle/src/hir/map/mod.rs Outdated
Comment thread compiler/rustc_resolve/src/lib.rs Outdated
@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

cjgillot commented Dec 7, 2023

Copy link
Copy Markdown
Contributor

@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

bors commented Dec 7, 2023

Copy link
Copy Markdown
Collaborator

⌛ 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

bors commented Dec 7, 2023

Copy link
Copy Markdown
Collaborator

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

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

Comment thread compiler/rustc_middle/src/hir/map/mod.rs Outdated
Comment thread compiler/rustc_resolve/src/lib.rs
@bvanjoi bvanjoi force-pushed the fix-118552 branch 2 times, most recently from 6043a9f to 12376e0 Compare December 24, 2023 05:16
}
_ => named_span(item.span, item.ident, item.kind.generics()),
},
Node::Variant(variant) => named_span(variant.span, variant.ident, None),

@bvanjoi bvanjoi Dec 25, 2023

Copy link
Copy Markdown
Contributor Author

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

// 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
Copy Markdown
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

bors commented Jan 13, 2024

Copy link
Copy Markdown
Collaborator

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

@apiraino

apiraino commented Feb 1, 2024

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Member

@bvanjoi any updates on this? thanks

@bvanjoi

bvanjoi commented Feb 19, 2024

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Member

thanks let's give it a try

@bors try @rust-timer queue

@rust-timer

Copy link
Copy Markdown
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

bors commented Feb 20, 2024

Copy link
Copy Markdown
Collaborator

🔒 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
Copy Markdown
Member

gah..

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

@oskgo

oskgo commented Jul 26, 2024

Copy link
Copy Markdown
Contributor

@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