aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Svedberg <fredrik.svedberg@arm.com>2020-08-28 18:12:28 +0200
committertim.hall <tim.hall@arm.com>2020-08-28 17:00:16 +0000
commit237d72d80259d2e94f36e952eb0776fc5785f6f8 (patch)
treef01108b4d1fb9e7fd4cd36f829911ddfe7cf3554
parentd7911c44323f2704157cfde6e413136b070f5d4b (diff)
downloadethos-u-vela-237d72d80259d2e94f36e952eb0776fc5785f6f8.tar.gz
[MLBEDSW-2900] zero point fix for int32 ifm
Fixed a zero point issue for int32 ifm. Change-Id: I9149cb24d5b030ea5216a028a113518e458a8d15 Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com>
-rw-r--r--ethosu/vela/register_command_stream_generator.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/ethosu/vela/register_command_stream_generator.py b/ethosu/vela/register_command_stream_generator.py
index 609fcc6b..12ade8da 100644
--- a/ethosu/vela/register_command_stream_generator.py
+++ b/ethosu/vela/register_command_stream_generator.py
@@ -909,8 +909,16 @@ def generate_register_command_stream(nng, sg, arch, verbose=False):
need_zero_point = (faf is not None) or (fmf == "ConcatSliceWrite") or fused_quantize
if (
- primary_op.type in set(("AvgPool", "AvgPoolAct", "ResizeBilinear")) and not need_zero_point
- ) or tens.quantization is None:
+ (
+ primary_op.type in set(("AvgPool", "AvgPoolAct", "ResizeBilinear", "CLZ", "SHL"))
+ and not need_zero_point
+ )
+ or (
+ tens.dtype == DataType.int32
+ and zero_point_op in (cmd0.NPU_SET_IFM_ZERO_POINT, cmd0.NPU_SET_IFM2_ZERO_POINT)
+ )
+ or tens.quantization is None
+ ):
# Actual integer operation, just set scale to 1 and zero point to 0
emit.cmd0_with_param(zero_point_op, 0)
else: