-
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
fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes #14830
Conversation
r? @weihanglo rustbot has assigned @weihanglo. Use |
|
f709c73
to
2af218d
Compare
FWIW, I think this should resolve an issue in the Hubris build system. Currently we bypass Cargo's dirtiness checks for building deps in certain circumstances (to get maximum reuse of objects despite small controlled changes to Haven't tested it yet though. |
26ced7e
to
536ae6e
Compare
dep_c_extra_filename_hashes.hash(&mut c_extra_filename_hasher); | ||
// Avoid trashing the caches on RUSTFLAGS changing via `c_extra_filename` | ||
// | ||
// Limited to `c_extra_filename` to help with reproducible build / PGO issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should (probably) avoid the PGO problems, since the symbols won't change. However, this could still cause problems with reproducible builds if the rlib filename somehow leaks into the resulting binary (I don't have a reason to think it does, but it seems risky).
I believe this does because the filenames of object files show up as the codegen unit names in dwarf debug info (and probably PDB?). I suspect that everything else in the binary will be the same, but builds differing only in extra-filename are likely to still produce different binaries.
Have we checked if it doesn't affect PGO?
We would like to check if anything is leaking rlib filename in debug info files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea how to go about that? I have no experience with PGO and we have no tests focusing on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do some experiments this week and see if we can have tests written down!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Posted #14859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test passes with this PR for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the meeting notes, it says we were going to move forward with the hack where we conditionally add RUSTFLAGS to -Cextra-filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I am forgetting things more often recently…
Given that, this PR is ready to go!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this from the queue as I'd like to add that hack before this gets merged so we don't accidentally break people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will move forward with ed's hack.
I am confused by the meeting note. I assumed Ed's hack is this PR. The “hack” you are going to add is #6966, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#6966 filters out --remap-path-prefix
from being hashed.
The hack I proposed is that we skip hashing all RUSTFLAGS if something that looks like --remap-path-prefix
is present.
16ce931
to
c762927
Compare
### What does this PR try to resolve? This is a regression test to prevent issues like #7416. The test only run on Linux, as other platforms have different requirements for PGO, or emit different PGO function missing warnings. ### How should we test and review this PR? Not sure how brittle it is. We can optionally run it only on Cargo's CI? cc #14830
6f03f7f
to
1b5bc3a
Compare
dep_c_extra_filename_hashes.hash(&mut c_extra_filename_hasher); | ||
// Avoid trashing the caches on RUSTFLAGS changing via `c_extra_filename` | ||
// | ||
// Limited to `c_extra_filename` to help with reproducible build / PGO issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I am forgetting things more often recently…
Given that, this PR is ready to go!
I almost overlooked these
…e hashes For now, they should result in the same data.
a0a0122
to
0559b75
Compare
7a1b3d3
to
29a267a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Doesn't seem relevant. Re-queue it. |
Update cargo 6 commits in 05f54fdc34310f458033af8a63ce1d699fae8bf6..20a443231846b81c7b909691ec3f15eb173f2b18 2024-12-03 03:14:12 +0000 to 2024-12-06 21:56:56 +0000 - fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes (rust-lang/cargo#14830) - fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions' (rust-lang/cargo#14901) - docs(fingerprint): cargo-rustc extra flags do not affect the metadata (rust-lang/cargo#14898) - fix(add): Don't select yanked versions when normalizing names (rust-lang/cargo#14895) - fix(fix): Migrate workspace dependencies (rust-lang/cargo#14890) - test(build-std): make mock-std closer to real world (rust-lang/cargo#14896)
Update cargo 6 commits in 05f54fdc34310f458033af8a63ce1d699fae8bf6..20a443231846b81c7b909691ec3f15eb173f2b18 2024-12-03 03:14:12 +0000 to 2024-12-06 21:56:56 +0000 - fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes (rust-lang/cargo#14830) - fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions' (rust-lang/cargo#14901) - docs(fingerprint): cargo-rustc extra flags do not affect the metadata (rust-lang/cargo#14898) - fix(add): Don't select yanked versions when normalizing names (rust-lang/cargo#14895) - fix(fix): Migrate workspace dependencies (rust-lang/cargo#14890) - test(build-std): make mock-std closer to real world (rust-lang/cargo#14896)
Update cargo 6 commits in 05f54fdc34310f458033af8a63ce1d699fae8bf6..20a443231846b81c7b909691ec3f15eb173f2b18 2024-12-03 03:14:12 +0000 to 2024-12-06 21:56:56 +0000 - fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes (rust-lang/cargo#14830) - fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions' (rust-lang/cargo#14901) - docs(fingerprint): cargo-rustc extra flags do not affect the metadata (rust-lang/cargo#14898) - fix(add): Don't select yanked versions when normalizing names (rust-lang/cargo#14895) - fix(fix): Migrate workspace dependencies (rust-lang/cargo#14890) - test(build-std): make mock-std closer to real world (rust-lang/cargo#14896)
Update cargo 6 commits in 05f54fdc34310f458033af8a63ce1d699fae8bf6..20a443231846b81c7b909691ec3f15eb173f2b18 2024-12-03 03:14:12 +0000 to 2024-12-06 21:56:56 +0000 - fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes (rust-lang/cargo#14830) - fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions' (rust-lang/cargo#14901) - docs(fingerprint): cargo-rustc extra flags do not affect the metadata (rust-lang/cargo#14898) - fix(add): Don't select yanked versions when normalizing names (rust-lang/cargo#14895) - fix(fix): Migrate workspace dependencies (rust-lang/cargo#14890) - test(build-std): make mock-std closer to real world (rust-lang/cargo#14896)
What does this PR try to resolve?
Fixes #8716
This splits
-C metdata
and-C extra-filename
and addsRUSTFLAGS
to-C extra-filename
in the hope that we can still make PGO and reproducible builds work while caching artifacts per RUSTFLAGS used.How should we test and review this PR?
Additional information