[Mlir-commits] [mlir] [mlir] Compose expand of collapse to cast (PR #172864)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Dec 23 10:38:46 PST 2025
================
@@ -748,14 +748,18 @@ bool CastOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
// source memref is static and the value in the target memref is the
// same. They are also compatible if either one is dynamic (see
// description of MemRefCastOp for details).
+ // Note that for dimensions of size 1, the stride can differ.
auto checkCompatible = [](int64_t a, int64_t b) {
return (ShapedType::isDynamic(a) || ShapedType::isDynamic(b) || a == b);
};
if (!checkCompatible(aOffset, bOffset))
return false;
- for (const auto &aStride : enumerate(aStrides))
- if (!checkCompatible(aStride.value(), bStrides[aStride.index()]))
+ for (const auto &[index, aStride] : enumerate(aStrides)) {
+ if (aT.getDimSize(index) == 1)
----------------
MaheshRavishankar wrote:
Is this valid for all dimensions, or just the leading dimensions?
https://github.com/llvm/llvm-project/pull/172864
More information about the Mlir-commits
mailing list