[Mlir-commits] [mlir] [mlir][Vector] Support mixed mode vector.contract lowering (PR #117753)
Jakub Kuderski
llvmlistbot at llvm.org
Fri Nov 29 09:58:33 PST 2024
================
@@ -80,6 +80,22 @@ static AffineMap adjustMap(AffineMap map, int64_t index,
return AffineMap::get(map.getNumDims() - 1, 0, results, ctx);
}
+Value promoteToElementType(Location loc, RewriterBase &rewriter, Value v,
+ Type dstElementType) {
+ Type elementType = v.getType();
+ auto vecType = dyn_cast<VectorType>(elementType);
+ if (vecType)
+ elementType = vecType.getElementType();
+ if (elementType == dstElementType)
+ return v;
+ Type promotedType = dstElementType;
+ if (vecType)
+ promotedType = vecType.clone(promotedType);
+ if (isa<FloatType>(dstElementType))
+ return rewriter.create<arith::ExtFOp>(loc, promotedType, v);
+ return rewriter.create<arith::ExtSIOp>(loc, promotedType, v);
+}
----------------
kuhar wrote:
Are there cases when we need to truncate to the dstType?
https://github.com/llvm/llvm-project/pull/117753
More information about the Mlir-commits
mailing list