JIT: Factor reachability sets and base them on new DFS#96892
Merged
jakobbotsch merged 1 commit intodotnet:mainfrom Jan 12, 2024
Merged
JIT: Factor reachability sets and base them on new DFS#96892jakobbotsch merged 1 commit intodotnet:mainfrom
jakobbotsch merged 1 commit intodotnet:mainfrom
Conversation
- Introduce `BlockReachabilitySets` which encapsulates a data structure that can answer "A -> B" reachability queries in `O(1)`. It factors the old `fgComputeReachabilitySets` and `fgReachable`. - Base the new reachability sets on the new DFS instead of using the old DFS. Switch to postorder num indexing instead of bbNum based indexing. - Remove `BasicBlock::bbReach`; store the reachability sets within `BlockReachabilitySets` instead. This costs some extra memory in FullOpts if we end up computing it twice, but reduces memory in MinOpts. - We no longer propagate `BBF_GC_SAFE_POINT` during the reachability computation. The cycle-based GC safe point algorithm introduced in dotnet#95299 does not require this propagation. - Switch the dead block elimination in `fgComputeReachability` to use `fgDfsBlocksAndRemove`, which has more general handling of EH and does not require as much iteration to closure - Remove the compuation of "enter blocks". With recent work the reachability computation was the last remaining use. Minor diffs expected due to the more general dead block removal capacity of `fgDfsBlocksAndRemove`.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue Details
Minor diffs expected due to the more general dead block removal capacity of
|
jakobbotsch
commented
Jan 12, 2024
|
|
||
| } while (changed); | ||
| // fgDfsReversePostorder reassigns preorder numbers, so recompute the DFS. | ||
| m_dfsTree = fgComputeDfs(); |
Member
Author
There was a problem hiding this comment.
We gain a new DFS tree computation here, but it should be quite short lived; we'll be able to get rid of it once the old DFS is removed.
jakobbotsch
commented
Jan 12, 2024
| sets[i] = BitVecOps::MakeSingleton(&postOrderTraits, i); | ||
| } | ||
|
|
||
| // Find the reachable blocks. Also, set BBF_GC_SAFE_POINT. |
Member
Author
There was a problem hiding this comment.
Oops, outdated comment. Will address in a follow-up.
21 tasks
Member
Author
|
cc @dotnet/jit-contrib PTAL @BruceForstall Minor diffs. Some TP regressions that we will regain shortly once the old DFS is removed. |
tmds
pushed a commit
to tmds/runtime
that referenced
this pull request
Jan 23, 2024
- Introduce `BlockReachabilitySets` which encapsulates a data structure that can answer "A -> B" reachability queries in `O(1)`. It factors the old `fgComputeReachabilitySets` and `fgReachable`. - Base the new reachability sets on the new DFS instead of using the old DFS. Switch to postorder num indexing instead of bbNum based indexing. - Remove `BasicBlock::bbReach`; store the reachability sets within `BlockReachabilitySets` instead. This costs some extra memory in FullOpts if we end up computing it twice, but reduces memory in MinOpts. - We no longer propagate `BBF_GC_SAFE_POINT` during the reachability computation. The cycle-based GC safe point algorithm introduced in dotnet#95299 does not require this propagation. - Switch the dead block elimination in `fgComputeReachability` to use `fgDfsBlocksAndRemove`, which has more general handling of EH and does not require as much iteration to closure - Remove the compuation of "enter blocks". With recent work the reachability computation was the last remaining use. Minor diffs expected due to the more general dead block removal capacity of `fgDfsBlocksAndRemove`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BlockReachabilitySetswhich encapsulates a data structure that can answer "A -> B" reachability queries inO(1). It factors the oldfgComputeReachabilitySetsandfgReachable.BasicBlock::bbReach; store the reachability sets withinBlockReachabilitySetsinstead. This costs some extra memory in FullOpts if we end up computing it twice, but reduces memory in MinOpts.BBF_GC_SAFE_POINTduring the reachability computation. The cycle-based GC safe point algorithm introduced in JIT: Generalize check for full interruptibility #95299 does not require this propagation.fgComputeReachabilityto usefgDfsBlocksAndRemove, which has more general handling of EH and does not require as much iteration to closureMinor diffs expected due to the more general dead block removal capacity of
fgDfsBlocksAndRemove.