diff options
author | Tim Hall <tim.hall@arm.com> | 2022-07-12 17:02:25 +0100 |
---|---|---|
committer | tim.hall <tim.hall@arm.com> | 2022-07-23 16:56:07 +0000 |
commit | e178f387c56705e7c46ccf57d3676086fb22f05a (patch) | |
tree | 05a14761d71fefd67d735a0fe5c7a7c09546c3dc | |
parent | 783d364dda009a063fb4f5cc8dc89f347df7eb7c (diff) | |
download | ethos-u-vela-e178f387c56705e7c46ccf57d3676086fb22f05a.tar.gz |
vela: OFM_SCALE refactor
- Minor rework at the register command stream level
Signed-off-by: Tim Hall <tim.hall@arm.com>
Change-Id: I58495e40efa3a95bdf6febde530f9f73fa8be30b
-rw-r--r-- | ethosu/vela/register_command_stream_generator.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ethosu/vela/register_command_stream_generator.py b/ethosu/vela/register_command_stream_generator.py index 2bdfda20..12a36caf 100644 --- a/ethosu/vela/register_command_stream_generator.py +++ b/ethosu/vela/register_command_stream_generator.py @@ -758,7 +758,6 @@ def generate_scaling_for_elementwise(emit: CommandStreamEmitter, npu_op: NpuElem shift = 0 else: ofm_scale, shift = scaling.elementwise_mul_scale(input_scale, input2_scale, output_scale) - emit.cmd1_with_offset(cmd1.NPU_SET_OFM_SCALE, ofm_scale, shift) else: # Add/Sub opa_scale: float opb_scale: float @@ -809,13 +808,13 @@ def generate_scaling_for_elementwise(emit: CommandStreamEmitter, npu_op: NpuElem op_to_scale = scaling.OperandToScale.OPa emit.cmd1_with_offset(cmd1.NPU_SET_OPA_SCALE, opa_scale, opa_shift) emit.cmd1_with_offset(cmd1.NPU_SET_OPB_SCALE, opb_scale) - emit.cmd1_with_offset(cmd1.NPU_SET_OFM_SCALE, ofm_scale, shift) elif npu_op.sub_op_type in (NpuElementWiseOp.LRELU, NpuElementWiseOp.ABS): output_scale = npu_op.ofm.quantization.scale_f32 ofm_scale, shift = scaling.quantise_scale(output_scale) - emit.cmd1_with_offset(cmd1.NPU_SET_OFM_SCALE, ofm_scale, shift) else: - emit.cmd1_with_offset(cmd1.NPU_SET_OFM_SCALE, 1, 0) + ofm_scale = 1 + shift = 0 + emit.cmd1_with_offset(cmd1.NPU_SET_OFM_SCALE, ofm_scale, shift) return op_to_scale |