From 55d9e33c77589d61cdcfda5fedb57fb67ff0c55a Mon Sep 17 00:00:00 2001 From: Diqing Zhong Date: Fri, 11 Sep 2020 10:05:22 +0200 Subject: 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 --- ethosu/vela/insert_dma.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ethosu/vela/insert_dma.py b/ethosu/vela/insert_dma.py index c2382863..9304526a 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(): -- cgit v1.2.1