aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/insert_dma.py
diff options
context:
space:
mode:
authorCharles Xu <charles.xu@arm.com>2020-05-13 10:15:26 +0200
committerTim Hall <tim.hall@arm.com>2020-06-18 17:53:52 +0100
commit78792223369fa34dacd0e69e189af035283da2ae (patch)
treeac3826df5528866319fd65d7a99eef8e87cd4084 /ethosu/vela/insert_dma.py
parent620d88c60482bad4d96da4d32cc4cca5561cca9e (diff)
downloadethos-u-vela-78792223369fa34dacd0e69e189af035283da2ae.tar.gz
Add elementwise vector scalars support
Write the constant scalars into flash. In case it's Dram or OffChipFlash, DMA the scalars from flash to sram. Signed-off-by: Charles Xu <charles.xu@arm.com> Change-Id: I42300a05dfe968d623b8aec8549644549e0f54b5
Diffstat (limited to 'ethosu/vela/insert_dma.py')
-rw-r--r--ethosu/vela/insert_dma.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ethosu/vela/insert_dma.py b/ethosu/vela/insert_dma.py
index 703ab9d7..b1b89856 100644
--- a/ethosu/vela/insert_dma.py
+++ b/ethosu/vela/insert_dma.py
@@ -21,6 +21,7 @@ from .operation import Operation
from .tensor import MemArea
from .tensor import TensorPurpose
+binary_elementwise_op = set(("AddAct", "MulAct", "SubAct", "Maximum", "Minimum"))
def insert_dma_cmd(op, arch):
if op.type == "DMA":
@@ -28,7 +29,9 @@ def insert_dma_cmd(op, arch):
for idx, tens in enumerate(op.inputs):
if tens.mem_area in (MemArea.Dram, MemArea.OffChipFlash) and tens.mem_area != arch.fast_storage_mem_area:
- if tens.purpose == TensorPurpose.Weights:
+ if (tens.purpose == TensorPurpose.Weights or
+ (tens.purpose == TensorPurpose.FeatureMap and
+ op.type in binary_elementwise_op)):
only_vector_product_consumers = True
for oper in tens.consumers():
if oper is None or oper.attrs.get("npu_block_type") != NpuBlockType.VectorProduct: