[Mlir-commits] [mlir] [MLIR] Determine contiguousness of memrefs with dynamic dimensions (PR #142421)
Momchil Velikov
llvmlistbot at llvm.org
Wed Jun 18 02:52:13 PDT 2025
================
@@ -188,9 +188,31 @@ func.func @transfer_read_leading_dynamic_dims(
// -----
-// One of the dims to be flattened is dynamic - not supported ATM.
+// The vector could be a non-contiguous slice of the input
+// memref.
func.func @negative_transfer_read_dynamic_dim_to_flatten(
+ %mem : memref<4x?x?x2xi8>) -> vector<2x2x2xi8> {
+
+ %c0 = arith.constant 0 : index
+ %cst = arith.constant 0 : i8
+ %res = vector.transfer_read %mem[%c0, %c0, %c0, %c0], %cst :
+ memref<4x?x?x2xi8>, vector<2x2x2xi8>
+ return %res : vector<2x2x2xi8>
+}
+
+// CHECK-LABEL: func.func @negative_transfer_read_dynamic_dim_to_flatten(
+// CHECK-NOT: memref.collapse_shape
+// CHECK-NOT: vector.shape_cast
+
+// CHECK-128B-LABEL: func @negative_transfer_read_dynamic_dim_to_flatten(
+// CHECK-128B-NOT: memref.collapse_shape
+
+// -----
+
+// Can flatten the righmost dynamic dimension
----------------
momchil-velikov wrote:
Some more context, the comment and the test were originally
```
// One of the dims to be flattened is dynamic - not supported ATM.
func.func @negative_transfer_read_dynamic_dim_to_flatten(
...
```
With this patch the test is no longer negative and the comment reflects that
at the same level of detail as the original comment.
https://github.com/llvm/llvm-project/pull/142421
More information about the Mlir-commits
mailing list