diff options
author | Johan Alfven <johan.alfven@arm.com> | 2023-02-02 09:07:48 +0100 |
---|---|---|
committer | Johan Alfven <johan.alfven@arm.com> | 2023-03-14 11:00:58 +0100 |
commit | 90724965751e882c58de74a044cc7adab307bc55 (patch) | |
tree | 425ccea87487b66ca298a801b298fbf8567f86d9 /ethosu/vela/operation_util.py | |
parent | bb9885190f5f7ea959f171b38ee1dd44d3e1e75e (diff) | |
download | ethos-u-vela-90724965751e882c58de74a044cc7adab307bc55.tar.gz |
MLBEDSW-6260: Add support for using DMA to copy feature maps
- Reshape ops can be bypassed and there is no need to process them by the NPU.
There are use cases when the IFM must be preserved so a memcpy is needed.
This is implemented by an AvgPool.
- In order to reduce the cost of the AvgPool the IFM can be copied by DMA.
This is faster and also it can be turned into a real NOP in cases where
the IFM and the OFM can use the same memory space.
- Added new memcpy op. Only NHWC format supported since DMA can not change
the format on the fly.
- Allow ofm to reuse ifm for memcpy op
- Make sure the DMA copy size is 16 byte aligned
Change-Id: I3605a48d47646ff60d2bb3644dd3a23f872235a7
Signed-off-by: Johan Alfven <johan.alfven@arm.com>
Diffstat (limited to 'ethosu/vela/operation_util.py')
-rw-r--r-- | ethosu/vela/operation_util.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ethosu/vela/operation_util.py b/ethosu/vela/operation_util.py index 7b66dff3..21f9dbed 100644 --- a/ethosu/vela/operation_util.py +++ b/ethosu/vela/operation_util.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2020-2022 Arm Limited and/or its affiliates <open-source-office@arm.com> +# SPDX-FileCopyrightText: Copyright 2020-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> # # SPDX-License-Identifier: Apache-2.0 # @@ -51,6 +51,12 @@ def create_add_nop(name: str) -> Operation: return op +def create_memcpy(name: str) -> Operation: + op = Operation(Op.Memcpy, name) + op.run_on_npu = True + return op + + def create_pad_nop(name: str) -> Operation: op = Operation(Op.Pad, name) op.run_on_npu = True |