[Mlir-commits] [mlir] [mlir][linalg] Preserve unsigned integer widening in named contraction vectorization (PR #216283)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue Aug 25 07:38:23 PDT 2026
================
@@ -2069,6 +2069,29 @@ vectorizeAsLinalgContraction(RewriterBase &rewriter, VectorizationState &state,
vecOperands.push_back(read);
}
+ bool hasUnsignedCast =
+ TypeSwitch<Operation *, bool>(linalgOp.getOperation())
+ .Case<MatmulOp, BatchMatmulOp, BatchReduceMatmulOp, ContractOp>(
+ [](auto op) { return op.getCast() == TypeFn::cast_unsigned; })
+ .Default(false);
+ if (hasUnsignedCast) {
+ auto accType = dyn_cast<VectorType>(vecOperands[2].getType());
+ auto accElementType =
+ accType ? dyn_cast<IntegerType>(accType.getElementType()) : nullptr;
+ if (accElementType && accElementType.isSignless()) {
+ for (Value &operand : MutableArrayRef(vecOperands).take_front(2)) {
+ auto operandType = cast<VectorType>(operand.getType());
+ auto operandElementType =
+ dyn_cast<IntegerType>(operandType.getElementType());
----------------
banach-space wrote:
Yes, I would appreciate if you could extend this. Otherwise there's too many special cases and the code isn't as general as it could be. Thank you!
https://github.com/llvm/llvm-project/pull/216283
More information about the Mlir-commits
mailing list