MLBEDSW-7833: MLCE: Fixed output diff for reshape op
- In order to reduce memory usage, the live range mechanism have logic
to check if the ifm tensor can be reused for the ofm tensor for certain
operators
- In this failing test case, the input to the reshape/memcpy operator
has more than one consumer and this results in a faulty memory overwrite
since there are missing logic that should check the ifm consumers for
the memcpy operator
- The fix is to add the missing logic that ifm can only have one consumer
Change-Id: I2184c0f905b554f648c9732734098509e23b537c
Signed-off-by: Johan Alfven <johan.alfven@arm.com>
diff --git a/ethosu/vela/live_range.py b/ethosu/vela/live_range.py
index 9f94dd6..0ccfc17 100644
--- a/ethosu/vela/live_range.py
+++ b/ethosu/vela/live_range.py
@@ -208,8 +208,11 @@
if not (
tensor_should_be_ignored(ifm, target_mem_area, target_mem_type_set)
or tensor_should_be_ignored(ofm, target_mem_area, target_mem_type_set)
+ # input tensor only allowed to have one consumer
+ or len(ifm.consumer_list) > 1
):
# Currently DMA only used when bypassing memory only ops so ok to reuse ifm
+ # if ifm has only one consumer
ifm_tens = ifm
return ifm_tens