Skip to content

[MLIR][SliceAnalysis] Add comment and restore failure condition #142223

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mlir/include/mlir/Analysis/SliceAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ void getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
///
/// This function returns whether the backwards slice was able to be
/// successfully computed, and failure if it was unable to determine the slice.
/// This function will presently return failure if a value to process is a blockargument
/// whose parent op has more than one region, or a region with more than one block.
LogicalResult getBackwardSlice(Operation *op,
SetVector<Operation *> *backwardSlice,
const BackwardSliceOptions &options = {});
Expand Down
2 changes: 2 additions & 0 deletions mlir/lib/Analysis/SliceAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ static LogicalResult getBackwardSliceImpl(Operation *op,
if (parentOp->getNumRegions() == 1 &&
llvm::hasSingleElement(parentOp->getRegion(0).getBlocks())) {
return getBackwardSliceImpl(parentOp, backwardSlice, options);
} else {
return failure();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be tested?

Copy link
Member

Choose a reason for hiding this comment

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

+1, I was missing one too in the original. Thanks for updating the comment.

So this just fails due to missing support in getBackwardSlice? E.g., its difficult to determine that to slice and semantics of ops in this case and so just bail. An alternative would have been to have the filter function capture this (fail to propagate post out into such ops and record the need/failure, and handle post - less efficient than this early exit but there are just a lot of ignoring of this return now).

}
}
} else {
Expand Down
Loading