aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/graph_optimiser.py
diff options
context:
space:
mode:
authorPatrik Gustavsson <patrik.gustavsson@arm.com>2020-08-13 13:41:05 +0200
committerFredrik Knutsson <fredrik.knutsson.hunnebo@gmail.com>2020-08-14 10:49:15 +0000
commit458a208c44f70a9848f1e8e2e91f28ce3641c48f (patch)
tree37f23561f75d61746383dafc987b411646baaed8 /ethosu/vela/graph_optimiser.py
parentbe733cf04bb262d4eee791d76f01cecd64ff9255 (diff)
downloadethos-u-vela-458a208c44f70a9848f1e8e2e91f28ce3641c48f.tar.gz
MLBEDSW-2570 Avoid usage of NHCWB16 for some cases
Avoid usage of NHCWB16 when Stack/Pack/Concat is performed in axis 3, and the "concat start" of each slice to be combined is not a multiple of 16. Signed-off-by: Patrik Gustavsson <patrik.gustavsson@arm.com> Change-Id: If3f7b4a3424be3c86fc2dc48e8649ce4c4f49485
Diffstat (limited to 'ethosu/vela/graph_optimiser.py')
-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 582924c4..3fe703e1 100644
--- a/ethosu/vela/graph_optimiser.py
+++ b/ethosu/vela/graph_optimiser.py
@@ -69,6 +69,16 @@ def rewrite_concat(tens, arch):
tens.ops.append(new_op)
assert tens.shape[axis] == offset
+ # If axis = 3, NHCWB16 can only be used in the output if all the concat_start's are a multiple of 16,
+ # as it is only then the address offset for the ofm, for all operations, will be 16 byte aligned
+ # For other values of axis the address offsets will be 16 byte aligned, as they are all based on c = 0
+ # and those addresses are always 16 byte aligned due to the NHCWB16 format.
+ if axis == 3:
+ for op in tens.ops:
+ if op.attrs["concat_start"] % 16 != 0:
+ tens.avoid_NHCWB16 = True
+ break
+
return tens