aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Kunze <eric.kunze@arm.com>2023-09-08 17:50:11 +0000
committerEric Kunze <eric.kunze@arm.com>2023-09-12 03:58:07 +0000
commit815472c4038be0386bf4ebfc817f923805cdb43a (patch)
tree05d1c0880563eddc8af582ef928db28e6f4611da
parent7566d1235cb646e46531c2eb34757cb4b3efa933 (diff)
downloadtosa_mlir_translator-815472c4038be0386bf4ebfc817f923805cdb43a.tar.gz
Update to handle unsigned attributes for RESCALE
Check the operand data types to determine whether the RESCALE is operating on signed or unsigned values for the signless type. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I0e1fcf6ee1551afbc911df63a6423f545e672fef
-rw-r--r--src/TosaSerialize.cpp14
m---------third_party/serialization_lib0
2 files changed, 10 insertions, 4 deletions
diff --git a/src/TosaSerialize.cpp b/src/TosaSerialize.cpp
index f74df1d..c72ff2c 100644
--- a/src/TosaSerialize.cpp
+++ b/src/TosaSerialize.cpp
@@ -1227,11 +1227,17 @@ TosaSerializationOperatorBuilder::build<mlir::tosa::RescaleOp>(
op.getAttr("multiplier").dyn_cast<mlir::DenseI32ArrayAttr>().asArrayRef();
auto shift = getDenseI8ArrayAttr<int32_t>(op.getAttr("shift"));
- std::string input_name = GetTensorName(op.getOperand(0));
- std::string output_name = GetTensorName(op.getResult(0));
+ auto input = op.getOperand(0);
+ auto input_ty = input.getType().cast<mlir::RankedTensorType>();
+ auto output = op.getResult(0);
+ auto output_ty = output.getType().cast<mlir::RankedTensorType>();
+
+ std::string input_name = GetTensorName(input);
+ std::string output_name = GetTensorName(output);
- TosaRescaleAttribute attribute(input_zp, output_zp, multiplier, shift,
- scale32, double_round, per_channel);
+ TosaRescaleAttribute attribute(
+ input_zp, output_zp, multiplier, shift, scale32, double_round,
+ per_channel, input_ty.isUnsignedInteger(), output_ty.isUnsignedInteger());
TosaSerializationOperator *tyop = new TosaSerializationOperator(
Op_RESCALE, Attribute_RescaleAttribute, &attribute,
diff --git a/third_party/serialization_lib b/third_party/serialization_lib
-Subproject c6939a4d269968a34b0ae0aa579f0f0736aaecc
+Subproject 9601cbda5ff42dc4762e364d90093670931e126