[Mlir-commits] [mlir] [MLIR] VectorEmulateNarrowType to support loading of unaligned vectors (PR #113411)
Diego Caballero
llvmlistbot at llvm.org
Tue Oct 29 16:07:10 PDT 2024
================
@@ -102,6 +129,26 @@ static FailureOr<Operation *> getCompressedMaskOp(OpBuilder &rewriter,
return newMask;
}
+static Value extractSubvectorFrom(RewriterBase &rewriter, Location loc,
+ VectorType extractType, Value vector,
+ int64_t frontOffset, int64_t subvecSize) {
+ auto offsets = rewriter.getI64ArrayAttr({frontOffset});
+ auto sizes = rewriter.getI64ArrayAttr({subvecSize});
+ auto strides = rewriter.getI64ArrayAttr({1});
+ return rewriter
+ .create<vector::ExtractStridedSliceOp>(loc, extractType, vector, offsets,
+ sizes, strides)
+ ->getResult(0);
+}
+
+static Value insertSubvectorInto(RewriterBase &rewriter, Location loc,
+ Value src, Value dest, int64_t offset) {
+ auto offsets = rewriter.getI64ArrayAttr({offset});
+ auto strides = rewriter.getI64ArrayAttr({1});
+ return rewriter.create<vector::InsertStridedSliceOp>(loc, dest.getType(), src,
+ dest, offsets, strides);
----------------
dcaballe wrote:
What's the low level IR we generate for these ops? It looks like this is going to be pretty inefficient.
https://github.com/llvm/llvm-project/pull/113411
More information about the Mlir-commits
mailing list