[Mlir-commits] [mlir] [mlir][memref] Fix computeCollapsedLayoutMap for contiguous dynamic dim (PR #136485)
Matthias Springer
llvmlistbot at llvm.org
Mon May 5 07:47:20 PDT 2025
================
@@ -2401,11 +2402,19 @@ computeCollapsedLayoutMap(MemRefType srcType,
if (!ShapedType::isDynamic(srcShape[ref.back()]) || ref.size() == 1) {
resultStrides.push_back(srcStrides[ref.back()]);
} else {
- // Dynamically-sized dims may turn out to be dims of size 1 at runtime, so
- // the corresponding stride may have to be skipped. (See above comment.)
- // Therefore, the result stride cannot be statically determined and must
- // be dynamic.
- resultStrides.push_back(ShapedType::kDynamic);
+ bool contiguousSrcDim = srcStrides[ref.back()] == 1;
+ bool dynamicSizeIsPreserved =
+ std::all_of(ref.begin(), ref.end() - 1,
----------------
matthias-springer wrote:
Why is it `ref.begin() -> ref.end() - 1`? All dimensions except for one must be `1`, right? In that case, it does not matter where non-unit dimension is?
https://github.com/llvm/llvm-project/pull/136485
More information about the Mlir-commits
mailing list