[Mlir-commits] [mlir] feat(linalg): add a way to pass controlFn to `foldIntoPackUnpackPatterns` (PR #143685)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jun 30 07:27:27 PDT 2025
================
@@ -550,6 +596,55 @@ func.func @linalg_transpose_linalg.unpack_fold(%arg0: tensor<1x1x4x16xi32>) -> t
// -----
+func.func @linalg_transpose_linalg.unpack_fold_multi_result(%arg0: tensor<1x1x4x16xi32>) -> (tensor<1x1x16x4xi32>, tensor<16x4xi32>) {
+ %0 = tensor.empty() : tensor<1x1x16x4xi32>
+ %transposed = linalg.transpose ins(%arg0 : tensor<1x1x4x16xi32>)
+ outs(%0 : tensor<1x1x16x4xi32>)
+ permutation = [1, 0, 3, 2]
+ %1 = tensor.empty() : tensor<16x4xi32>
+ %unpack = linalg.unpack %transposed
+ outer_dims_perm = [0, 1]
+ inner_dims_pos = [0, 1]
+ inner_tiles = [16, 4] into
+ %1 : tensor<1x1x16x4xi32> -> tensor<16x4xi32>
+ return %transposed, %unpack : tensor<1x1x16x4xi32>, tensor<16x4xi32>
+}
+//CHECK-LABEL: func.func @linalg_transpose_linalg.unpack_fold_multi_result(
----------------
Max191 wrote:
These tests can be less verbose in the checks. The main thing this is testing is whether or not the fusion happened with mutli-result, so you don't need to check all the shapes/op metadata. You could just check the operands and results of the operations to verify the producers/consumers.
https://github.com/llvm/llvm-project/pull/143685
More information about the Mlir-commits
mailing list