[Mlir-commits] [mlir] [MLIR] VectorEmulateNarrowType to support loading of unaligned vectors (PR #113411)

Han-Chung Wang llvmlistbot at llvm.org
Mon Oct 28 13:45:38 PDT 2024


================
@@ -102,6 +129,36 @@ static FailureOr<Operation *> getCompressedMaskOp(OpBuilder &rewriter,
   return newMask;
 }
 
+static std::optional<int64_t>
+getIntraVectorOffset(ConversionPatternRewriter &rewriter, Location loc,
+                     const memref::LinearizedMemRefInfo linearizedInfo) {
+  auto foldedIntraVectorOffset = getValueOrCreateConstantIndexOp(
+      rewriter, loc, linearizedInfo.intraVectorOffset);
+  return getConstantIntValue(foldedIntraVectorOffset);
+}
+
+static Value extractSubvectorFrom(ConversionPatternRewriter &rewriter,
----------------
hanhanW wrote:

I thought that I made a suggestion to use `RewriteBase&`, but it looks like I missed it. In the codebase we usually pass `RewriteBase&` to a method because the method can be reused by any other rewriters. There are no ConversionPatternRewriter specific methods needed in the function. It helps the case that we could refactor it to somewhere else and the consistency in the codebase. Can you make the change? (Same for the below function.)

https://github.com/llvm/llvm-project/pull/113411


More information about the Mlir-commits mailing list