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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

@saethlin saethlin force-pushed the remove-inline-in-all-cgus branch from 512b3e3 to a721dd6 Compare January 28, 2025 00:23
@saethlin
Copy link
Member Author

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

I fixed all of them, surely this PR is flawless now :)

@saethlin
Copy link
Member Author

@bors r=nnethercore rollup

@bors
Copy link
Contributor

bors commented Jan 28, 2025

📌 Commit a721dd6 has been approved by nnethercore

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 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.
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 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.

8 participants