Skip to content

[mlir][transform][lingalg][python] Replace pdl.operation => transform.any_op. #66392

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

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

ingomueller-net
Copy link
Contributor

For some reason, the mix-ins of the Python bindings of this dialect used the PDL type for "any op". However, PDL isn't involved here, so it makes more sense to use the corresponding type of the transform dialect. This PR changes that.

….any_op.

For some reason, the mix-ins of the Python bindings of this dialect used
the PDL type for "any op". However, PDL isn't involved here, so it makes
more sense to use the corresponding type of the transform dialect. This
PR changes that.
@llvmbot llvmbot added mlir:python MLIR Python bindings mlir labels Sep 14, 2023
Copy link
Member

@ftynse ftynse left a comment

Choose a reason for hiding this comment

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

Legacy is the reason :)

@llvmbot
Copy link
Member

llvmbot commented Sep 14, 2023

@llvm/pr-subscribers-mlir

Changes For some reason, the mix-ins of the Python bindings of this dialect used the PDL type for "any op". However, PDL isn't involved here, so it makes more sense to use the corresponding type of the transform dialect. This PR changes that. -- Full diff: https://github.com//pull/66392.diff

1 Files Affected:

  • (modified) mlir/python/mlir/dialects/_structured_transform_ops_ext.py (+15-13)
diff --git a/mlir/python/mlir/dialects/_structured_transform_ops_ext.py b/mlir/python/mlir/dialects/_structured_transform_ops_ext.py
index 212fbc5badcbce8..c5134b6e718f3b8 100644
--- a/mlir/python/mlir/dialects/_structured_transform_ops_ext.py
+++ b/mlir/python/mlir/dialects/_structured_transform_ops_ext.py
@@ -4,7 +4,7 @@
 
 try:
     from ..ir import *
-    from ..dialects import pdl, transform
+    from ..dialects import transform
 except ImportError as e:
     raise RuntimeError("Error loading imports from extension module") from e
 
@@ -203,7 +203,8 @@ class DecomposeOp:
     """Specialization for DecomposeOp class."""
 
     def __init__(self, target: Union[Operation, Value], *, loc=None, ip=None):
-        super().__init__(pdl.OperationType.get(), target, loc=loc, ip=ip)
+        transformed_type = transform.AnyOpType.get()
+        super().__init__(transformed_type, target, loc=loc, ip=ip)
 
 
 class FuseIntoContainingOp:
@@ -274,7 +275,8 @@ class GeneralizeOp:
     """Specialization for GeneralizeOp class."""
 
     def __init__(self, target: Union[Operation, Value], *, loc=None, ip=None):
-        super().__init__(pdl.OperationType.get(), target, loc=loc, ip=ip)
+        transformed_type = transform.AnyOpType.get()
+        super().__init__(transformed_type, target, loc=loc, ip=ip)
 
 
 class InterchangeOp:
@@ -288,9 +290,9 @@ def __init__(
         loc=None,
         ip=None,
     ):
-        pdl_operation_type = pdl.OperationType.get()
+        transformed_type = transform.AnyOpType.get()
         super().__init__(
-            pdl_operation_type,
+            transformed_type,
             target,
             iterator_interchange=iterator_interchange,
             loc=loc,
@@ -503,11 +505,11 @@ def __init__(
     ):
         transpose_paddings = _get_int_array_array_attr(transpose_paddings)
 
-        pdl_operation_type = pdl.OperationType.get()
+        any_op_type = transform.AnyOpType.get()
         super().__init__(
-            pdl_operation_type,
-            pdl_operation_type,
-            pdl_operation_type,
+            any_op_type,
+            any_op_type,
+            any_op_type,
             target,
             padding_values=padding_values,
             padding_dimensions=padding_dimensions,
@@ -524,8 +526,8 @@ class ScalarizeOp:
     """Specialization for ScalarizeOp class."""
 
     def __init__(self, target: Union[Operation, Value], *, loc=None, ip=None):
-        pdl_operation_type = pdl.OperationType.get()
-        super().__init__(pdl_operation_type, target, loc=loc, ip=ip)
+        result_type = transform.AnyOpType.get()
+        super().__init__(result_type, target, loc=loc, ip=ip)
 
 
 class SplitOp:
@@ -736,9 +738,9 @@ def __init__(
         loc=None,
         ip=None,
     ):
-        pdl_operation_type = pdl.OperationType.get()
+        transformed_type = transform.AnyOpType.get()
         super().__init__(
-            pdl_operation_type,
+            transformed_type,
             target,
             disable_multi_reduction_to_contract_patterns=disable_multi_reduction_to_contract_patterns,
             disable_transfer_permutation_map_lowering_patterns=disable_transfer_permutation_map_lowering_patterns,

@ingomueller-net
Copy link
Contributor Author

This came up in #65726.

BTW: How about the pdl.OperationType.get() occurrences in the unit tests (e.g., here)?

@ftynse
Copy link
Member

ftynse commented Sep 14, 2023 via email

@ingomueller-net ingomueller-net merged commit 5d3489e into llvm:main Sep 15, 2023
@ingomueller-net ingomueller-net deleted the transform-structured-pdl branch September 15, 2023 07:06
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
….any_op. (llvm#66392)

For some reason, the mix-ins of the Python bindings of this dialect used
the PDL type for "any op". However, PDL isn't involved here, so it makes
more sense to use the corresponding type of the transform dialect. This
PR changes that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:python MLIR Python bindings mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants