[Mlir-commits] [mlir] [mlir][Tensor] Preserve correct rank expansions in InsertSlice canonicalizer (PR #217361)

Federico Bruzzone llvmlistbot at llvm.org
Thu Aug 20 03:49:12 PDT 2026


================
@@ -134,6 +138,16 @@ OpFoldResult getMixedSize(OpBuilder &builder, Location loc, Value value,
 SmallVector<OpFoldResult> getMixedSizes(OpBuilder &builder, Location loc,
                                         Value value);
 
+/// Infer a slice type with an exact rank-reduction pattern. The source tensor
+/// type provides the element type and encoding; its rank may differ from the
+/// number of sizes when dimensions are dropped.
+RankedTensorType inferSliceType(RankedTensorType sourceTensorType,
+                                ArrayRef<int64_t> staticSizes,
+                                const llvm::SmallBitVector &droppedDims);
+RankedTensorType inferSliceType(RankedTensorType sourceTensorType,
+                                ArrayRef<OpFoldResult> sizes,
+                                const llvm::SmallBitVector &droppedDims);
+
----------------
FedericoBruzzone wrote:

nit: I think there's a small room for improvement here. Could we integrate the _encoding behavior_, ignored _offset/strides_, and how _dynamic sizes_ are handled? 
Very briefly, nothing detailed about any aspect of this.


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


More information about the Mlir-commits mailing list