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

rustc_metadata: Fix encode_attrs #107171

Merged
merged 1 commit into from
Jan 27, 2023
Merged

rustc_metadata: Fix encode_attrs #107171

merged 1 commit into from
Jan 27, 2023

Conversation

petrochenkov
Copy link
Contributor

This function didn't do what the authors intended it to do.

  • Due to move in the closure is_public wasn't captured by mutalbe reference and wasn't used as a cache.
  • Due to iterator cloning all the should_encode_attr logic run for the second time to calculate may_have_doc_links

This PR fixes these issues, and calculates all the needed attribute flags in one go.

(Noticed while implementing #107136.)

@rustbot
Copy link
Collaborator

rustbot commented Jan 21, 2023

r? @nagisa

(rustbot has picked a reviewer for you, use r? to override)

@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 Jan 21, 2023
@petrochenkov
Copy link
Contributor Author

Waiting on #107136.
@rustbot label +S-blocked -S-waiting-on-review

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 21, 2023
@bors

This comment was marked as resolved.

@petrochenkov
Copy link
Contributor Author

@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 Jan 23, 2023
@bors
Copy link
Contributor

bors commented Jan 23, 2023

⌛ Trying commit 1cc2c93ae174a5da0712bd1c39248318e16f1582 with merge 2b3ab0d6f93e28450e0fcdd532e13c409502225e...

@petrochenkov petrochenkov removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Jan 23, 2023
@bors
Copy link
Contributor

bors commented Jan 23, 2023

☀️ Try build successful - checks-actions
Build commit: 2b3ab0d6f93e28450e0fcdd532e13c409502225e (2b3ab0d6f93e28450e0fcdd532e13c409502225e)

1 similar comment
@bors
Copy link
Contributor

bors commented Jan 23, 2023

☀️ Try build successful - checks-actions
Build commit: 2b3ab0d6f93e28450e0fcdd532e13c409502225e (2b3ab0d6f93e28450e0fcdd532e13c409502225e)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2b3ab0d6f93e28450e0fcdd532e13c409502225e): comparison URL.

Overall result: no relevant changes - no 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.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

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

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)
- - 0
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
-2.9% [-3.5%, -2.3%] 2
Improvements ✅
(secondary)
-3.3% [-3.8%, -2.9%] 2
All ❌✅ (primary) -2.9% [-3.5%, -2.3%] 2

Cycles

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

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 23, 2023
@nagisa
Copy link
Member

nagisa commented Jan 23, 2023

r? @cjgillot since they seem to have looked at this already.

@rustbot rustbot assigned cjgillot and unassigned nagisa Jan 23, 2023
@petrochenkov
Copy link
Contributor Author

Let's test the single bool alternative.
@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 Jan 24, 2023
@bors
Copy link
Contributor

bors commented Jan 24, 2023

⌛ Trying commit f3dd9b1fab6213d1c14b15b4377f7a11720f1e83 with merge cfdc1c649d2589c4f473d3ae183e9aa37365a426...

@bors
Copy link
Contributor

bors commented Jan 24, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (cfdc1c649d2589c4f473d3ae183e9aa37365a426): comparison URL.

Overall result: no relevant changes - no 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.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

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

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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.6% [-2.6%, -2.6%] 1
Improvements ✅
(secondary)
-2.8% [-2.8%, -2.8%] 1
All ❌✅ (primary) -2.6% [-2.6%, -2.6%] 1

Cycles

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

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

I understand even less now.
What is the difference between tcx.effective_visibilities(()) here and tcx.is_doc_hidden(def_id) in #107136 (comment)?
The latter grows dependency graph and causes regressions, and the former does not.
Is it due to the def_id parameter?

@petrochenkov
Copy link
Contributor Author

There's some minor difference in "non-relevant" results.
I'll leave to @cjgillot to decide which version to keep.
@rustbot ready

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 24, 2023
@cjgillot
Copy link
Contributor

Is it due to the def_id parameter?

Probably. Query dependency tracking deduplicates dependencies. So having all def-ids in metadata depend on effective_visibilities(()) create a single dep-node and a single dependency edge. Meanwhile, depending on is_doc_hidden(def_id) creates one dep-node and one edge for each def-id. For a few thousand def-ids, that has an impact.

@bors r+

@bors
Copy link
Contributor

bors commented Jan 24, 2023

📌 Commit f3dd9b1fab6213d1c14b15b4377f7a11720f1e83 has been approved by cjgillot

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 Jan 24, 2023
This function didn't do what the authors intended it to do.

- Due to `move` in the closure `is_public` wasn't captured by mutalbe reference and wasn't used as a cache.
- Due to iterator cloning all the `should_encode_attr` logic run for the second time to calculate `may_have_doc_links`

This PR fixes these issues, and calculates all the needed attribute flags in one go.
@petrochenkov
Copy link
Contributor Author

Removed [WIP] and squashed.
@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Jan 25, 2023

📌 Commit c70b7aa has been approved by cjgillot

It is now in the queue for this repository.

@petrochenkov
Copy link
Contributor Author

@bors rollup=maybe

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 27, 2023
Rollup of 8 pull requests

Successful merges:

 - rust-lang#105784 (update stdarch)
 - rust-lang#106856 (core: Support variety of atomic widths in width-agnostic functions)
 - rust-lang#107171 (rustc_metadata: Fix `encode_attrs`)
 - rust-lang#107242 (rustdoc: make item links consistently use `title="{shortty} {path}"`)
 - rust-lang#107279 (Use new solver during selection)
 - rust-lang#107284 (rustdoc: use smarter encoding for playground URL)
 - rust-lang#107325 (rustdoc: Stop using `HirId`s)
 - rust-lang#107336 (rustdoc: remove mostly-unused CSS classes `import-item` and `module-item`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit eb5e63e into rust-lang:master Jan 27, 2023
@rustbot rustbot added this to the 1.69.0 milestone Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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