[Mlir-commits] [mlir] [MLIR][Transform] FuseOp: accept transform params, add use_forall argument (PR #161883)
    llvmlistbot at llvm.org 
    llvmlistbot at llvm.org
       
    Fri Oct  3 10:19:01 PDT 2025
    
    
  
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r origin/main...HEAD mlir/python/mlir/dialects/transform/structured.py mlir/test/python/dialects/transform_structured_ext.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- python/mlir/dialects/transform/structured.py	2025-10-03 17:03:21.000000 +0000
+++ python/mlir/dialects/transform/structured.py	2025-10-03 17:18:37.366092 +0000
@@ -189,11 +189,13 @@
         (
             dynamic_tile_interchange,
             static_tile_interchange,
             _,
         ) = _dispatch_dynamic_index_list(tile_interchange)
-        num_loops = 1 if use_forall else sum(0 if v == 0 else 1 for v in static_tile_sizes)
+        num_loops = (
+            1 if use_forall else sum(0 if v == 0 else 1 for v in static_tile_sizes)
+        )
 
         if isinstance(loop_types_or_target, (Operation, Value, OpView)):
             loop_types = [transform.AnyOpType.get()] * num_loops
             target = loop_types_or_target
             assert target_or_none is None, "Cannot construct FuseOp with two targets."
--- test/python/dialects/transform_structured_ext.py	2025-10-03 17:03:21.000000 +0000
+++ test/python/dialects/transform_structured_ext.py	2025-10-03 17:18:37.589071 +0000
@@ -116,11 +116,14 @@
 
 @run
 @create_sequence
 def testFuseOpCompactForall(target):
     structured.FuseOp(
-        target, tile_sizes=[4, 8], apply_cleanup=True, use_forall=True,
+        target,
+        tile_sizes=[4, 8],
+        apply_cleanup=True,
+        use_forall=True,
     )
     # CHECK-LABEL: TEST: testFuseOpCompact
     # CHECK: transform.sequence
     # CHECK: %{{.+}}, %{{.+}} = transform.structured.fuse %{{.*}} tile_sizes [4, 8]
     # CHECK-SAME: apply_cleanup = true use_forall = true
@@ -141,11 +144,11 @@
 @create_sequence
 def testFuseOpParams(target):
     structured.FuseOp(
         target,
         tile_sizes=[constant_param(4), Attribute.parse("8")],
-        tile_interchange=[constant_param(0), Attribute.parse("1")]
+        tile_interchange=[constant_param(0), Attribute.parse("1")],
     )
     # CHECK-LABEL: TEST: testFuseOpParams
     # CHECK: transform.sequence
     # CHECK-DAG: %[[P:.*]] = transform.param.constant 4
     # CHECK-DAG: %[[I:.*]] = transform.param.constant 0
``````````
</details>
https://github.com/llvm/llvm-project/pull/161883
    
    
More information about the Mlir-commits
mailing list