[Mlir-commits] [mlir] e92013c - [MLIR][TOSA] Simplify getZeroPoint (#138344)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri May 2 23:50:25 PDT 2025
Author: Thomas Preud'homme
Date: 2025-05-03T07:50:21+01:00
New Revision: e92013c68589101b2150e3becd9eda651914fe58
URL: https://github.com/llvm/llvm-project/commit/e92013c68589101b2150e3becd9eda651914fe58
DIFF: https://github.com/llvm/llvm-project/commit/e92013c68589101b2150e3becd9eda651914fe58.diff
LOG: [MLIR][TOSA] Simplify getZeroPoint (#138344)
Added:
Modified:
mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index c669bc4a31d43..de06b621cbe3d 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -2116,10 +2116,9 @@ llvm::LogicalResult tosa::ReshapeOp::verify() {
}
// return failure if val is not a constant
-// set zp to -1 if val is non-zero float or val is not integer nor float
+// set zp to -1 if val is non-zero float or val is not integer nor float
// otherwise set zp to val's constant value
-template <typename T>
-static FailureOr<int64_t> getZeroPoint(T op, Value val) {
+static FailureOr<int64_t> getZeroPoint(Value val) {
ElementsAttr zpAttr;
if (!matchPattern(val, m_Constant(&zpAttr))) {
return failure();
@@ -2189,7 +2188,7 @@ static LogicalResult verifyZeroPoint(tosa::RescaleOp op, Value zpVal,
#define ZERO_POINT_HELPER(OP, OPERAND_NAME) \
FailureOr<int64_t> tosa::OP::get##OPERAND_NAME##ZeroPoint() { \
- return getZeroPoint(*this, get##OPERAND_NAME##Zp()); \
+ return getZeroPoint(get##OPERAND_NAME##Zp()); \
} \
LogicalResult tosa::OP::verify##OPERAND_NAME##ZeroPoint(int64_t zp) { \
return verifyZeroPoint(*this, get##OPERAND_NAME##Zp(), zp, #OPERAND_NAME); \
More information about the Mlir-commits
mailing list