Skip to content
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

Stream the dep-graph to a file instead of storing it in-memory. #82780

Merged
merged 11 commits into from
Apr 1, 2021

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Mar 4, 2021

This is a reimplementation of #60035.

Instead of storing the dep-graph in-memory, the nodes are encoded as they come
into the a temporary file as they come. At the end of a successful the compilation,
this file is renamed to be the persistent dep-graph, to be decoded during the next
compilation session.

This two-files scheme avoids overwriting the dep-graph on unsuccessful or crashing compilations.

The structure of the file is modified to be the sequence of (DepNode, Fingerprint, EdgesVec).
The deserialization is responsible for going to the more compressed representation.
The node_count and edge_count are stored in the last 16 bytes of the file,
in order to accurately reserve capacity for the vectors.

At the end of the compilation, the encoder is flushed and dropped.
The graph is not usable after this point: any creation of a node will ICE.

I had to retrofit the debugging options, which is not really pretty.

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 4, 2021
@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor Author

cjgillot commented Mar 4, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 4, 2021
@bors
Copy link
Contributor

bors commented Mar 4, 2021

⌛ Trying commit 987aaf8c8ecff5fc3f2d6d4cbc04de6d6803886a with merge 1dcaa7f88c16bc44af2b3dc563a4dd2d5b391823...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Mar 4, 2021

☀️ Try build successful - checks-actions
Build commit: 1dcaa7f88c16bc44af2b3dc563a4dd2d5b391823 (1dcaa7f88c16bc44af2b3dc563a4dd2d5b391823)

@rust-timer
Copy link
Collaborator

Queued 1dcaa7f88c16bc44af2b3dc563a4dd2d5b391823 with parent 4099208, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (1dcaa7f88c16bc44af2b3dc563a4dd2d5b391823): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 5, 2021
@cjgillot
Copy link
Contributor Author

cjgillot commented Mar 5, 2021

Perf: large reduction in max-rss for incr-comp, but really slow.

@cjgillot
Copy link
Contributor Author

cjgillot commented Mar 5, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 5, 2021
@bors
Copy link
Contributor

bors commented Mar 5, 2021

⌛ Trying commit 9a2749d6b7dd0d34a20be6a168b77e6cc7dc841f with merge 1ca30158cd250a1d4cd67eea2a8784709fcea9a6...

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Mar 5, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 5, 2021
@cjgillot
Copy link
Contributor Author

cjgillot commented Mar 5, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@bors
Copy link
Contributor

bors commented Mar 5, 2021

⌛ Trying commit 9a2749d6b7dd0d34a20be6a168b77e6cc7dc841f with merge 18ab57771eb73a559bbd9496c7ac99ad573ef776...

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 31, 2021
@michaelwoerister
Copy link
Member

Looks like something went wrong when updating the error checking code.

It may also be useful in these cases,
and some CI configurations test without debug assertions.
@michaelwoerister
Copy link
Member

OK, I assume that won't really hurt performance.

@bors r+

@bors
Copy link
Contributor

bors commented Apr 1, 2021

📌 Commit f3dde45 has been approved by michaelwoerister

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 1, 2021
@bors
Copy link
Contributor

bors commented Apr 1, 2021

⌛ Testing commit f3dde45 with merge 87ae22ab35bdf856af25cbc0c93da922a7c0708c...

@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Contributor

bors commented Apr 1, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 1, 2021
@cjgillot
Copy link
Contributor Author

cjgillot commented Apr 1, 2021

Seems spurious.
@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 1, 2021
@bors
Copy link
Contributor

bors commented Apr 1, 2021

⌛ Testing commit f3dde45 with merge d474075...

@bors
Copy link
Contributor

bors commented Apr 1, 2021

☀️ Test successful - checks-actions
Approved by: michaelwoerister
Pushing d474075 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 1, 2021
@bors bors merged commit d474075 into rust-lang:master Apr 1, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 1, 2021
@cjgillot cjgillot deleted the dep-stream branch April 1, 2021 19:43
@Mark-Simulacrum
Copy link
Member

@michaelwoerister
Copy link
Member

I'm curious where the syn-opt regression comes from. Everything else looks good to me.

@michaelwoerister
Copy link
Member

True, but that's to be expected since we take a measurement per dep-node now instead of measuring a single bulk-serialization at the end. Other benchmarks show the same change but don't seem to regress.

@mati865
Copy link
Contributor

mati865 commented Apr 6, 2021

Sorry, I've deleted my comment when I realized that.
monomorphization_collector_graph_walk regressed slightly but not that much to explain the difference.

@michaelwoerister
Copy link
Member

Sorry, I've deleted my comment when I realized that.

No worries :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.