[Mlir-commits] [mlir] [MLIR] Add fusability query to TilingInterface (PR #166502)

Quinn Dawkins llvmlistbot at llvm.org
Wed Nov 26 09:18:49 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);
----------------
qedawkins wrote:

I reused the impl and changed it to fail on non AffineDimExpr. This helper is different than ShapesToLoopsMap because it's used for verification. Even though the shapes of the loops *can* be determined only from AffineDimExprs, that does not mean the offsets/sizes from non-AffineDimExprs can be ignored. They still must be consistent with the rest.

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


More information about the Mlir-commits mailing list