[Mlir-commits] [mlir] [mlir][TilingInterface] Allow multiple results in PartialReductionOpInterface (PR #92624)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon May 20 09:20:38 PDT 2024


================
@@ -170,11 +170,12 @@ def PartialReductionOpInterface : OpInterface<"PartialReductionOpInterface"> {
           operation reduction. The tensor shape is equal to operation result
           shape with new dimension for each non zero tile size.
         }],
-        /*retType=*/"FailureOr<Operation*>",
+        /*retType=*/"FailureOr<Value>",
----------------
MaheshRavishankar wrote:

I dont know if this can be a `FailureOr<Value>`. If an operation has multiple results then all of the results need an initial tensor.
I am guessing this needs something like this
```
struct SCFInitialTensorResult {

};
FailureOr<SCFInitiaTensorResult> generateInitialTensorForPartialReduction(...)
```

similarly the `mergeReductions` will need a `SCFMergeReductionsResult`...


Its also confusing that this is not the _result of the original operation_ but the _result after tiling_ . So maybe it is better for now to just drop the `resultNumber` and instead return a `FailureOr<SmallVector<Value>>` since this does not really support cases where the original operation has multiple results.


EDIT: Actually I see you are trying to handle multiple results. Even for that case might be better to drop the `resultNumber` and return a `FailureOr<SmallVector<Value>>` and return _all the inits_ at once cause it would be hard to handle in cases where there are multiple partial reduction values being passed along from one iteration to the next.


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


More information about the Mlir-commits mailing list