aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/graph_optimiser_util.py
diff options
context:
space:
mode:
authorJames Ward <james.ward@arm.com>2021-09-08 11:14:20 +0100
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2021-10-14 05:30:58 +0000
commit6bf1613c5894d81849dd12b5be6145c1f24caca2 (patch)
tree5c46ae4c43b71403898eb5fa5f2ecab2fd16a90f /ethosu/vela/graph_optimiser_util.py
parent7c0607e142456ebd3577c756b419a3b551cdeafb (diff)
downloadethos-u-vela-6bf1613c5894d81849dd12b5be6145c1f24caca2.tar.gz
MLBEDSW-5162 MLCE: Vela [3.1.0] falling to run with yolov4_int8.tflite
* fix indices for tflite mapping of EXP operator * fix indices for tflite mapping of Transpose operator * ensure read offset after slice is aligned to 16 bytes for NHCWB16 or force linear format * add unit test to ensure mapping of indices is consistent across TFLite, TOSA and NNG Signed-off-by: James Ward <james.ward@arm.com> Change-Id: I17b6e44bc06853325d5eea62a558418ee1ebefe8
Diffstat (limited to 'ethosu/vela/graph_optimiser_util.py')
-rw-r--r--ethosu/vela/graph_optimiser_util.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/ethosu/vela/graph_optimiser_util.py b/ethosu/vela/graph_optimiser_util.py
index 73fbf6c7..3e15f126 100644
--- a/ethosu/vela/graph_optimiser_util.py
+++ b/ethosu/vela/graph_optimiser_util.py
@@ -49,15 +49,18 @@ def _avoid_nhcwb16_for_concat(tens):
def _avoid_nhcwb16_for_split(tens):
# If read offset is not a multiple of 16 in the C-dimension, NHCWB16 need to be avoided in the input
+
+ # Return True if NHCWB16 needs to be avoided
+ def offset_not_aligned(read_offset):
+ return read_offset is not None and (read_offset.depth % 16) != 0
+
for cons_op in tens.consumer_list:
if cons_op.ifm == tens:
- read_offset = cons_op.read_offsets[0]
- elif cons_op.type.is_binary_elementwise_op() and cons_op.ifm2 == tens:
- read_offset = cons_op.read_offsets[1]
- else:
- assert False
- if read_offset is not None and (read_offset[-1] % 16) != 0:
- return True
+ if offset_not_aligned(cons_op.read_offsets[0]):
+ return True
+ if cons_op.ifm2 is not None and cons_op.ifm2 == tens:
+ if offset_not_aligned(cons_op.read_offsets[1]):
+ return True
return False