[Support] Add parallel instance graph visitors#10353
Draft
seldridge wants to merge 4 commits into
Draft
Conversation
Add parallel versions of post/inverse post order walkers that exist for the InstanceGraph. This is added to hopefully extract more parallelism from existing passes that need to visit "parents before children" or "children before parents", but can visit all parents or all children in parallel, respectively. Assisted-by: pi.dev:claude-sonnet-4-6 Assisted-by: pi.dev:claude-opus-4-7 Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
c2643ca to
47f18a3
Compare
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Contributor
uenoku
reviewed
Apr 29, 2026
| /// been visited (and their callbacks completed) before the node itself is | ||
| /// visited, but sibling nodes may be visited concurrently. | ||
| /// | ||
| /// **Thread safety:** The callback `fn` must be safe to invoke from |
Member
There was a problem hiding this comment.
Please avoid duplication or emphasize the difference if any
uenoku
reviewed
Apr 29, 2026
| /// Defined out-of-line in InstanceGraph.cpp to keep the header free of | ||
| /// <atomic>, ThreadPool, and Threading includes. | ||
| LogicalResult | ||
| walkParallelImpl(llvm::function_ref<LogicalResult(InstanceGraphNode &)> fn, |
Member
There was a problem hiding this comment.
Maybe decorate constant to ensure mutation requirement with type if that works?
Suggested change
| walkParallelImpl(llvm::function_ref<LogicalResult(InstanceGraphNode &)> fn, | |
| walkParallelImpl(llvm::function_ref<LogicalResult(const InstanceGraphNode &)> fn, |
Contributor
|
This looks really cool! Nice use of the task group API and having a task spawn additional tasks into the group 💯 |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add parallel versions of post/inverse post order walkers that exist for
the InstanceGraph. This is added to hopefully extract more parallelism
from existing passes that need to visit "parents before children" or
"children before parents", but can visit all parents or all children in
parallel, respectively.
Assisted-by: pi.dev:claude-sonnet-4-6
Assisted-by: pi.dev:claude-opus-4-7
Warning: this is presently marginally-reviewed LLM output. Once I have sufficiently reviewed this I will mark this as non-draft.