-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Save/load incremental compilation dep graph #32016
Conversation
Ah, I forgot about the impl variant thing. We may not want to merge this just yet until 61202ad is solved in some better way, since people will complain about their symbol names. :) |
📫 |
Doing a quick rebase now. |
c1295ad
to
aa99e5d
Compare
@michaelwoerister argh -- I forgot when we were just talking about the "symbol names for impl" business. I should probably fix that before we land this PR. Still not sure of the best way to do so though, I'll have to think about it. Maybe I can do some quick hack so things are "no worse" than today. |
I've taken a look at the Itanium C++ ABI symbol mangling scheme (which GCC uses) and it does not seem to support something like |
☔ The latest upstream changes (presumably #30884) made this pull request unmergeable. Please resolve the merge conflicts. |
Sigh. I wish they had just used something generic like URL-encoding. |
Just out of date, I think. |
I've done a first pass over the PR. In general it looks good to me. The incremental test framework looks pretty neat. But I have to do another, more in-depth, reading of the code, especially the dep-graph serialization. One thing that I noticed was that there are some changes that show up one or two commits early, so that those commits won't compile. Do we have some policy on this? Should each commit be valid on its own? |
AFAIK, we don't, and they need not be. We can still easily bisect using the bors merge commits. I just tried to break it up into logical steps for your convenience -- but I don't think I'll go back and make fake history just to ensure that everything builds at each step (the real history was ... a bit convoluted). |
6bd48ec
to
92729d4
Compare
☔ The latest upstream changes (presumably #32126) made this pull request unmergeable. Please resolve the merge conflicts. |
@michaelwoerister so I'm rebasing this atop your other PR and making various adjustments. Will ping you when ready. |
59cff17
to
14023bb
Compare
ed9b2ad
to
cf8c869
Compare
☔ The latest upstream changes (presumably #32513) made this pull request unmergeable. Please resolve the merge conflicts. |
38eae85
to
4a0e984
Compare
ping @michaelwoerister rebased and ready for re-review :) -- as before the commits are not truly standalone, but hopefully broken up enough to give you some sense of the major pieces |
Thanks for the notification. I try to do the review this week. |
☔ The latest upstream changes (presumably #32576) made this pull request unmergeable. Please resolve the merge conflicts. |
Going to take a look at this today... |
|
||
"crate_disambiguator".hash(&mut state); | ||
crate_disambiguator.len().hash(&mut state); | ||
crate_disambiguator.hash(&mut state); | ||
crate_disambiguator.as_str().len().hash(&mut state); |
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.
We might get into trouble here with endianess.
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.
@michaelwoerister I guess we should discuss the role of the SVH. I see it as being used for two purposes:
- to drive incr. comp.; for this role, endian-ness is no problem
- to check for duplicate versions of a crate; here it's a bit less clear, endianness could be an issue in the sense that compiling the same source could produce distinct hashes on different host architectures.
I am somewhat...surprised to see that write_usize
for hashes does seem to convert to a [u8; 4]
. Crazy.
I guess we can write a "endian-proof" wrapper, though there is also code which converts &[usize]
to &[u8]
, which would be harder.
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'm not sure if it's a good idea to re-use the SVH for incremental compilation. It's something with a specific purpose (2) and trying to make it hit two goals at once might just make it more complicated. The other way round though, re-using a well-defined incremental compilation hash when computing the SVH makes more sense to me.
ad endianess: Yes, for incremental compilation it doesn't make a difference. For the other case: I guess you can never have two crates with differing endianess in the your crate graph. So, in the end it should not matter in either case. It's more of code smell than a bug anyway.
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.
On Mon, Apr 04, 2016 at 08:48:39AM -0700, Michael Woerister wrote:
"crate_disambiguator".hash(&mut state);
crate_disambiguator.len().hash(&mut state);
crate_disambiguator.hash(&mut state);
crate_disambiguator.as_str().len().hash(&mut state);
I'm not sure if it's a good idea to re-use the SVH for incremental compilation. It's something with a specific purpose (2) and trying to make it hit two goals at once might just make it more complicated. The other way round though, re-using a well-defined incremental compilation hash when computing the SVH makes more sense to me.
I agree that the SVH as originally envisioned is not what we want --
for one thing, it tries to have some (broken) notion of not hashing
things that do not affect "ABI compatibilty". I think there is no use
for the existing SVH. I am basically taking it over and repurposing
it. I should rename it to "ICH" (incr. comp. hash), probably. But the
current names seems also not inappropriate.
Do you think that it's worth retaining the "SVH as it exists today"?
ad endianess: Yes, for incremental compilation it doesn't make a
difference. For the other case: I guess you can never have two
crates with differing endianess in the your crate graph. So, in the
end it should not matter in either case. It's more of code smell
than a bug anyway.
well, what I was concerned about is that you cross-compile the library
on one machine. then copy it somewhere else. then recompile something
it depends on on that local machine. now if the endianness's differ
rustc may get whiny, even though same toolchain/version/everything was
used, because the SVH recorded in the (cross-compiled) crate is
different from the one that is found in the (locally) compiled dep.
Admittedly this scenario seems a bit far fetched and like something
that can be relegated to a FIXME.
Niko
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.
what I was concerned about is that you cross-compile the library
That's true. I think, I would just fix it with something like: (crate_disambiguator.as_str().len() as u64).to_le().hash(...)
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.
Hmm, ok
On Mon, Apr 04, 2016 at 10:00:47AM -0700, Michael Woerister wrote:
"crate_disambiguator".hash(&mut state);
crate_disambiguator.len().hash(&mut state);
crate_disambiguator.hash(&mut state);
crate_disambiguator.as_str().len().hash(&mut state);
what I was concerned about is that you cross-compile the library
That's true. I think, I would just fix it with something like:
(crate_disambiguator.as_str().len() as u64).to_le().hash(...)
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
https://github.com/rust-lang/rust/pull/32016/files/601f8c66256df0d4d1fe2ec3d3f617a6fae08f68..aa5eca284c2e220cac461a5626a559690f664fe6#r58409485
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.
Although I admit that's one ugly line of code that really asks to be hidden behind some kind of utility function at some point.
7d6e369
to
22b4bb0
Compare
Not sure what was the bug. Fixes rust-lang#32014.
@bors r=michaelwoerister |
📌 Commit 54d78a4 has been approved by |
⌛ Testing commit 54d78a4 with merge fd7614e... |
💔 Test failed - auto-linux-64-opt-rustbuild |
@bors r=mw |
📌 Commit 29ad9a2 has been approved by |
⌛ Testing commit 29ad9a2 with merge 89fbd29... |
💔 Test failed - auto-linux-64-x-freebsd |
@bors r=mw |
📌 Commit 9eaae92 has been approved by |
Save/load incremental compilation dep graph Contains the code to serialize/deserialize the dep graph to disk between executions. We also hash the item contents and compare to the new hashes. Also includes a unit test harness. There are definitely some known limitations, such as #32014 and #32015, but I am leaving those for follow-up work. Note that this PR builds on #32007, so the overlapping commits can be excluded from review. r? @michaelwoerister
The android bot disappeared, but all other tests pass, so I'm gonna merge manually. Praying this actually works for android :) |
Contains the code to serialize/deserialize the dep graph to disk between executions. We also hash the item contents and compare to the new hashes. Also includes a unit test harness. There are definitely some known limitations, such as #32014 and #32015, but I am leaving those for follow-up work.
Note that this PR builds on #32007, so the overlapping commits can be excluded from review.
r? @michaelwoerister