This patch adds basic support for vectorization of uniform values to SuperVectorizer.
For now, only invariant values to the target vector loops are considered uniform. This
enables the vectorization of loops that use function arguments and external definitions
to the vector loops. We could extend uniform support in the future if we implement some
kind of divergence analysis algorithm.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/IR/Builders.h | ||
---|---|---|
332 | This is very nitty, but the comment order does not match the code order. | |
mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp | ||
939 | can't we just simply return false right away, and get rid of the local bool altogether? | |
950 | use "auto" less, VectorType and Value are reasonable types here | |
mlir/test/Dialect/Affine/SuperVectorize/uniform_divergent.mlir | ||
16 | hmm, this is a new style to me, would you mind either moving all CHECKs of a method together, or at least move these into the function body itself (or correct me if I am wrong and point me to some place that uses this style) |
Thanks! Addressing feedback.
mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp | ||
---|---|---|
939 | Good catch! Thanks! | |
950 | Per LLVM's coding standards (https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable):
This is a bit subjective but IMO these two cases fall into the same category as cast, isa, dyn_cast, since the type is already spelled out in the same line: VectorType vectorTy = getVectorType... Is MLIR following different guidelines in this regard? Otherwise, I would prefer to stick to the guidelines (whatever they are) since this is one of those topics where every reviewer/developer has a different opinion on :). | |
mlir/test/Dialect/Affine/SuperVectorize/uniform_divergent.mlir | ||
16 | You can find similar tests, for example, here: There are probably more. What is exactly the concern? That LABEL check is separated from the other CHECKs? |
mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp | ||
---|---|---|
950 | Fine with me. Thanks for checking the standard. | |
mlir/test/Dialect/Affine/SuperVectorize/uniform_divergent.mlir | ||
16 | I am fine with this if you prefer. The concern was that breaking the CHECKs this way makes it a bit harder to connect the pieces in your head when reading, but I agree that is subjective. |
mlir/include/mlir/IR/Builders.h | ||
---|---|---|
343 | This API is a bit problematic in the ambiguity it creates for SingleResult operation which implicitly convert to Value as well. Op op; builder.setInsertionPointAfter(op); Will fail after this change. |
mlir/include/mlir/IR/Builders.h | ||
---|---|---|
343 | Good point! Should we rename it to setInsertionPointAfterValue, for example? |
This is very nitty, but the comment order does not match the code order.
Would you mind using the same order, it just reads better in my mind....