From 1e363b10a6d4ce0fc062e34df0182b847b08850d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Alfv=C3=A9n?= Date: Thu, 19 May 2022 07:26:03 +0200 Subject: MLBEDSW-6430: MLCE: Update to graph has sequential ethos-u ops Update to the "Vela splitting network into two ethos operators" patch allowing the CPU pass to be moved last in the pass_list. Signed-off-by: Johan Alfven Change-Id: I2e8a299101e5d65e963327bed7c8d891fff6523e --- ethosu/vela/pass_packing.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ethosu/vela/pass_packing.py b/ethosu/vela/pass_packing.py index 74e1f344..050b0965 100644 --- a/ethosu/vela/pass_packing.py +++ b/ethosu/vela/pass_packing.py @@ -501,6 +501,7 @@ def pack_into_passes(nng, arch, verbose_packing=False): # Sort the rest of the list based on critera 2. # Search from bottom of list and when a CPU pass is found # search forward in the list and see if it is possible to join another CPU pass. + last_idx = len(pass_list) - 1 for cpu_ps in reversed(pass_list): if cpu_ps.placement != PassPlacement.Cpu: continue @@ -513,13 +514,20 @@ def pack_into_passes(nng, arch, verbose_packing=False): insert_index = pass_list.index(next_ps) pass_list.insert(insert_index, cpu_ps) break + if ( - cpu_ps.ops[0].ofm not in [next_ps.ops[0].ifm, next_ps.ops[0].ifm2] - and next_ps.placement != PassPlacement.MemoryOnly + cpu_ps.ops[0].ofm in [next_ps.ops[0].ifm, next_ps.ops[0].ifm2] + or next_ps.placement == PassPlacement.MemoryOnly ): - continue + # Not possible to move + break + + if pass_list.index(next_ps) == last_idx: + # Last element, ok to move the CPU pass + pass_list.remove(cpu_ps) + pass_list.append(cpu_ps) + break - break pass_list_top.extend(pass_list) sg.passes = pass_list_top -- cgit v1.2.1