[Mlir-commits] [mlir] [mlir][tensor] Fold unpadding collapse_shape into extract_slice (PR #93554)

Quinn Dawkins llvmlistbot at llvm.org
Thu May 30 16:48:41 PDT 2024


================
@@ -22,6 +22,75 @@ func.func @expand_shape_of_rank_reducing_extract(
 
 // -----
 
+// CHECK-LABEL: func @unpadding_collapse_of_extract_slice(
+//  CHECK-SAME:     %[[t:.*]]: tensor<?x?x?x?xf32>
+//  CHECK-SAME:     %[[x:[a-zA-Z0-9_]+]]: index
+//  CHECK-SAME:     %[[y:[a-zA-Z0-9_]+]]: index
+//       CHECK:   %[[extract:.*]] = tensor.extract_slice %[[t]][%[[x]], %[[y]], 0, 0] [1, %{{.*}}, 1, %{{.*}}] [1, 1, 1, 1] : tensor<?x?x?x?xf32> to tensor<?x?xf32>
----------------
qedawkins wrote:

nit: Can you reduce the line length by splitting this into two lines?
```suggestion
//       CHECK:   %[[extract:.*]] = tensor.extract_slice %[[t]][%[[x]], %[[y]], 0, 0] [1, %{{.*}}, 1, %{{.*}}] [1, 1, 1, 1]
//  CHECK-SAME:     : tensor<?x?x?x?xf32> to tensor<?x?xf32>
```
Same for the two tests below.

https://github.com/llvm/llvm-project/pull/93554


More information about the Mlir-commits mailing list