Skip to content

Commit 63eedd9

Browse files
committed
[mlir][tosa] Allow conv ops zero point to be variable
The TOSA specification allows the zero point of conv ops to be variable when the dynamic extension is being used, but information about which extensions are in use is only known when the validation pass is run. A variable zero point should be allowed in the conv ops verifiers. In terms of testing, there didn't seem to be an existing set of tests for the verififers to add this check to, so the opportunity has been taken to run the verifiers on the tests in `ops.mlir`. Since the conv2d test there had variable zero points, this change in functionality is being tested. Change-Id: I2cb5533a6a059290641f2e145f28c712eada0dd7 Signed-off-by: Luke Hutton <[email protected]>
1 parent 3a6108b commit 63eedd9

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

mlir/lib/Dialect/Tosa/IR/TosaOps.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,10 @@ static LogicalResult verifyConvOp(T op) {
291291
ElementsAttr weightZpAttr;
292292
if (!matchPattern(op.getInputZp(), m_Constant(&inputZpAttr)) ||
293293
!matchPattern(op.getWeightZp(), m_Constant(&weightZpAttr))) {
294-
op.emitOpError(
295-
"bail out if the actual value of zero points cannot be determined");
296-
return failure();
294+
return success();
297295
}
298296

299-
// Get and verify explicit zero points.
297+
// Get and verify explicit constant zero points.
300298
int64_t inputZpVal;
301299
int64_t weightZpVal;
302300

mlir/test/Dialect/Tosa/ops.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt %s | mlir-opt | FileCheck %s
1+
// RUN: mlir-opt %s --verify-each | mlir-opt | FileCheck %s
22
// RUN: mlir-opt %s --mlir-print-op-generic | mlir-opt | FileCheck %s
33

44

0 commit comments

Comments
 (0)