aboutsummaryrefslogtreecommitdiff
path: root/src/TosaSerialize.cpp
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-11 14:31:53 -0700
commit8833846f0ad7852bb0c57cc4938e086c8d7b8737 (patch)
treeee3cef9110ccef73af8611325916a09473536f04 /src/TosaSerialize.cpp
parentedc04e0ef1a93d1bf4578308d620dd49c10e1ad4 (diff)
downloadtosa_mlir_translator-8833846f0ad7852bb0c57cc4938e086c8d7b8737.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: Ie6fb4f4c128598dccefdded10774a0af0238eede
Diffstat (limited to 'src/TosaSerialize.cpp')
-rw-r--r--src/TosaSerialize.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/TosaSerialize.cpp b/src/TosaSerialize.cpp
index 941a75e..b894383 100644
--- a/src/TosaSerialize.cpp
+++ b/src/TosaSerialize.cpp
@@ -1392,11 +1392,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,