[Mlir-commits] [mlir] [mlir][tosa] Change MatMul zero-point to inputs (PR #129785)

Luke Hutton llvmlistbot at llvm.org
Wed Mar 5 06:09:45 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();
----------------
lhutton1 wrote:

The error is emitted inside the verifyAZeroPoint method: https://github.com/llvm/llvm-project/pull/129785/files#diff-90956ba24a2a97cc56a9a3659c7e46e56f1bd791a869246c6a758f9c93f1434fR1571

https://github.com/llvm/llvm-project/pull/129785


More information about the Mlir-commits mailing list