[Mlir-commits] [mlir] [MLIR] VectorEmulateNarrowType to support loading of unaligned vectors (PR #113411)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 29 17:42:25 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);
----------------
lialan wrote:
It will be inefficient. But we are looking at using packed i1 type to save memory space, and this PR is one of the many steps to support it.
We will optimize performance after this is done.
https://github.com/llvm/llvm-project/pull/113411
More information about the Mlir-commits
mailing list