[PATCH] D72022: [mlir][Linalg] Extend generic ops to allow tensors
Nicolas Vasilache via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 31 06:11:02 PST 2019
nicolasvasilache added inline comments.
================
Comment at: mlir/include/mlir/Dialect/Linalg/Transforms/LinalgTransforms.h:83
+LogicalResult vectorizeGenericLinalgOpPrecondition(Operation *op);
+SmallVector<Value, 0> vectorizeGenericLinalgOp(PatternRewriter &rewriter,
+ Operation *op);
----------------
rriddle wrote:
> Why SmallVector<..., 0>?
This needs a type compatible with `SmallVector<Value, x>` to be used as a NativeCall with for an op with Variadic returns.
Do you have a better suggestion?
================
Comment at: mlir/lib/Dialect/VectorOps/VectorTransforms.cpp:500
// Unroll 'op' with 'iterationBounds' to 'targetShape'.
- return unrollSingleResultStructuredOp(op, iterationBounds, vectors,
- resultIndex, targetShape, builder);
+ return SmallVector<Value, 1>{unrollSingleResultStructuredOp(
+ op, iterationBounds, vectors, resultIndex, targetShape, builder)};
----------------
ftynse wrote:
> Nit: would llvm::to_vector<1> work?
Nope, this is just constructing a 1-element vector from a single value.
================
Comment at: mlir/tools/mlir-tblgen/RewriterGen.cpp:577
+ if (resultTree.isNativeCodeCall()) {
+ os << symbolInfoMap.getAllRangeUse(
+ val, "SmallVector<Value, 4> values{0};", "\n");
----------------
rriddle wrote:
> It isn't immediately clear to me why this is necessary. What return value is convertible to small vector, but not ArrayRef for example?
Reworked and added a comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72022/new/
https://reviews.llvm.org/D72022
More information about the llvm-commits
mailing list