diff options
author | Fredrik Svedberg <fredrik.svedberg@arm.com> | 2022-06-16 13:14:52 +0200 |
---|---|---|
committer | Fredrik Svedberg <fredrik.svedberg@arm.com> | 2022-06-17 09:34:57 +0200 |
commit | 5cc4c76988eb72c89fe92e96ae670b1828fedf88 (patch) | |
tree | 429bc452a6a2e846a9610500e67e82a674e750ae | |
parent | 7ce6b32b815b6eb01bf3b348a3df37bb783c3a94 (diff) | |
download | ethos-u-vela-5cc4c76988eb72c89fe92e96ae670b1828fedf88.tar.gz |
MLBEDSW-6614 Improve elementwise block size selection
Improved block size selection by favouring larger
block sizes for elementwise operations.
Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com>
Change-Id: I5b30b358d84fcd672935b863c2154bd8f4ccd928
-rw-r--r-- | ethosu/vela/architecture_allocator.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ethosu/vela/architecture_allocator.py b/ethosu/vela/architecture_allocator.py index e7e7471d..b5edcabb 100644 --- a/ethosu/vela/architecture_allocator.py +++ b/ethosu/vela/architecture_allocator.py @@ -329,7 +329,10 @@ def find_block_config( ifm_fetch *= full_blocks.depth # Scale relative to every output OFM element - relative_cost = (ifm_fetch + weight_fetch) / ofm_shape.elements() + if npu_op_type == NpuBlockType.ElementWise: + relative_cost = ofm_shape.elements() / (height * width * depth) + else: + relative_cost = (ifm_fetch + weight_fetch) / ofm_shape.elements() # If the entire IFM can be encompassed by both buffers, bias to prefer this configuration if ifm_shape.elements() < ifm_block.elements() * 2: |