Skip to content

Conversation

@jakobbotsch
Copy link
Member

  • 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 JIT: Generalize check for full interruptibility #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.

- 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`.
@ghost ghost assigned jakobbotsch Jan 12, 2024
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 12, 2024
@ghost
Copy link

ghost commented Jan 12, 2024

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details
  • 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 JIT: Generalize check for full interruptibility #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.

Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -


} while (changed);
// fgDfsReversePostorder reassigns preorder numbers, so recompute the DFS.
m_dfsTree = fgComputeDfs();
Copy link
Member Author

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.
Copy link
Member Author

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.

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @BruceForstall

Minor diffs. Some TP regressions that we will regain shortly once the old DFS is removed.

Copy link
Contributor

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jakobbotsch jakobbotsch merged commit 9fde15e into dotnet:main Jan 12, 2024
@jakobbotsch jakobbotsch deleted the reachability-sets branch January 12, 2024 19:36
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`.
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants