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

Remove -Zinline-in-all-cgus and clean up tests/codegen-units/ #133929

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Dec 5, 2024

Implementation of rust-lang/compiler-team#814

I've taken some liberties with cleaning up the CGU partitioning tests, because that's the only place this flag was used and also mattered. I've often fought a lot with the contents of tests/codegen-units and it has never been clear to me when a test failure indicates a problem with my changes as opposed to a test just needing to be manually blessed. Hopefully the combination of the new README, new comments, and using -Zprint-mono-items=lazy in the partitioning tests improves that.

I've also deleted some of the tests/run-make/sepcomp tests. I think all the "sepcomp" tests have been obviated for years by better-designed (less flaky, clearer failures) test suites, but here I'm just deleting the ones I'm confident in.

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs 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, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@saethlin saethlin force-pushed the remove-inline-in-all-cgus branch from 9827f7e to b2b3983 Compare December 29, 2024 17:16
@rust-log-analyzer

This comment has been minimized.

@saethlin saethlin force-pushed the remove-inline-in-all-cgus branch from b2b3983 to 5dd9c96 Compare December 29, 2024 20:21
@saethlin saethlin changed the title Remove -Zinline-in-all-cgus Remove -Zinline-in-all-cgus and clean up tests/codegen-units/ Dec 31, 2024
@saethlin saethlin force-pushed the remove-inline-in-all-cgus branch from 5dd9c96 to 3db04a3 Compare January 4, 2025 03:04
@saethlin saethlin marked this pull request as ready for review January 5, 2025 18:33
@rustbot
Copy link
Collaborator

rustbot commented Jan 5, 2025

This PR modifies tests/run-make/. If this PR is trying to port a Makefile
run-make test to use rmake.rs, please update the
run-make port tracking issue
so we can track our progress. You can either modify the tracking issue
directly, or you can comment on the tracking issue and link this PR.

cc @jieyouxu

@jieyouxu jieyouxu self-assigned this Jan 5, 2025
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

I can only comment on the compiler/ changes and the run-make test removal, which LGTM. The actual codegen-units test diffs is probably better suited for @nnethercote to review after their vacation.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding these docss 💙

```
MONO_ITEM <item> @@ <cgu name>[<linkage>] <other cgu name>[<linkage in other cgu>]
```
DO NOT add tests to this suite that use `-Zprint-mono-items=eager`, that flag changes the way that MonoItem collection works in rather fundamental ways that are otherwise only used by `-Clink-dead-code`, and thus the MonoItems collected and their linkage under `-Zprint-mono-items=eager` does not correlate very well with normal compilation behavior.
Copy link
Member

Choose a reason for hiding this comment

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

Remark: almost makes me think this should be a separate codegen-units-partitioning suite, which bans -Zprint-mono-items=eager in compile-flags, but anyway.

@jieyouxu jieyouxu removed their assignment Jan 5, 2025
@jieyouxu jieyouxu added the A-testsuite Area: The testsuite used to check the correctness of rustc label Jan 5, 2025
@RalfJung
Copy link
Member

RalfJung commented Jan 20, 2025

I've often fought a lot with the contents of tests/codegen-units and it has never been clear to me when a test failure indicates a problem with my changes as opposed to a test just needing to be manually blessed.

I just ran into this as well. The README you added is only for the partitioning tests; is there anything useful to say about codegen-units tests more broadly? A top-level README telling contributors what to do when they see a failure in that folder could be useful.


@jieyouxu you unassigned yourself without picking a new reviewer. Was that deliberate? Someone should be in charge of the PR...

r? compiler

@saethlin
Copy link
Member Author

Just to avoid reviewer hot-potato:
r? nnethercote

@rustbot
Copy link
Collaborator

rustbot commented Jan 20, 2025

Could not assign reviewer from: nnethercote.
User(s) nnethercote are either the PR author, already assigned, or on vacation, and there are no other candidates.
Use r? to specify someone else to assign.

@saethlin saethlin assigned nnethercote and unassigned chenyukang Jan 20, 2025
@saethlin
Copy link
Member Author

The README you added is only for the partitioning tests; is there anything useful to say about codegen-units tests more broadly?

They are all based on -Zprint-mono-items, but other than that no. The codegen-units tests are for checking that items are assigned to the right CGU, and the item-collection tests are for checking that items were collected at all. Some of the item-collection tests also check which CGU an item was assigned to and with what linkage. I think those cases come from contributors not realizing that they can just say // MONO_ITEM <item name> @@ to ignore the CGU partitioning.

I want to work on the item-collection tests separately, because they are mostly but not all based on -Zprint-mono-iteam=eager, which primarily exists to collect MonoItems from dead code, but most of the tests also have #![deny(dead_code)].

@jieyouxu
Copy link
Member

@jieyouxu you unassigned yourself without picking a new reviewer. Was that deliberate? Someone should be in charge of the PR...

No, I thought nnethercote was already assigned...

@bors
Copy link
Contributor

bors commented Jan 21, 2025

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

@saethlin saethlin force-pushed the remove-inline-in-all-cgus branch from 3db04a3 to 512b3e3 Compare January 21, 2025 23:20
# codegen-units/partitioning tests

This test suite is designed to test that codegen unit partitioning works as intended.
Note that it does not evaluate whether CGU partitioning is *good*, that is the job of the compiler benchmark suite.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence has a comma splice which you don't need to fix but lots of people don't know about them so I thought I'd mention it for educational purposes :) (I'd change the comma to a period to fix it.)

```
MONO_ITEM <item> @@ <cgu name>[<linkage>] <other cgu name>[<linkage in other cgu>]
```
DO NOT add tests to this suite that use `-Zprint-mono-items=eager`, that flag changes the way that MonoItem collection works in rather fundamental ways that are otherwise only used by `-Clink-dead-code`, and thus the MonoItems collected and their linkage under `-Zprint-mono-items=eager` does not correlate very well with normal compilation behavior.
Copy link
Contributor

Choose a reason for hiding this comment

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

The first comma is another comma splice, lol

@nnethercote
Copy link
Contributor

Removes a crusty old -Z flag, removes low-value tests, adds documentation? Yes please!

r=me, I'll let you fix the tiny English flaws, only the "of" one matters at all.

@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 28, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Jan 28, 2025
…, r=nnethercore

Remove -Zinline-in-all-cgus and clean up tests/codegen-units/

Implementation of rust-lang/compiler-team#814

I've taken some liberties with cleaning up the CGU partitioning tests, because that's the only place this flag was used and also mattered. I've often fought a lot with the contents of `tests/codegen-units` and it has never been clear to me when a test failure indicates a problem with my changes as opposed to a test just needing to be manually blessed. Hopefully the combination of the new README, new comments, and using `-Zprint-mono-items=lazy` in the partitioning tests improves that.

I've also deleted some of the `tests/run-make/sepcomp` tests. I think all the "sepcomp" tests have been obviated for years by better-designed (less flaky, clearer failures) test suites, but here I'm just deleting the ones I'm confident in.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#133151 (Trim extra whitespace in fn ptr suggestion span)
 - rust-lang#133929 (Remove -Zinline-in-all-cgus and clean up tests/codegen-units/)
 - rust-lang#134290 (Windows x86: Change i128 to return via the vector ABI)
 - rust-lang#135886 (Document purpose of closure in from_fn.rs more clearly)
 - rust-lang#136012 (Document powf and powi values that are always 1.0)
 - rust-lang#136104 (Add mermaid graphs of NLL regions and SCCs to polonius MIR dump)
 - rust-lang#136117 (Subtree update of `rust-analyzer`)
 - rust-lang#136143 (Update books)
 - rust-lang#136153 (Locate asan-odr-win with other sanitizer tests)

r? `@ghost`
`@rustbot` modify labels: rollup
@Zalathar
Copy link
Contributor

Several of the item-collection tests failed in rollup: #136165 (comment)

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 28, 2025
@saethlin
Copy link
Member Author

@bors rollup=iffy

@saethlin saethlin force-pushed the remove-inline-in-all-cgus branch from a721dd6 to bf9df97 Compare January 28, 2025 04:48
@saethlin
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Jan 28, 2025

⌛ Trying commit bf9df97 with merge 75620fd...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2025
…r=<try>

Remove -Zinline-in-all-cgus and clean up tests/codegen-units/

Implementation of rust-lang/compiler-team#814

I've taken some liberties with cleaning up the CGU partitioning tests, because that's the only place this flag was used and also mattered. I've often fought a lot with the contents of `tests/codegen-units` and it has never been clear to me when a test failure indicates a problem with my changes as opposed to a test just needing to be manually blessed. Hopefully the combination of the new README, new comments, and using `-Zprint-mono-items=lazy` in the partitioning tests improves that.

I've also deleted some of the `tests/run-make/sepcomp` tests. I think all the "sepcomp" tests have been obviated for years by better-designed (less flaky, clearer failures) test suites, but here I'm just deleting the ones I'm confident in.

try-job: x86_64-gnu-nopt
@bors
Copy link
Contributor

bors commented Jan 28, 2025

☀️ Try build successful - checks-actions
Build commit: 75620fd (75620fdde39563b7b572f5f1cc6a77f7a9dd3753)

@saethlin
Copy link
Member Author

@bors r=nnethercote

@bors
Copy link
Contributor

bors commented Jan 28, 2025

📌 Commit bf9df97 has been approved by nnethercote

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 Jan 28, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Jan 28, 2025
…, r=nnethercote

Remove -Zinline-in-all-cgus and clean up tests/codegen-units/

Implementation of rust-lang/compiler-team#814

I've taken some liberties with cleaning up the CGU partitioning tests, because that's the only place this flag was used and also mattered. I've often fought a lot with the contents of `tests/codegen-units` and it has never been clear to me when a test failure indicates a problem with my changes as opposed to a test just needing to be manually blessed. Hopefully the combination of the new README, new comments, and using `-Zprint-mono-items=lazy` in the partitioning tests improves that.

I've also deleted some of the `tests/run-make/sepcomp` tests. I think all the "sepcomp" tests have been obviated for years by better-designed (less flaky, clearer failures) test suites, but here I'm just deleting the ones I'm confident in.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#133151 (Trim extra whitespace in fn ptr suggestion span)
 - rust-lang#133929 (Remove -Zinline-in-all-cgus and clean up tests/codegen-units/)
 - rust-lang#135886 (Document purpose of closure in from_fn.rs more clearly)
 - rust-lang#135961 (Fix 2/4 tests skipped by opt-dist)
 - rust-lang#136104 (Add mermaid graphs of NLL regions and SCCs to polonius MIR dump)
 - rust-lang#136124 (Arbitrary self types v2: explain test.)
 - rust-lang#136153 (Locate asan-odr-win with other sanitizer tests)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented Jan 28, 2025

⌛ Testing commit bf9df97 with merge aa6f5ab...

@bors
Copy link
Contributor

bors commented Jan 28, 2025

☀️ Test successful - checks-actions
Approved by: nnethercote
Pushing aa6f5ab to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 28, 2025
@bors bors merged commit aa6f5ab into rust-lang:master Jan 28, 2025
7 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 28, 2025
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (aa6f5ab): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.4%, 0.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -0.0%, secondary -1.1%)

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.9% [0.9%, 0.9%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.9% [-0.9%, -0.9%] 1
Improvements ✅
(secondary)
-1.1% [-1.1%, -1.1%] 1
All ❌✅ (primary) -0.0% [-0.9%, 0.9%] 2

Cycles

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

Binary size

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

Bootstrap: 773.228s -> 773.088s (-0.02%)
Artifact size: 328.20 MiB -> 328.30 MiB (0.03%)

@saethlin saethlin deleted the remove-inline-in-all-cgus branch January 28, 2025 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. 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.

10 participants