[Mlir-commits] [mlir] [MLIR] Add fusability query to TilingInterface (PR #166502)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Nov 6 22:46:45 PST 2025
================
@@ -359,6 +359,52 @@ struct LinalgOpTilingInterface
/// Inline the op payload and store the result.
return inlinePayload(builder, linalgOp, ivs, indexedValues);
}
+
+ bool isOpFusableWithConsumerSlice(Operation *op, unsigned resultNumber,
+ ArrayRef<OpFoldResult> offsets,
+ ArrayRef<OpFoldResult> sizes) const {
+ return !cast<LinalgOp>(op).getShapesToLoopsMap();
+ }
+
+ bool isOpFusableWithProducerSlices(
+ Operation *op, ArrayRef<unsigned> operandNumbers,
+ ArrayRef<SmallVector<OpFoldResult>> allOffsets,
+ ArrayRef<SmallVector<OpFoldResult>> allSizes) const {
+
+ auto linalgOp = cast<LinalgOp>(op);
----------------
MaheshRavishankar wrote:
This is kind of based on how the ShapesToLoopsMap works. you could have dimensions used in any arbitrary AffineExpr, but the shapes of the loop are determined by those accesses that are accessed through AffineDimExpr. I am doing the same logic in that method https://github.com/llvm/llvm-project/blob/a7bf45a914f6e0d85d678aa5eb1864b35c0198e4/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp#L156 . If you feel the documentation needs to be updated, please do so.
https://github.com/llvm/llvm-project/pull/166502
More information about the Mlir-commits
mailing list