We shouldn't broadcast the original value when doing reduction. Instead
we compute the reduction and then combine it with the original value.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM so putting a stamp, but please be sure to really refactor the code I point out, with good names to be super easy to come back to in the future.
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
264 | the new code above and below this line feel quite dry. |
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
189 | typo: two | |
208 | This is highly non-trivial, please add a comment with a detailed example with all the steps involved. | |
217 | This is adding a new read + broadcast that didn't exist before, right? | |
247 | typo: match |
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
268 | This should be return vectorizeBinaryReductionOp(reduceOp) where this code gets hoisted. |
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
217 | Correct, the problem is that the value we get at this stage is already loaded + broadcast and added (for a reduction add) to the input so there is nothing I can't extra bak the original value. |
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
268 | I'm not sure I understand. Do you mean the whole creation of multiDimReduce + the extra op to combine with the initial value should go into vectorizeBinaryReductionOp or just the code creating the last instruction? |
typo: two