-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
incr. comp.: Clarify story around MIR dependency tracking #34765
Comments
Yeah, this seems bad. I've also been thinking a bit about how to go about saving/restoring MIR -- as the The most straight-forward thing would be to model the MIR passes the way we model everything else:
This seems like the most straightforward thing to do. But I think it's probably more data than we need. I think we could collapse all the passes into one with no loss of fidelity. For that matter, we could probably just remove the dep-node for the pass and just use a single dep-node ( Generalizing somewhat, if the purpose of a pass is just to produce a single particular data-structure, then distinguishing But if we have a single pass that may generate a lot of data-structures, I think it makes more sense, particularly if those data structures can be changed from other places (otherwise, you can lose precision in the graph). |
Is there any case you foresee where it would make sense to have more than one DepNode? As long as each pass just produces a transformed version of a function's MIR, the simple approach should be fine, I think. |
Per the discussion on rust-lang#34765, we make one `DepNode::Mir` variant and use it to represent both the MIR tracking map as well as passes that operate on MIR. We also track loads of cached MIR (which naturally comes from metadata). Note that the "HAIR" pass adds a read of TypeckItemBody because it uses a myriad of tables that are not individually tracked.
This was fixed by #35166. |
At the moment, dependency tracking around MIR related things is not implemented completely. In particular:
MirMapConstruction
,MirPass
,MirTypeck
) but we don't seem to register any reads to these nodes later on: TheMirMap
allows for accessing MIR with the dependency tracking system knowing about it.MirTypeck
is its own kind of dependency node while all other passes use theMirPass
node.MirMapConstruction
more or less tracks dependencies of constructing MIR before any transformations are done on it. Reusing it for registering reads to the final MIR would be possible, but would lead to a strange tangle of circular dependencies betweenMirMapConstruction
,MirTypeck
, andMirPass
nodes. It would not be wrong but it would be messy.I suggest that we either just have one kind of
MIR
dependency node that subsumes MIR construction and all transformations on it, or that we have a more accurate representation of dependencies where each kind of MIR pass has its own kind of dependency node and then there is aFinalMir
node, that represents the MIR in its final state.The text was updated successfully, but these errors were encountered: