[Mlir-commits] [mlir] [mlir][tosa] Change MatMul zero-point to inputs (PR #129785)
Jack Frankland
llvmlistbot at llvm.org
Wed Mar 5 06:05:42 PST 2025
================
@@ -435,6 +435,34 @@ static LogicalResult verifySameElementTypes(T op, Type inType, Type outType) {
return success();
}
+static LogicalResult verifyZpMatMul(MatMulOp op) {
+ auto aEType = getStorageElementTypeOrSelf(op.getA().getType());
+ auto aZpEType = getStorageElementTypeOrSelf(op.getAZp().getType());
+ if (aEType != aZpEType) {
+ return op.emitOpError("expect input a and a_zp have the same "
+ "element type, got ")
+ << aEType << " and " << aZpEType;
+ }
+
+ auto bEType = getStorageElementTypeOrSelf(op.getB().getType());
+ auto bZpEType = getStorageElementTypeOrSelf(op.getBZp().getType());
+ if (bEType != bZpEType) {
+ return op.emitOpError("expect input b and b_zp have the same "
+ "element type, got ")
+ << bEType << " and " << bZpEType;
+ }
+
+ FailureOr<int64_t> maybeAZp = op.getAZeroPoint();
+ if (succeeded(maybeAZp) && op.verifyAZeroPoint(*maybeAZp).failed())
+ return failure();
----------------
FranklandJack wrote:
Should we be emitting an error here and in the B case below?
https://github.com/llvm/llvm-project/pull/129785
More information about the Mlir-commits
mailing list