From d784af7e8995a10fb403157af48371699c35bbfe Mon Sep 17 00:00:00 2001 From: Tim Hall Date: Tue, 8 Jun 2021 21:25:57 +0100 Subject: MLBEDSW-4602: Fix Deepspeech scale & bias reuse issue. - Deepspeech reuses identical weights and biases throughout the network. Since biases are now interleaved with weights there is a scaling issue when the ifm scales differ between operations using the same weight and scale tensor. - This commit uses interleaved weights/scales on their first use but separates scales to source memory on subsequent use (if the ifm scale is different). Signed-off-by: Tim Hall Change-Id: I7aae163438160a919cae04e235966e75355a6148 --- ethosu/vela/live_range.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'ethosu/vela/live_range.py') diff --git a/ethosu/vela/live_range.py b/ethosu/vela/live_range.py index d75a167d..b687a9e7 100644 --- a/ethosu/vela/live_range.py +++ b/ethosu/vela/live_range.py @@ -344,16 +344,14 @@ def create_linear_live_range_graph(sg, target_mem_area, target_mem_type_set, lr_ lr_graph, tens, target_mem_area, target_mem_type_set ): continue - rng = lr_graph.get_or_create_range(tens) rng.mark_usage(sg_time) for sched_op, op_info in sg.schedule.cost_map.items(): - if op_info.npu_weights_tensor and not ( - tensor_should_be_ignored(lr_graph, op_info.npu_weights_tensor, target_mem_area, target_mem_type_set) - ): - rng = lr_graph.get_or_create_range(op_info.npu_weights_tensor) - rng.mark_usage(sg_time) + for tensor in [op_info.npu_weights_tensor, op_info.npu_scales_tensor]: + if tensor and not (tensor_should_be_ignored(lr_graph, tensor, target_mem_area, target_mem_type_set)): + rng = lr_graph.get_or_create_range(tensor) + rng.mark_usage(sg_time) lr_graph.current_time += 1 return lr_graph -- cgit v1.2.1