From 7b632edbbd5989eb7ea5780c57fe94a7550e6070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85strand?= Date: Fri, 12 Apr 2024 00:31:00 +0200 Subject: [PATCH 1/2] Tie quantization of add operands and result together MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Per Åstrand Change-Id: Ie2662ebd6555821fa1d813163daf4b209a319b44 --- backends/arm/arm_quantizer_utils.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backends/arm/arm_quantizer_utils.py b/backends/arm/arm_quantizer_utils.py index 63c98ee42d2..79455695769 100644 --- a/backends/arm/arm_quantizer_utils.py +++ b/backends/arm/arm_quantizer_utils.py @@ -780,11 +780,11 @@ def _annotate_add( if _is_annotated([add_node]): continue + input_act0 = add_node.args[0] input_act_qspec = get_input_act_qspec(quantization_config) - output_act_qspec = get_output_act_qspec(quantization_config) + shared_with_input0_qspec = SharedQuantizationSpec((input_act0, add_node)) input_qspec_map = {} - input_act0 = add_node.args[0] if isinstance(input_act0, Node): if _is_input_large_scalar(input_act0, gm): continue @@ -798,11 +798,14 @@ def _annotate_add( continue if _is_input_non_float_tensor(input_act1): continue - input_qspec_map[input_act1] = input_act_qspec + if input_act0 is not input_act1: + input_qspec_map[input_act1] = shared_with_input0_qspec + else: + input_qspec_map[input_act1] = input_act_qspec add_node.meta["quantization_annotation"] = QuantizationAnnotation( input_qspec_map=input_qspec_map, - output_qspec=output_act_qspec, + output_qspec=shared_with_input0_qspec, _annotated=True, ) return annotated_partitions From bbd3ac326272d5842ba7a9da2626182d4cae0f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85strand?= Date: Wed, 17 Apr 2024 18:08:53 +0200 Subject: [PATCH 2/2] Move Vela to new revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Per Åstrand Change-Id: I798948b233f42b2dc23e061f0654c02963cdd668 --- examples/arm/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/arm/setup.sh b/examples/arm/setup.sh index 72cc4c94a5b..f626b4caeb3 100755 --- a/examples/arm/setup.sh +++ b/examples/arm/setup.sh @@ -215,7 +215,7 @@ function setup_vela() { if [[ ! -e ethos-u-vela ]]; then git clone https://review.mlplatform.org/ml/ethos-u/ethos-u-vela repo_dir="${root_dir}/ethos-u-vela" - base_rev=b90666d9b43f4b5223bb4dcecdbee87b2ad757c2 + base_rev=92240e7979018a197b42aab2da16dc002d86f224 patch_repo fi cd "${root_dir}/ethos-u-vela"