Kobzol/cargo-pgo

Difference between "cargo bench" and "cargo pgo bench"

zamazan4ik opened this issue · 4 comments

Not sure if is it an issue with cargo-pgo or not - I'll just put it here to share with other people.

During the PGO optimization for https://github.com/gorules/zen/ project, I found that cargo bench --workspace works fine (builds all required targets successfully and performs the required benchmarks) but during the cargo pgo bench -- --workspace I get the following linking errors: https://gist.github.com/zamazan4ik/176517dd1d5bb7dc07c92e13016dfd8d

I'm not sure what is the reason for the difference in behavior between these two almost the same commands. Maybe some custom build.rs rules are the root cause of the problem.

I tried it locally and it fails because of -Cprofile-generate. If you add it to cargo bench --workspace on that project, it fails with the same linker errors. I'm not sure how to easily display linking commands used by Cargo when the compilation succeeds, to diff what is different vs -Cprofile-generate.

I tried it locally and it fails because of -Cprofile-generate

Hmm, sounds interesting why it fails due to this. Since cargo-pgo is not the reason here (honestly, I expected it), what will be the right place to report the issue? Rustc upstream repo? As far as I understand, it isn't normal behavior.

Yes, this looks like a rustc issue.

Okay, in this case, I'll create the issue in the upstream.

If you think there is nothing to do with this issue from the cargo-pgo side, I think you can close the issue. Thank you!