[Mlir-commits] [mlir] [mlir] Compose expand of collapse to cast (PR #172864)
Maya Amrami
llvmlistbot at llvm.org
Sat Dec 20 23:26:25 PST 2025
amrami wrote:
> The lit test confuses me. I expect that to just get folded away by the `ComposeExpandOfCollapseOp` pattern. Why is there a cast?
ComposeExpandOfCollapseOp cannot really fold y=expand(collapse(x)) away and use x, because y and x have different strides.
Specifically the pattern fails at the this check:
` if (hasNonIdentityLayout(expandOp.getSrc().getType()) ||
hasNonIdentityLayout(collapseOp.getSrc().getType()) ||
hasNonIdentityLayout(collapseOp.getResult().getType())) {
`
This is where I add another check - are the types cast compatible?
If they are - we insert a cast.
I will change the shapes is the lit test, and maybe the difference in strides will be more noticeable.
https://github.com/llvm/llvm-project/pull/172864
More information about the Mlir-commits
mailing list