aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2020-08-27 18:36:05 +0100
committerTim Hall <tim.hall@arm.com>2020-08-28 11:09:20 +0100
commit5e990c88e418df7e885e54dcaf2434efbed3a284 (patch)
tree997b5c09e99af701ebb1151679878610d3e6d339
parent49d9212edf94ad71a00208b893d2181a33ce8648 (diff)
downloadethos-u-vela-5e990c88e418df7e885e54dcaf2434efbed3a284.tar.gz
MLBEDSW-2889: NHCWB16 format issue at end of subgraph
- Processing reshapes at the end of NPU subgraphs selected NHCWB16 tensor format before handing over to the CPU. This commit detects end-of-subgraph during the reshape-consumers compatibility check and chooses NHWC format instead. Signed-off-by: Tim Hall <tim.hall@arm.com> Change-Id: Ieefdbecdba1a6183d79d3ac4d2505503dbf321cb
-rw-r--r--ethosu/vela/scheduler.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ethosu/vela/scheduler.py b/ethosu/vela/scheduler.py
index 41902d67..e9a93c19 100644
--- a/ethosu/vela/scheduler.py
+++ b/ethosu/vela/scheduler.py
@@ -954,6 +954,7 @@ class DynamicProgrammingScheduler:
# Check if NHCWB16 can be used in between cascaded passes
# (NHCWB16 within cascaded passes has been handled earlier in this function)
if self.sg.placement == PassPlacement.Npu:
+ last_op_in_subgraph = self.sg.cascaded_passes[-1].passes[-1].primary_op
for ps in self.sg.cascaded_passes:
if ps.placement != PassPlacement.Npu:
continue
@@ -975,8 +976,8 @@ class DynamicProgrammingScheduler:
# be processed by CPU operations. No-op reshape consumers with empty lists
# (those that have no consumers, or null-consumers used as list terminators)
# must use normal NHWC output.
- incompatible_consumers = [ (not consumer.run_on_npu or consumer.type == "Reshape") for consumer in op.outputs[0].consumer_list
- if consumer is not None ]
+ incompatible_consumers = [ (not consumer.run_on_npu or consumer.type == "Reshape" or (consumer is last_op_in_subgraph))
+ for consumer in op.outputs[0].consumer_list if consumer is not None ]
if (outshape == inshape) and incompatible_consumers and not any(incompatible_consumers):
rewrites.append(op)
else: