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

Kunwar Grover llvmlistbot at llvm.org
Fri Dec 20 09:25:12 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:

Also, this isn't really adding new dimensions to the operation's iteration space. This is only adding the reduction dimensions  reduction dimensions to the result/init (which did not have the iteration space's reduction dimensions before, because it was reduced).

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


More information about the Mlir-commits mailing list