Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

codegen-units=1 not honored #65996

Closed
matthiaskrgr opened this issue Oct 31, 2019 · 4 comments
Closed

codegen-units=1 not honored #65996

matthiaskrgr opened this issue Oct 31, 2019 · 4 comments
Labels
A-codegen Area: Code generation A-diagnostics Area: Messages for errors, warnings, and lints A-incr-comp Area: Incremental compilation C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Oct 31, 2019

cargo new foo
cd foo
RUSTFLAGS="-Ztime-passes -Ccodegen-units=1" cargo build  -j 1

When checking the output, it looks like there are several codegen units used when calling llvm, or is this something else?

    time: 0.010; rss: 116MB	monomorphization collection
    time: 0.000; rss: 116MB	codegen unit partitioning
    time: 0.000; rss: 118MB	write allocator module
    time: 0.000; rss: 119MB	llvm function passes [1p3g4pb8qsux2ebh]
    time: 0.000; rss: 119MB	llvm module passes [1p3g4pb8qsux2ebh]
    time: 0.002; rss: 121MB	codegen passes [1p3g4pb8qsux2ebh]
    time: 0.000; rss: 122MB	llvm function passes [2h4slianzkuyn4qa]
    time: 0.000; rss: 122MB	llvm module passes [2h4slianzkuyn4qa]
    time: 0.002; rss: 123MB	codegen passes [2h4slianzkuyn4qa]
    time: 0.000; rss: 123MB	llvm function passes [1uwbbgiy3kdescgz]
    time: 0.000; rss: 123MB	llvm module passes [1uwbbgiy3kdescgz]
    time: 0.001; rss: 123MB	codegen passes [1uwbbgiy3kdescgz]
    time: 0.000; rss: 123MB	llvm function passes [5e3yhkplw0iikeko]
    time: 0.000; rss: 123MB	llvm module passes [5e3yhkplw0iikeko]
    time: 0.002; rss: 123MB	codegen passes [5e3yhkplw0iikeko]
    time: 0.005; rss: 125MB	codegen to LLVM IR
    time: 0.000; rss: 125MB	assert dep graph
    time: 0.000; rss: 125MB	llvm function passes [3wor41lao02720f1]
    time: 0.000; rss: 125MB	llvm module passes [3wor41lao02720f1]

rustc 1.40.0-nightly (4a8c5b20c 2019-10-23)

@andjo403
Copy link
Contributor

codegen-units is only honored when incremental is off.
is is controled from here https://github.com/rust-lang/rust/blob/master/src/librustc_mir/monomorphize/partitioning.rs#L896
e.g. this will only give one codegen-unit CARGO_INCREMENTAL=0 RUSTFLAGS="-Ztime-passes -Ccodegen-units=1" cargo build

@ehuss
Copy link
Contributor

ehuss commented Nov 2, 2019

I added a note to my documentation PR (#65136) to mention that it is disabled: 3538ffb

@jonas-schievink jonas-schievink added A-codegen Area: Code generation T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 4, 2019
@matthiaskrgr
Copy link
Member Author

If this is a pebkac, could there be a warning that one specified flags basically "unused"?

@Mark-Simulacrum Mark-Simulacrum added A-diagnostics Area: Messages for errors, warnings, and lints A-incr-comp Area: Incremental compilation C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Dec 6, 2019
@jonas-schievink
Copy link
Contributor

Fixed by #70156

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-codegen Area: Code generation A-diagnostics Area: Messages for errors, warnings, and lints A-incr-comp Area: Incremental compilation C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants