[Mlir-commits] [mlir] [MLIR] Determine contiguousness of memrefs with a dynamic dimension (PR #140872)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu May 29 08:18:44 PDT 2025


================
@@ -188,18 +188,20 @@ func.func @transfer_read_leading_dynamic_dims(
 
 // -----
 
-// One of the dims to be flattened is dynamic - not supported ATM.
+// One of the dims to be flattened is dynamic and not the leftmost - not
+// possible to reason whether the memref is contiguous as the dynamic dimension
+// could be one and the corresponding stride could be arbitrary.
----------------
banach-space wrote:

>From https://mlir.llvm.org/docs/Dialects/Builtin/#memreftype:
> In absence of an explicit layout, a memref is considered to have a multi-dimensional identity affine map layout.

To me that reads as: without an explicit layout, it's an identity (i.e. a contiguous MemRef), no? If my reading is correct then the logic in `areTrailingDimsContiguous` should be relaxed (no need to check for dynamic dims).

However, in the context of "flattening", the dynamic dims _are_ significant, yes. So one should check for dynamic dims, but probably somewhere in Vector dialect transforms.

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


More information about the Mlir-commits mailing list