[Mlir-commits] [mlir] [mlir][tensor] Preserve encoding in `CollapseShapeOp::build` (PR #173720)
Longsheng Mou
llvmlistbot at llvm.org
Sat Dec 27 22:47:54 PST 2025
================
@@ -1682,7 +1682,13 @@ static Value getCollapsedOpOperand(Location loc, LinalgOp op,
operandReassociation)
.getResult();
}
- return tensor::CollapseShapeOp::create(builder, loc, operand,
+ RankedTensorType operandType = cast<RankedTensorType>(operand.getType());
+ RankedTensorType collapsedType = tensor::CollapseShapeOp::inferCollapsedType(
----------------
CoTinker wrote:
Good idea, and I find that we can’t modify `CollapsedShapeOp::inferCollapsedType` to preserve encoding, since it’s used by `SparseTensor` and needs the existing behavior to retrieve the correct attributes.
https://github.com/llvm/llvm-project/pull/173720
More information about the Mlir-commits
mailing list