[Mlir-commits] [mlir] [MLIR][TOSA] Simplify getZeroPoint (PR #138344)
Thomas Preud'homme
llvmlistbot at llvm.org
Fri May 2 13:45:11 PDT 2025
https://github.com/RoboTux created https://github.com/llvm/llvm-project/pull/138344
Remove unused op parameter and make the function non template.
>From 185bbfe9c78cc7190bc848b918a06d83e7c1e22c Mon Sep 17 00:00:00 2001
From: Thomas Preud'homme <thomas.preudhomme at arm.com>
Date: Fri, 2 May 2025 21:39:43 +0100
Subject: [PATCH] [MLIR][TOSA] Simplify getZeroPoint
Remove unused op parameter and make the function non template.
---
mlir/lib/Dialect/Tosa/IR/TosaOps.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
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