aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2020-05-15 16:05:49 +0100
committerTim Hall <tim.hall@arm.com>2020-06-18 17:53:52 +0100
commit4e12776b9dd446751fe039b94e58dcfe11f600e5 (patch)
treecb2a2955cb57ce05a281aece01c144455549ce51
parent77f839691cac9ff1678bd05228c7221e7ed6e9c3 (diff)
downloadethos-u-vela-4e12776b9dd446751fe039b94e58dcfe11f600e5.tar.gz
Further update for MLBEDSW-1872
- Pack and reshape operators were manipulating tensors of different equivalence IDs that refer to the same memory area, causing issues with block dependency checking. Ideally we'd use address overlap calculations for accuracy, but this commit implements a generalised solution by setting memory op IO tensors to use the same equivalence ID. Change-Id: Ia59ae3900f508ffeebaf7af4bca32f5be4e69345 Signed-off-by: Tim Hall <tim.hall@arm.com>
-rw-r--r--ethosu/vela/graph_optimiser.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ethosu/vela/graph_optimiser.py b/ethosu/vela/graph_optimiser.py
index b2b233eb..913b9a6a 100644
--- a/ethosu/vela/graph_optimiser.py
+++ b/ethosu/vela/graph_optimiser.py
@@ -400,6 +400,15 @@ def fixup_act_reorder(op, arch):
return op
+# Set input/output tensor equivalence to the same id for memory operations
+def set_tensor_equivalence(op, arch):
+ if op.type == "Reshape":
+ eid = op.outputs[0].equivalence_id
+ for inp in op.inputs:
+ inp.equivalence_id = eid
+ return op
+
+
def convert_mul_max_to_abs_or_lrelu(op, arch):
r"""Whenever there is a subgraph with this topology:
@@ -473,6 +482,7 @@ def optimise_graph_a(nng, arch, verbose_graph=False):
op_rewrite_list = [
# mark block type and check if the operations are supported
mark_npu_block_type,
+ set_tensor_equivalence,
supported_operator_check,
# then do any rewrites of supported operators
convert_depthwise_to_conv,