Skip to content

Commit e92013c

Browse files
authored
[MLIR][TOSA] Simplify getZeroPoint (#138344)
1 parent 8c3aa3e commit e92013c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,10 +2116,9 @@ llvm::LogicalResult tosa::ReshapeOp::verify() {
21162116
}
21172117

21182118
// return failure if val is not a constant
2119-
// set zp to -1 if val is non-zero float or val is not integer nor float
2119+
// set zp to -1 if val is non-zero float or val is not integer nor float
21202120
// otherwise set zp to val's constant value
2121-
template <typename T>
2122-
static FailureOr<int64_t> getZeroPoint(T op, Value val) {
2121+
static FailureOr<int64_t> getZeroPoint(Value val) {
21232122
ElementsAttr zpAttr;
21242123
if (!matchPattern(val, m_Constant(&zpAttr))) {
21252124
return failure();
@@ -2189,7 +2188,7 @@ static LogicalResult verifyZeroPoint(tosa::RescaleOp op, Value zpVal,
21892188

21902189
#define ZERO_POINT_HELPER(OP, OPERAND_NAME) \
21912190
FailureOr<int64_t> tosa::OP::get##OPERAND_NAME##ZeroPoint() { \
2192-
return getZeroPoint(*this, get##OPERAND_NAME##Zp()); \
2191+
return getZeroPoint(get##OPERAND_NAME##Zp()); \
21932192
} \
21942193
LogicalResult tosa::OP::verify##OPERAND_NAME##ZeroPoint(int64_t zp) { \
21952194
return verifyZeroPoint(*this, get##OPERAND_NAME##Zp(), zp, #OPERAND_NAME); \

0 commit comments

Comments
 (0)