[Mlir-commits] [mlir] [mlir] Rewrites for I2 to I8 signed and unsigned extension (PR #121298)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Fri Jan 10 07:55:33 PST 2025
================
@@ -1090,12 +1090,16 @@ static LogicalResult alignedConversionPrecondition(PatternRewriter &rewriter,
unsigned srcElemBitwidth = subByteVecType.getElementTypeBitWidth();
unsigned dstElemBitwidth = dstType.getElementTypeBitWidth();
- // Only {s}i4 -> (size_of({{s}i/f}) >= 8) are supported for now.
- if (srcElemBitwidth != 4 || dstElemBitwidth < 8 ||
- (dstElemBitwidth % srcElemBitwidth) != 0)
- return rewriter.notifyMatchFailure(op, "Not a supported aligned case");
+ if (dstElemBitwidth < 8)
+ return rewriter.notifyMatchFailure(
+ op, "the bitwidth of dstType must be greater than or equal to 8");
+ if (dstElemBitwidth % srcElemBitwidth != 0)
+ return rewriter.notifyMatchFailure(op, "unaligned cases are not supported");
+ if (srcElemBitwidth != 2 && srcElemBitwidth != 4)
+ return rewriter.notifyMatchFailure(
+ op, "only src bitwidth of 2 or 4 is supported at this moment");
- const int numSrcElemsPerDestElem = dstElemBitwidth / srcElemBitwidth;
+ const int numSrcElemsPerDestElem = 8 / srcElemBitwidth;
----------------
banach-space wrote:
Why hard-code this to 8?
Also, comment for L1105 (sadly GitHub doesn't allow comments for things outside the diff) - please update the error msg.
https://github.com/llvm/llvm-project/pull/121298
More information about the Mlir-commits
mailing list