diff options
author | Johan Alfvén <johan.alfven@arm.com> | 2022-02-08 13:01:09 +0100 |
---|---|---|
committer | Johan Alfvén <johan.alfven@arm.com> | 2022-02-09 17:02:59 +0100 |
commit | 1b9218e8ea1e2c2a1e01894ba8fe59cfc978cf55 (patch) | |
tree | a112fbc7ab2b1bc3da56370d64d77dd45e853e2d /ethosu/vela | |
parent | a8810553a672407f946cb2e11edab8cd73e2ed43 (diff) | |
download | ethos-u-vela-1b9218e8ea1e2c2a1e01894ba8fe59cfc978cf55.tar.gz |
MLBEDSW-6180: Protect overwrite of subgraph output3.3.0.rc1
Make sure output from subgraph is write protected and
not overwritten by an element wise op.
Signed-off-by: Johan Alfven <johan.alfven@arm.com>
Change-Id: Ie26979913843c62794c5346a315b7089206850e0
Diffstat (limited to 'ethosu/vela')
-rw-r--r-- | ethosu/vela/extract_npu_subgraphs.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ethosu/vela/extract_npu_subgraphs.py b/ethosu/vela/extract_npu_subgraphs.py index 015634c8..ada76f28 100644 --- a/ethosu/vela/extract_npu_subgraphs.py +++ b/ethosu/vela/extract_npu_subgraphs.py @@ -120,6 +120,14 @@ def rewrite_tensor_npu_producer_cpu_consumers( call_ps.primary_op.outputs.append(new_tens) new_tens.ops = [call_ps.primary_op] + # Elementwise op can not overwrite ifm if input is used by many consumers + if orig_tens in npu_subgraph.input_tensors and len(orig_tens.consumers()) > 1: + new_tens.ifm_write_protected = True + + # Elementwise op can not overwrite ifm if tensor is used as output from sub graph + if orig_tens in npu_subgraph.output_tensors: + new_tens.ifm_write_protected = True + for op in list(orig_tens.consumers()): if op is None: continue # Subgraph consumers handled separately. |