aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiqing Zhong <diqing.zhong@arm.com>2020-09-11 10:05:22 +0200
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2020-09-14 11:37:02 +0000
commit55d9e33c77589d61cdcfda5fedb57fb67ff0c55a (patch)
tree8ec3a67682f41ebdda511a43b5bdda89875a4090
parent8dbf8cfefa1feea6598f5f4864657ba6b6ad60ed (diff)
downloadethos-u-vela-55d9e33c77589d61cdcfda5fedb57fb67ff0c55a.tar.gz
MLBEDSW-2816: remove constant array from SRAM
- Only insert DMA op when IFM is for broadcasting and can't fit into SHRAM Change-Id: I3a7137bbc6311ce247353f04b7ab29e1bcbfe1f3 Signed-off-by: Diqing Zhong <diqing.zhong@arm.com>
-rw-r--r--ethosu/vela/insert_dma.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ethosu/vela/insert_dma.py b/ethosu/vela/insert_dma.py
index c238286..9304526 100644
--- a/ethosu/vela/insert_dma.py
+++ b/ethosu/vela/insert_dma.py
@@ -53,6 +53,9 @@ def insert_dma_cmd(op, arch):
if op.type == "DMA" or not op.run_on_npu:
return op
+ is_lut_used = any(inp.purpose == TensorPurpose.LUT for inp in op.inputs)
+ max_ifm_shram_avail = (arch.available_shram_banks(is_lut_used) - arch.shram_reserved_output_banks) * arch.shram_bank_size // 2
+
for idx, tens in enumerate(op.inputs):
if tens.mem_type not in (MemType.Scratch, MemType.Scratch_fast):
@@ -63,7 +66,8 @@ def insert_dma_cmd(op, arch):
and arch.permanent_storage_mem_area != arch.fast_storage_mem_area
) or tens.purpose == TensorPurpose.LUT:
if tens.purpose in (TensorPurpose.Weights, TensorPurpose.LUT) or (
- tens.purpose == TensorPurpose.FeatureMap and op.type in binary_elementwise_op and tens.shape != []
+ tens.purpose == TensorPurpose.FeatureMap and op.type in binary_elementwise_op and
+ tens.shape != [] and tens.shape != op.outputs[0].shape and tens.storage_size() > max_ifm_shram_avail
):
only_vector_product_consumers = True
for oper in tens.consumers():