aboutsummaryrefslogtreecommitdiff
path: root/mlir/python
diff options
context:
space:
mode:
authorAlex Zinenko <zinenko@google.com>2022-07-07 13:11:34 +0200
committerAlex Zinenko <zinenko@google.com>2022-07-07 13:19:46 +0200
commit8e03bfc368f72a4f97129b0837396e69ae2ba1fe (patch)
treef34549529fed473030951e1763eb6d921e75bab2 /mlir/python
parentff6e5508d686395dfb5f26085fadeae174847d52 (diff)
downloadllvm-8e03bfc368f72a4f97129b0837396e69ae2ba1fe.zip
llvm-8e03bfc368f72a4f97129b0837396e69ae2ba1fe.tar.gz
llvm-8e03bfc368f72a4f97129b0837396e69ae2ba1fe.tar.bz2
[mlir] Transform dialect: introduce merge_handles op
This Transform dialect op allows one to merge the lists of Payload IR operations pointed to by several handles into a single list associated with one handle. This is an important Transform dialect usability improvement for cases where transformations may temporarily diverge for different groups of Payload IR ops before converging back to the same script. Without this op, several copies of the trailing transformations would have to be present in the transformation script. Depends On D129090 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D129110
Diffstat (limited to 'mlir/python')
-rw-r--r--mlir/python/mlir/dialects/_transform_ops_ext.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/mlir/python/mlir/dialects/_transform_ops_ext.py b/mlir/python/mlir/dialects/_transform_ops_ext.py
index 138195d..ca45ab7 100644
--- a/mlir/python/mlir/dialects/_transform_ops_ext.py
+++ b/mlir/python/mlir/dialects/_transform_ops_ext.py
@@ -28,6 +28,21 @@ class GetClosestIsolatedParentOp:
ip=ip)
+class MergeHandlesOp:
+
+ def __init__(self,
+ handles: Sequence[Union[Operation, Value]],
+ *,
+ deduplicate: bool = False,
+ loc=None,
+ ip=None):
+ super().__init__(
+ pdl.OperationType.get(), [_get_op_result_or_value(h) for h in handles],
+ deduplicate=deduplicate,
+ loc=loc,
+ ip=ip)
+
+
class PDLMatchOp:
def __init__(self,