Skip to content

Commit

Permalink
[mlir][Linalg] NFC - Add builder for MatchOp
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasvasilache committed Apr 18, 2023
1 parent c9c8527 commit 5fdf4d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ def MatchOp : Op<Transform_Dialect, "structured.match",
let results = (outs TransformHandleTypeInterface:$results);

let builders = [
OpBuilder<(ins "Value":$target, "ArrayRef<StringRef>":$opNames)>
OpBuilder<(ins "Value":$target, "ArrayRef<StringRef>":$opNames)>,
OpBuilder<(ins "TypeRange":$resultTypes, "Value":$target, "ArrayRef<StringRef>":$opNames)>
];

let assemblyFormat = [{
Expand Down
12 changes: 11 additions & 1 deletion mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ transform::DecomposeOp::applyToOne(LinalgOp target,
/// Apply a tiling transformation to all payload ops and store both the
/// tiled operation as well as the created tile loops.
static LogicalResult applyTilingToAll(
RewriterBase &rewriter, Operation *transformOp, ArrayRef<Operation *> payloadOps, unsigned numLoops,
RewriterBase &rewriter, Operation *transformOp,
ArrayRef<Operation *> payloadOps, unsigned numLoops,
transform::TransformResults &transformResults,
function_ref<FailureOr<scf::SCFTileAndFuseResult>(TilingInterface)>
applyFn) {
Expand Down Expand Up @@ -1027,6 +1028,15 @@ void transform::MatchOp::build(OpBuilder &builder, OperationState &result,
result.addTypes(pdl::OperationType::get(builder.getContext()));
}

void transform::MatchOp::build(OpBuilder &builder, OperationState &result,
TypeRange resultTypes, Value target,
ArrayRef<StringRef> opNames) {
result.addOperands(target);
result.addAttribute(MatchOp::getOpsAttrName(result.name),
builder.getStrArrayAttr(opNames));
result.addTypes(resultTypes);
}

DiagnosedSilenceableFailure
transform::MatchOp::apply(transform::TransformResults &results,
transform::TransformState &state) {
Expand Down

0 comments on commit 5fdf4d5

Please sign in to comment.