[Mlir-commits] [mlir] [mlir][vector] Improve flattening vector.transfer_write ops. (PR #94051)

Han-Chung Wang llvmlistbot at llvm.org
Mon Jun 3 22:01:52 PDT 2024


================
@@ -471,25 +471,27 @@ func.func @regression_non_contiguous_dim_read(%subview : memref<1x3x3x2xf32, str
 }
 
 //       CHECK:  #[[$MAP:.+]] = affine_map<()[s0] -> (s0 * 2)>
-// CHECK-LABEL:    func.func @regression_non_contiguous_dim_read(
-//       CHECK:      %[[COLLAPSE:.+]] = memref.collapse_shape %{{.*}} {{\[}}[0], [1], [2, 3]] : memref<1x3x3x2xf32, strided<[40, 10, 2, 1], offset: ?>> into memref<1x3x6xf32, strided<[40, 10, 1], offset: ?>>
-//       CHECK:     %[[APPLY:.*]] = affine.apply #[[$MAP]]()
+// CHECK-LABEL:  func.func @regression_non_contiguous_dim_read(
+//       CHECK:    %[[COLLAPSE:.+]] = memref.collapse_shape %{{.*}} {{\[}}[0], [1], [2, 3]] : memref<1x3x3x2xf32, strided<[40, 10, 2, 1], offset: ?>> into memref<1x3x6xf32, strided<[40, 10, 1], offset: ?>>
+//       CHECK:    %[[APPLY:.*]] = affine.apply #[[$MAP]]()
 
 // CHECK-128B-LABEL: func @regression_non_contiguous_dim_read(
 //       CHECK-128B:   memref.collapse_shape
 
 // -----
 
-func.func @unsupported_non_contiguous_dim_write(%value : vector<2x2xf32>,
+func.func @regression_non_contiguous_dim_write(%value : vector<2x2xf32>,
----------------
hanhanW wrote:

> Is any other testcase left testing remaining cases that more fundamentally can't be collapsed?

There are many cases are covered by `CHECK-128B`. E.g., there is a `CHECK-128B:   memref.collapse_shape` in this and other testcases. Fundamentally, we can not collapse three inner dimensions because the strides is `[x, 10, 2, 1]` but not `[x, 6, 2, 1]`. I.e., it is not contiguous. Do you want me to add a test that can't be collapsed for every dimension?

> Also, is any testcase testing in_bounds = false and specifically any edge case where the ability to collapse depends on in_bounds ?

There are no negative tests for the case. I can add one to iterate it.

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


More information about the Mlir-commits mailing list