[Mlir-commits] [mlir] [mlir][vector][test] Split tests from vector-transfer-flatten.mlir (PR #102584)

Andrzej Warzyński llvmlistbot at llvm.org
Fri Aug 9 05:59:36 PDT 2024


================
@@ -538,186 +538,6 @@ func.func @transfer_write_non_contiguous_src(
 
 // -----
 
-///----------------------------------------------------------------------------------------
-/// [Pattern: DropUnitDimFromElementwiseOps]
-///
-/// TODO: Move to a dedicated file - there's no "flattening" in the following tests
-/// TODO: Potential duplication with tests from:
-///   * "vector-dropleadunitdim-transforms.mlir" 
-///   * "vector-transfer-drop-unit-dims-patterns.mlir"
-///----------------------------------------------------------------------------------------
-
-func.func @fold_unit_dim_add_basic(%vec : vector<1x8xi32>) -> vector<1x8xi32> {
-   %res = arith.addi %vec, %vec : vector<1x8xi32>
-   return %res : vector<1x8xi32>
-}
-// CHECK-LABEL:   func.func @fold_unit_dim_add_basic(
-// CHECK-SAME:      %[[VAL_0:.*]]: vector<1x8xi32>) -> vector<1x8xi32> {
-// CHECK:           %[[VAL_1:.*]] = vector.shape_cast %[[VAL_0]] : vector<1x8xi32> to vector<8xi32>
-// CHECK:           %[[VAL_2:.*]] = vector.shape_cast %[[VAL_0]] : vector<1x8xi32> to vector<8xi32>
-// CHECK:           %[[VAL_3:.*]] = arith.addi %[[VAL_1]], %[[VAL_2]] : vector<8xi32>
-// CHECK:           %[[VAL_4:.*]] = vector.shape_cast %[[VAL_3]] : vector<8xi32> to vector<1x8xi32>
-// CHECK:           return %[[VAL_4]] : vector<1x8xi32>
-
-// CHECK-128B-LABEL: func @fold_unit_dim_add_basic(
-//   CHECK-128B-NOT:   memref.collapse_shape
-
-// -----
-
-func.func @fold_unit_dim_add_leading_and_trailing(%vec : vector<1x8x1xi32>) -> vector<1x8x1xi32> {
-   %res = arith.addi %vec, %vec : vector<1x8x1xi32>
-   return %res : vector<1x8x1xi32>
-}
-// CHECK-LABEL:   func.func @fold_unit_dim_add_leading_and_trailing(
-// CHECK-SAME:      %[[VAL_0:.*]]: vector<1x8x1xi32>) -> vector<1x8x1xi32> {
-// CHECK:           %[[VAL_1:.*]] = vector.shape_cast %[[VAL_0]] : vector<1x8x1xi32> to vector<8xi32>
-// CHECK:           %[[VAL_2:.*]] = vector.shape_cast %[[VAL_0]] : vector<1x8x1xi32> to vector<8xi32>
-// CHECK:           %[[VAL_3:.*]] = arith.addi %[[VAL_1]], %[[VAL_2]] : vector<8xi32>
-// CHECK:           %[[VAL_4:.*]] = vector.shape_cast %[[VAL_3]] : vector<8xi32> to vector<1x8x1xi32>
-// CHECK:           return %[[VAL_4]] : vector<1x8x1xi32>
-
-// CHECK-128B-LABEL: func @fold_unit_dim_add_leading_and_trailing(
-//   CHECK-128B-NOT:   memref.collapse_shape
-
-// -----
-
-func.func @fold_unit_dim_add(%vec_0 : vector<8x1xi32>,
-                             %vec_1 : vector<1x8xi32>) -> vector<8xi32> {
-   %sc_vec_0 = vector.shape_cast %vec_0 : vector<8x1xi32> to vector<1x8xi32>
-   %add = arith.addi %sc_vec_0, %vec_1 : vector<1x8xi32>
-   %res = vector.shape_cast %add : vector<1x8xi32> to vector<8xi32>
-   return %res : vector<8xi32>
-}
-
-// CHECK-LABEL:   func.func @fold_unit_dim_add(
-// CHECK-SAME:      %[[VAL_0:.*]]: vector<8x1xi32>,
-// CHECK-SAME:      %[[VAL_1:.*]]: vector<1x8xi32>) -> vector<8xi32> {
-// CHECK:           %[[VAL_2:.*]] = vector.shape_cast %[[VAL_0]] : vector<8x1xi32> to vector<8xi32>
-// CHECK:           %[[VAL_3:.*]] = vector.shape_cast %[[VAL_1]] : vector<1x8xi32> to vector<8xi32>
-// CHECK:           %[[VAL_4:.*]] = arith.addi %[[VAL_2]], %[[VAL_3]] : vector<8xi32>
-// CHECK:           return %[[VAL_4]] : vector<8xi32>
-
-// CHECK-128B-LABEL: func @fold_unit_dim_add(
-//   CHECK-128B-NOT:   memref.collapse_shape
----------------
banach-space wrote:

I don't believe those were meant to be here to begin with 😅 

Looking at the other tests, `CHECK-128B` was added specifically for flattening, which introduces `memref.collapse_shape`.  However, these tests have never tested flattening (that's the reason I am moving them). Specifically,  `//   CHECK-128B-NOT:   memref.collapse_shape` doesn't make much sense here, does it? Unless I am missing sth?

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


More information about the Mlir-commits mailing list