-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
JIT: Factor reachability sets and base them on new DFS #96892
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
|
|
||
} while (changed); | ||
// fgDfsReversePostorder reassigns preorder numbers, so recompute the DFS. | ||
m_dfsTree = fgComputeDfs(); |
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 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.
sets[i] = BitVecOps::MakeSingleton(&postOrderTraits, i); | ||
} | ||
|
||
// Find the reachable blocks. Also, set BBF_GC_SAFE_POINT. |
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.
Oops, outdated comment. Will address in a follow-up.
cc @dotnet/jit-contrib PTAL @BruceForstall Minor diffs. Some TP regressions that we will regain shortly once the old DFS is removed. |
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.
LGTM
- 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`.
BlockReachabilitySets
which encapsulates a data structure that can answer "A -> B" reachability queries inO(1)
. It factors the oldfgComputeReachabilitySets
andfgReachable
.BasicBlock::bbReach
; store the reachability sets withinBlockReachabilitySets
instead. This costs some extra memory in FullOpts if we end up computing it twice, but reduces memory in MinOpts.BBF_GC_SAFE_POINT
during the reachability computation. The cycle-based GC safe point algorithm introduced in JIT: Generalize check for full interruptibility #95299 does not require this propagation.fgComputeReachability
to 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
.