Skip to content

[mlir][PDL] PDLToPDLInterp: Use the pdl pattern name in the generated rewriter. #149481

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
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
7 changes: 6 additions & 1 deletion mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,13 @@ void PatternLowering::generate(SuccessNode *successNode, Block *&currentBlock) {
SymbolRefAttr PatternLowering::generateRewriter(
pdl::PatternOp pattern, SmallVectorImpl<Position *> &usedMatchValues) {
builder.setInsertionPointToEnd(rewriterModule.getBody());
// Get the pattern name if available, otherwise use default
StringRef rewriterName = "pdl_generated_rewriter";
if (auto symName = pattern.getSymName()) {
rewriterName = symName.value();
}
Comment on lines +644 to +646
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (auto symName = pattern.getSymName()) {
rewriterName = symName.value();
}
if (auto symName = pattern.getSymName())
rewriterName = symName.value();

auto rewriterFunc = pdl_interp::FuncOp::create(
builder, pattern.getLoc(), "pdl_generated_rewriter",
builder, pattern.getLoc(), rewriterName,
builder.getFunctionType({}, {}));
rewriterSymbolTable.insert(rewriterFunc);

Expand Down
Loading