[Mlir-commits] [mlir] [mlir] introduce transform.collect_matching (PR #76724)

Matthias Springer llvmlistbot at llvm.org
Tue Jan 2 07:39:29 PST 2024


================
@@ -459,6 +459,36 @@ def NumAssociationsOp : TransformDialectOp<"num_associations",
   }];
 }
 
+def CollectMatchingOp : TransformDialectOp<"collect_matching", [
+    DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
+    DeclareOpInterfaceMethods<SymbolUserOpInterface>,
+    DeclareOpInterfaceMethods<TransformOpInterface>]> {
+  let summary = "Collects all payload ops that match the given named matcher";
+  let description = [{
+    Collects operations nested under `root` or other payload IR objects that
+    match the given matcher expressed as a named sequence. The matcher sequence
+    must accept exactly one argument that it is not allowed to modify. It must
+    yield as many values as this op has results. Each of the yielded values must
+    be associated with exactly one payload object. If any operation in the
+    matcher sequence produces a silenceable failure, the matcher advances to the
+    next payload operation in the walk order without finishing the sequence.
+
+    The results of this operation are constructed by concatenating values
----------------
matthias-springer wrote:

nit: I would rephrase this along the lines of:

`The i-th result of this operation is constructed by concatenating the i-th yielded payload IR objects of all successful matcher sequence applications. All results are guaranteed to be mapped to the same number of payload IR objects.`


https://github.com/llvm/llvm-project/pull/76724


More information about the Mlir-commits mailing list