This patch enables vectorization of reductions in Linalg vectorizer
using the vector.mask operation. It also introduces the logic to slice
and propagate the vector mask of a masked multi-reduction to their
respective lowering operations.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Nice, thanks!
Please address comments and let's iterate (fully dynamic condition relaxation can be a separate PR).
mlir/include/mlir/Dialect/Vector/Transforms/VectorMaskingUtils.h | ||
---|---|---|
20 ↗ | (On Diff #488501) | I usually prefer to make these static functions in the proper op / interface to avoid people missing them and constantly reinventing. |
20 ↗ | (On Diff #488501) | ugh .. do we have other instances of such static impls in the .h ? |
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
957–958 | Could we relax the dynamic requirement ? | |
mlir/lib/Dialect/Vector/IR/VectorOps.cpp | ||
348 | ugh .. why do we have 2 APIs for this now .. we have a VectorBuilder(vecType).xxx. |
Addressed feedback
mlir/include/mlir/Dialect/Vector/Transforms/VectorMaskingUtils.h | ||
---|---|---|
20 ↗ | (On Diff #488501) | Argg... sorry... This was a last minute change after posting D141559 as I thought it would be convenient to keep those utils separate from the rest of the vector stuff. Let me move this around. |
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
957–958 | Yep, that is coming next. I'm just making sure we are not generating horrendous code for some cases. I enabled all of this in once shot and performance didn't look good :) | |
mlir/lib/Dialect/Vector/IR/VectorOps.cpp | ||
348 | Idk... fixed... |
Could we relax the dynamic requirement ?
I am expecting followup canonicalizations to be quite simple but I would like to be able to vectorize partially dynamic ops