[Mlir-commits] [mlir] [MLIR] Determine contiguousness of memrefs with dynamic dimensions (PR #142421)
Momchil Velikov
llvmlistbot at llvm.org
Thu Jun 19 07:01:56 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:
> Why? Because the corresponding vector dim is 1? Could you expand the comment?
Added answer "why"
https://github.com/llvm/llvm-project/pull/142421
More information about the Mlir-commits
mailing list