[Mlir-commits] [mlir] 3327832 - [mlir][linalg][transform][python] Make divisor arg to Multitile optional

Ingo Müller llvmlistbot at llvm.org
Mon Sep 4 04:33:00 PDT 2023


Author: Ingo Müller
Date: 2023-09-04T11:32:56Z
New Revision: 33278321e6ca5973ff96f14e67e1898046623f81

URL: https://github.com/llvm/llvm-project/commit/33278321e6ca5973ff96f14e67e1898046623f81
DIFF: https://github.com/llvm/llvm-project/commit/33278321e6ca5973ff96f14e67e1898046623f81.diff

LOG: [mlir][linalg][transform][python] Make divisor arg to Multitile optional

The mix-in of the `MultiTileSizesOp` set the default value of its
`divisor` argument. This repeats information from the tablegen
defintion, is not necessary (since the generic code deals with `None`
and default values), and has the risk of running out of sync without
people noticing. This patch removes the setting of the value and forward
`None` to the generic constructor instead.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D159416

Added: 
    

Modified: 
    mlir/python/mlir/dialects/_structured_transform_ops_ext.py
    mlir/test/python/dialects/transform_structured_ext.py

Removed: 
    


################################################################################
diff  --git a/mlir/python/mlir/dialects/_structured_transform_ops_ext.py b/mlir/python/mlir/dialects/_structured_transform_ops_ext.py
index 44d9c1406fd89a..f368e56f981891 100644
--- a/mlir/python/mlir/dialects/_structured_transform_ops_ext.py
+++ b/mlir/python/mlir/dialects/_structured_transform_ops_ext.py
@@ -462,7 +462,7 @@ def match_op_names(
 
 
 class MultiTileSizesOp:
-    """Specialization for MultitileSizesOp class."""
+    """Specialization for MultiTileSizesOp class."""
 
     def __init__(
         self,
@@ -475,8 +475,6 @@ def __init__(
         loc=None,
         ip=None,
     ):
-        if divisor is None:
-            divisor = 1
         super().__init__(
             result_type,
             result_type,

diff  --git a/mlir/test/python/dialects/transform_structured_ext.py b/mlir/test/python/dialects/transform_structured_ext.py
index 66e459917163c1..465e01d8b658f5 100644
--- a/mlir/test/python/dialects/transform_structured_ext.py
+++ b/mlir/test/python/dialects/transform_structured_ext.py
@@ -297,7 +297,7 @@ def testMatchOpNamesTyped():
 
 
 @run
-def testMultitileSizes():
+def testMultitileSizesCompact():
     sequence = transform.SequenceOp(
         transform.FailurePropagationMode.Propagate, [], pdl.OperationType.get()
     )
@@ -308,8 +308,34 @@ def testMultitileSizes():
         transform.YieldOp()
     # CHECK-LABEL: TEST: testMultitileSizes
     # CHECK: transform.sequence
+    # CHECK-NOT: divisor
     # CHECK: transform.structured.multitile_sizes
+    # CHECK-NOT: divisor
     # CHECK-DAG: dimension = 1
+    # CHECK-NOT: divisor
+    # CHECK-DAG: target_size = 42
+    # CHECK-NOT: divisor
+
+
+ at run
+def testMultitileSizesAllArgs():
+    sequence = transform.SequenceOp(
+        transform.FailurePropagationMode.Propagate, [], pdl.OperationType.get()
+    )
+    with InsertionPoint(sequence.body):
+        structured.MultiTileSizesOp(
+            pdl.OperationType.get(),
+            sequence.bodyTarget,
+            dimension=1,
+            target_size=42,
+            divisor=2,
+        )
+        transform.YieldOp()
+    # CHECK-LABEL: TEST: testMultitileSizes
+    # CHECK: transform.sequence
+    # CHECK: transform.structured.multitile_sizes
+    # CHECK-DAG: dimension = 1
+    # CHECK-DAG: divisor = 2
     # CHECK-DAG: target_size = 42
 
 


        


More information about the Mlir-commits mailing list