[Mlir-commits] [mlir] [mlir][linalg] Enable expansion of parallel dims of reduction ops (PR #83473)

Han-Chung Wang llvmlistbot at llvm.org
Thu Feb 29 13:14:07 PST 2024


================
@@ -848,6 +853,11 @@ fuseWithReshapeByExpansion(GenericOp genericOp, Operation *reshapeOp,
   // The iterator types of the expanded op are all parallel.
   SmallVector<utils::IteratorType> iteratorTypes(
       expansionInfo.getExpandedOpNumDims(), utils::IteratorType::parallel);
+  for (auto [i, type] : llvm::enumerate(genericOp.getIteratorTypesArray())) {
+    ReassociationIndicesRef group = expansionInfo.getExpandedDims(i);
+    for (auto i : group)
+      iteratorTypes[i] = type;
----------------
hanhanW wrote:

nit1: should replace the second `i` variable with name `j`.
nit2: the group is only used here, how about directly pass it to for op? I.e.,

```
for (auto j : expansionInfo.getExpandedDims(i))
  iteratorTypes[j] = type;
```

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


More information about the Mlir-commits mailing list