Uh oh!
There was an error while loading. Please reload this page.
Use more fine grained locks for the dep graph - #63756
Conversation
There was a problem hiding this comment.
@michaelwoerister I'm guessing you're the person to ask about this.
There was a problem hiding this comment.
At some point we had debug output for incremental compilation that was using this. If it is really unused now, you can remove it.
rust-highfive
commented
Aug 20, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
michaelwoerister
left a comment
There was a problem hiding this comment.
Thanks for the PR, @Zoxc!
The changes look correct to me. Do we have evidence that they improve performance?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Zoxc
commented
Aug 25, 2019
This PR probably doesn't help. It's just a prerequisite for other stuff which does improve performance. |
JohnCSimon
commented
Sep 7, 2019
Ping from triage: |
michaelwoerister
commented
Sep 9, 2019
JohnCSimon
commented
Sep 14, 2019
Ping from triage Thanks. |
JohnTitor
commented
Sep 22, 2019
Ping from triage: @aturon could you review this PR? |
joelpalmer
commented
Sep 30, 2019
Ping from Triage: Pinging @aturon one more time. |
nikomatsakis
commented
Oct 3, 2019
@aturon is stepping back from this role, we should reassign all PRs assigned to them. |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Looks good overall. I have one nit, which is a request to document the overall pattern on CurrentDepGraph.
In general, we discussed this PR a bit in our "parallel sync meeting" today and the general conclusion was that -- in the future -- it might be nice to extract the CurrentDepGraph code into its own module, so that it can have a smaller "abstraction boundary", but since this is part of a larger series of PRs it doesn't make sense to do it now.
We also mentioned using SeqCst everywhere unless there's a strong reason to do otherwise (which doesn't seem to apply here, but @Mark-Simulacrum already noted that here).
There was a problem hiding this comment.
The comment below is great -- but it'd be good to document just a bit more (this is pre-existing, as the code wasn't all that thoroughlly commented before =)
I'd say something like:
Encodes the rustc dependency graph. The nodes are identified by an index (DepNodeIndex); the data for each node is stored in its DepNodeData, found in the data field.
We never remove nodes from the graph: they are only added. Most of the time, the node is mapped 1-to-1 with some DepNode, which basically identifies a query. When such nodes are allocated, we add the DepNod into the node_to_node_index map and allocate a fresh node index.
This struct uses two locks internally: the data and node_to_node_index field are locked separately. Operations that begin with a DepNodeIndex typically just access the data field.
The only operation that must manipulate both fields is adding new nodes, in which case we first acquire the node_to_node_index lock and then, once a new node is to be inserted, acquire the lock on data.
(We also have a field fields that use atomics: these are simple counters that are used for profiling and debugging and are not used with debug_assertions.)
There was a problem hiding this comment.
I added that, but removed the incorrect parts =P
nikomatsakis
commented
Oct 7, 2019
r=me with comment + SeqCst nits applied =) |
bors
commented
Oct 8, 2019
☔ The latest upstream changes (presumably #65209) made this pull request unmergeable. Please resolve the merge conflicts. |
9ee2119 to
89c6415Compare89c6415 to
b6a5740CompareZoxc
commented
Oct 16, 2019
@bors r=nikomatsakis |
bors
commented
Oct 16, 2019
📌 Commit b6a5740 has been approved by |
bors
commented
Oct 16, 2019
Use more fine grained locks for the dep graph Split out from #61845. r? @michaelwoerister cc @aturon
bors
commented
Oct 17, 2019
☀️ Test successful - checks-azure |
…sakis Use a sharded dep node to dep node index map Split out from rust-lang#61845 and based on rust-lang#63756. r? @nikomatsakis
…sakis Use a sharded dep node to dep node index map Split out from rust-lang#61845 and based on rust-lang#63756. r? @nikomatsakis
…sakis Use a sharded dep node to dep node index map Split out from rust-lang#61845 and based on rust-lang#63756. r? @nikomatsakis
…sakis Use a sharded dep node to dep node index map Split out from rust-lang#61845 and based on rust-lang#63756. r? @nikomatsakis
Split out from #61845.
r? @michaelwoerister cc @aturon