[Mlir-commits] [mlir] [mlir][scf] Add getPartialResultTilePosition to PartialReductionOpInterface (PR #120465)

Kunwar Grover llvmlistbot at llvm.org
Fri Dec 20 09:21:34 PST 2024


================
@@ -324,7 +324,20 @@ struct LinalgOpTilingInterface
 // External Model for implementing `PartialReductionInterface` for `LinalgOp`s.
 //===----------------------------------------------------------------------===//
 
-/// External model implementation of PartialReductionInterface for LinalgOps.
+static AffineMap getPartialResultAffineMap(LinalgOp linalgOp,
+                                           ArrayRef<int> reductionDims,
+                                           unsigned resultNumber) {
+  AffineMap map =
+      linalgOp.getMatchingIndexingMap(linalgOp.getDpsInitOperand(resultNumber));
+  for (int redPos : reductionDims) {
+    map = map.insertResult(getAffineDimExpr(redPos, linalgOp.getContext()),
----------------
Groverkss wrote:

This is only for linalg ops. You can always add a reduction dimension at the end in a generic op, right?

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


More information about the Mlir-commits mailing list