[Mlir-commits] [mlir] [mlir][scf] Add getPartialResultTilePosition to PartialReductionOpInterface (PR #120465)
Kunwar Grover
llvmlistbot at llvm.org
Fri Dec 20 09:22:45 PST 2024
================
@@ -355,33 +381,19 @@ struct LinalgOpPartialReductionInterface
return op->emitOpError(
"Failed to get an identity value for the reduction operation.");
- ArrayRef<int64_t> oldShape =
- linalgOp.getShape(linalgOp.getDpsInitOperand(initIdx));
-
- // Calculate the new shape, we insert the new dimensions based on the
- // index of the reduction dimensions.
- SmallVector<int64_t> newOutputShape;
- SmallVector<Value> dynamicDims;
- int64_t currReductionDims = 0;
- DenseSet<int> reductionDimsSet(reductionDims.begin(),
- reductionDims.end());
- for (int64_t idx :
- llvm::seq<int64_t>(0, oldShape.size() + reductionDims.size())) {
- if (reductionDimsSet.contains(idx)) {
- dispatchIndexOpFoldResults(sizes[idx], dynamicDims, newOutputShape);
- currReductionDims++;
- continue;
- }
- int64_t oldIdx = idx - currReductionDims;
- int64_t dim = oldShape[oldIdx];
- newOutputShape.push_back(dim);
- if (ShapedType::isDynamic(dim))
- dynamicDims.push_back(b.create<tensor::DimOp>(
- loc, linalgOp.getDpsInitOperand(initIdx)->get(), oldIdx));
+ // Append the new partial result dimensions.
+ AffineMap partialMap =
----------------
Groverkss wrote:
Yes, but currently, PartialReductionOpInterface only understands inner parallel/outer reduction. I want to send another patch which will allow us to pass an option to decide if its inner parallel or outer parallel. Not in the scope of this patch though.
https://github.com/llvm/llvm-project/pull/120465
More information about the Mlir-commits
mailing list