aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/live_range.py
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2021-06-08 21:25:57 +0100
committerTim Hall <tim.hall@arm.com>2021-06-08 21:25:57 +0100
commitd784af7e8995a10fb403157af48371699c35bbfe (patch)
treebf40b35b030d560049cef9411293b51e3d70ff4a /ethosu/vela/live_range.py
parent225e19d3640288e991475ee4c49cb3ffd83cc83b (diff)
downloadethos-u-vela-d784af7e8995a10fb403157af48371699c35bbfe.tar.gz
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 <tim.hall@arm.com> Change-Id: I7aae163438160a919cae04e235966e75355a6148
Diffstat (limited to 'ethosu/vela/live_range.py')
-rw-r--r--ethosu/vela/live_range.py10
1 files changed, 4 insertions, 6 deletions
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