From c72cac8e8beb6bd52bdf6a41e6f7182b5167ee5d Mon Sep 17 00:00:00 2001 From: Johan Alfven Date: Thu, 9 Mar 2023 16:01:00 +0100 Subject: MLBEDSW-7386: Fix assert in pass packing - The assert was caused due to a faulty optimization being done in the pass packing when trying to group CPU passes. The code did not take into account that a CPU op could have many outputs. -The fix is to make sure that the pass the follows the CPU pass is not dependent on any of the outputs from the CPU pass. If there is a dependency the CPU pass cannot be moved. Change-Id: Ia0c90bae1ed97d503a97e7bc353f834a0fa75130 Signed-off-by: Johan Alfven --- ethosu/vela/pass_packing.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ethosu') diff --git a/ethosu/vela/pass_packing.py b/ethosu/vela/pass_packing.py index 6049366f..5a9f9575 100644 --- a/ethosu/vela/pass_packing.py +++ b/ethosu/vela/pass_packing.py @@ -520,11 +520,12 @@ def pack_into_passes(nng, arch, verbose_packing=False): pass_list.insert(insert_index, cpu_ps) break + # Check all outputs from the cpu pass if ( - cpu_ps.ops[0].ofm in [next_ps.ops[0].ifm, next_ps.ops[0].ifm2] + any(ofm in [next_ps.ops[0].ifm, next_ps.ops[0].ifm2] for ofm in cpu_ps.ops[0].outputs) or next_ps.placement == PassPlacement.MemoryOnly ): - # Not possible to move + # Not possible to move since next pass depends on the output from the cpu pass break if pass_list.index(next_ps) == last_idx: -- cgit v1.2.1