-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
PGO cannot be used via cargo because of how RUSTFLAGS
are handled.
#7416
Comments
I've proposed a revert of #6503 at #7417 to fix this. @michaelwoerister out of curiosity was this the cause of why y'all weren't seeing great wins for PGO in Firefox? |
@alexcrichton I have confirmed that this issue prevents Firefox from getting any PGO wins, yes. However, I don't know yet if it is the only issue (e.g. GNU ld seems to have a bug that sometimes causes instrumented builds to not record anything 😱). I have some microbenchmarks that show a 10-15% win with PGO but have not been able to replicate that with the |
Oh dear that must have been absolutely gnarly to figure this out, sorry about that! |
It's exactly the kind of issue I expected to encounter |
Go back to not hashing `RUSTFLAGS` in `-Cmetadata` This is a moral revert of #6503 but not a literal code revert. This switches Cargo's behavior to avoid hashing compiler flags into `-Cmetadata` since we've now had multiple requests of excluding flags from the `-Cmetadata` hash: usage of `--remap-path-prefix` and PGO options. These options should only affect how the compiler is invoked/compiled and not radical changes such as symbol names, but symbol names are changed based on `-Cmetadata`. Instead Cargo will still track these flags internally, but only for reinvoking rustc, and not for caching separately based on rustc flags. Closes #7416
This is a moral revert of rust-lang#6503 but not a literal code revert. This switches Cargo's behavior to avoid hashing compiler flags into `-Cmetadata` since we've now had multiple requests of excluding flags from the `-Cmetadata` hash: usage of `--remap-path-prefix` and PGO options. These options should only affect how the compiler is invoked/compiled and not radical changes such as symbol names, but symbol names are changed based on `-Cmetadata`. Instead Cargo will still track these flags internally, but only for reinvoking rustc, and not for caching separately based on rustc flags. Closes rust-lang#7416
Problem
PGO works in two phases:
RUSTFLAGS=-Cprofile-generate
.RUSTFLAGS=-Cprofile-use
.In order for this to work, the symbol names within the two program versions must match up because LLVM generates profiling data in terms of symbol names.
However, since #6503,
RUSTFLAGS
are fed into the-Cmetadata
argument torustc
. This causes symbol names to differ because one version has-Cprofile-generate
and the other has-Cprofile-use
in theirRUSTFLAGS
.I think I would prefer not feeding
RUSTFLAGS
into-C metadata
at all. It does not seem right to me that symbol names are affected by random command line arguments to the compiler.The text was updated successfully, but these errors were encountered: