summaryrefslogtreecommitdiff
path: root/mlir/python
diff options
context:
space:
mode:
authorMatthias Springer <springerm@google.com>2022-08-15 13:02:17 +0200
committerMatthias Springer <springerm@google.com>2022-08-15 14:41:28 +0200
commit4911100dc6c29271a54a147ca27fb9ba5522299f (patch)
tree96a25c30a875897cb1097b0c79ec150ec84f6db2 /mlir/python
parenta31e2859a8229af3574ab2e931624b7c15551fb8 (diff)
[mlir][linalg][python] Add named constructor for MatchOp
This constructor makes it easier to match for ops by their name. Differential Revision: https://reviews.llvm.org/D131882
Diffstat (limited to 'mlir/python')
-rw-r--r--mlir/python/mlir/dialects/_structured_transform_ops_ext.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/mlir/python/mlir/dialects/_structured_transform_ops_ext.py b/mlir/python/mlir/dialects/_structured_transform_ops_ext.py
index 95bf2cc99295..faf98ef49c30 100644
--- a/mlir/python/mlir/dialects/_structured_transform_ops_ext.py
+++ b/mlir/python/mlir/dialects/_structured_transform_ops_ext.py
@@ -110,6 +110,24 @@ class InterchangeOp:
ip=ip)
+class MatchOp:
+ """Specialization for MatchOp class."""
+
+ @classmethod
+ def match_op_names(MatchOp,
+ target: Union[Operation, Value],
+ names: Sequence[str],
+ loc=None,
+ ip=None):
+ pdl_operation_type = pdl.OperationType.get()
+ return MatchOp(
+ pdl_operation_type,
+ _get_op_result_or_value(target),
+ ops=ArrayAttr.get(list(map(lambda s: StringAttr.get(s), names))),
+ loc=loc,
+ ip=ip)
+
+
class MultiTileSizesOp:
"""Specialization for MultitileSizesOp class."""