MLBEDSW-8973: MLCE: Fix assert in build pass links
- Assert in build pass links due to that a concat
op is split into several avg pools op which run in different
custom ops. The code did not expected the pass to have a
dependency to itself.
- Fixed the assert to handle this special case
Change-Id: Id03b1145b19c25bf967a1061aa5ecf559b3bc1cc
Signed-off-by: Johan Alfven <johan.alfven@arm.com>
diff --git a/ethosu/vela/nn_graph.py b/ethosu/vela/nn_graph.py
index 3c87f9b..b9eee28 100644
--- a/ethosu/vela/nn_graph.py
+++ b/ethosu/vela/nn_graph.py
@@ -253,7 +253,10 @@
for tens in ps.inputs:
for op in tens.ops:
pred_pass = op.scheduled_pass
- assert pred_pass.time < ps.time
+ # Pass with split concat ops may end up with a dependency to
+ # itself since output from concat is produced by several avg pool ops.
+ # Hence pred_pass can be equal to ps.
+ assert pred_pass == ps or pred_pass.time < ps.time
if ps not in pred_pass.successors:
pred_pass.successors.append(ps)