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

Index and hash HIR as part of lowering #89124

Merged
merged 17 commits into from
Oct 18, 2021
Merged

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Sep 20, 2021

Part of #88186
Based on #88880 (see merge commit).

Once HIR is lowered, it is later indexed by the index_hir query and hashed for crate_hash. This PR moves those post-processing steps to lowering itself. As a side objective, the HIR crate data structure is refactored as an IndexVec<LocalDefId, Option<OwnerInfo<'hir>>> where OwnerInfo stores all the relevant information for an HIR owner.

r? @michaelwoerister
cc @petrochenkov

@rust-highfive
Copy link
Collaborator

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 20, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@petrochenkov petrochenkov self-assigned this Sep 20, 2021
@cjgillot
Copy link
Contributor Author

@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 Sep 21, 2021
@bors
Copy link
Contributor

bors commented Sep 21, 2021

⌛ Trying commit 701098f9476dcab4555517d26abe5d1050c2b899 with merge 5395b5fa9aea18700afc4e5ac3e94a260e124494...

@bors
Copy link
Contributor

bors commented Sep 21, 2021

☀️ Try build successful - checks-actions
Build commit: 5395b5fa9aea18700afc4e5ac3e94a260e124494 (5395b5fa9aea18700afc4e5ac3e94a260e124494)

@rust-timer
Copy link
Collaborator

Queued 5395b5fa9aea18700afc4e5ac3e94a260e124494 with parent 49c0861, future comparison URL.

@petrochenkov petrochenkov removed their assignment Sep 21, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5395b5fa9aea18700afc4e5ac3e94a260e124494): comparison url.

Summary: This change led to very large relevant mixed results 🤷 in compiler performance.

  • Very large improvement in instruction counts (up to -5.1% on full builds of cranelift-codegen)
  • Large regression in instruction counts (up to 3.2% on incr-patched: dummy fn builds of unused-warnings)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led 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-review -S-waiting-on-perf +perf-regression

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 21, 2021
@michaelwoerister
Copy link
Member

Thanks, @cjgillot, I've blocked off some time to review this tomorrow.

@michaelwoerister
Copy link
Member

This looks pretty promising :)

The first commits are other pending PRs (see merge commits).

Is this still based on pending PRs? If yes, would you mind listing them? If no, please rebase.

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.

This is not a complete review. Just leaving a few comments.

compiler/rustc_middle/src/hir/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/hir/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/hir/mod.rs Outdated Show resolved Hide resolved
@michaelwoerister
Copy link
Member

Do we have a high-level description of what the lowering process and query setup will look like after rust-lang/compiler-team#452?

@cjgillot
Copy link
Contributor Author

I added a summary description in #88186 description.

@bors

This comment has been minimized.

@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 13, 2021
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 14, 2021
@michaelwoerister
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 18, 2021

📌 Commit 1e2dbb5 has been approved by michaelwoerister

@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 Oct 18, 2021
@bors
Copy link
Contributor

bors commented Oct 18, 2021

⌛ Testing commit 1e2dbb5 with merge bd41e09...

@bors
Copy link
Contributor

bors commented Oct 18, 2021

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 18, 2021
@bors bors merged commit bd41e09 into rust-lang:master Oct 18, 2021
@rustbot rustbot added this to the 1.58.0 milestone Oct 18, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (bd41e09): comparison url.

Summary: This change led to very large relevant mixed results 🤷 in compiler performance.

  • Very large improvement in instruction counts (up to -5.4% on full builds of cranelift-codegen)
  • Very large regression in instruction counts (up to 5.3% on full builds of unused-warnings)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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

@rylev
Copy link
Member

rylev commented Oct 20, 2021

@cjgillot @michaelwoerister this indeed looks like a pretty significant regression. The unused-warnings benchmark is showing large regressions in hir_lowering. I noticed that the perf run done before merging shows similar results. Was there a reason to merge despite the poor perf results?

@michaelwoerister
Copy link
Member

My reading of the results was: this regresses two small, synthetic benchmarks while improving performance for many real-world benchmarks. That seemed like a good tradeoff.

@rylev
Copy link
Member

rylev commented Oct 25, 2021

@michaelwoerister that's certainly reasonable, but two thoughts to add there:

  • We'd like to make reasoning like that explicit, so it would be helpful next time to add your reasoning in a comment along with @rustbot label +perf-regression-triaged so that we can track that this perf regression is acceptable.
  • While it certainly makes sense to provide more weight to real-world crates than to "synthetic" stress test crates, the regressions are very large (at times 60 times the significance threshold). It seems unwise to me to shrug off regressions of that magnitude even if they aren't in real-world crates.
  • While this change may not impact a real-world crate that we use in performance testing, it is highly unlikely that the regression of the magnitude we see in unused-warnings or externs won't negatively impact some real world crates.

In my opinion, we should look into this regression or at the very least have a larger discussion about how to interpret these types of regressions. In the future, the plan is to make regressions such as this one block bors from merging without an explicit opting out.

@the8472
Copy link
Member

the8472 commented Nov 2, 2021

This PR also regressed max-rss across several benchmarks. It's not noise, as can be seen in the stm32f4 timelines which are low-noise for max-rss benchmarks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.