[Mlir-commits] [mlir] [MLIR] VectorEmulateNarrowType to support loading of unaligned vectors (PR #113411)
Han-Chung Wang
llvmlistbot at llvm.org
Thu Oct 24 12:57:31 PDT 2024
================
@@ -102,6 +124,33 @@ static FailureOr<Operation *> getCompressedMaskOp(OpBuilder &rewriter,
return newMask;
}
+static std::optional<int64_t>
+getFrontPaddingSize(ConversionPatternRewriter &rewriter, Location loc,
+ const memref::LinearizedMemRefInfo linearizedInfo,
+ bool isUnalignedEmulation) {
+ if (!isUnalignedEmulation)
+ return 0;
+ auto foldedFrontPaddingSize = getValueOrCreateConstantIndexOp(
+ rewriter, loc, linearizedInfo.frontPaddingSize);
+ // try to fold the front padding size into a constant
+ if (auto frontPadding = dyn_cast_or_null<arith::ConstantIndexOp>(
+ foldedFrontPaddingSize.getDefiningOp())) {
+ return frontPadding.value();
+ }
+ return std::nullopt;
----------------
hanhanW wrote:
Here is the method that you're looking for: `getConstantIntValue`.
https://github.com/llvm/llvm-project/blob/564fd62aedfde6358baa1776a2de975b45bc7778/mlir/include/mlir/Dialect/Utils/StaticValueUtils.h#L87-L88
https://github.com/llvm/llvm-project/pull/113411
More information about the Mlir-commits
mailing list