aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/cascade_builder.py
diff options
context:
space:
mode:
authorJohan Alfvén <johan.alfven@arm.com>2022-12-06 11:16:19 +0100
committerJohan Alfvén <johan.alfven@arm.com>2022-12-08 11:04:07 +0100
commit92689d5ad0dd19a3249e71dd0563731d4c6527c8 (patch)
tree77c176d06d3f11191b3fc75b3d57be89d292a754 /ethosu/vela/cascade_builder.py
parentdb947e46755d8262710e734ccb2fb51ec725c844 (diff)
downloadethos-u-vela-92689d5ad0dd19a3249e71dd0563731d4c6527c8.tar.gz
MLBEDSW-6716: Updates to estimate op SRAM usage
- The cascade builder estimates how much SRAM usage an operator takes when calculating the cascades. If an elementwise operator is included in a cascade the IFM2 will always be a constant/scalar and the IFM2 will be in permanent memory and the size of the IFM2 should not be included in the SRAM estimate. - The scheduler did not take into account that IFM can be reused for the OFM when calculating the op memory usage resulting in a negative number for non-local memory usage. Corrected the calculation and added assert to detect future problems. Change-Id: Id7ec8fe1ec5560290f34579a7b9203a75067aba2 Signed-off-by: Johan Alfven <johan.alfven@arm.com>
Diffstat (limited to 'ethosu/vela/cascade_builder.py')
-rw-r--r--ethosu/vela/cascade_builder.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ethosu/vela/cascade_builder.py b/ethosu/vela/cascade_builder.py
index 7baa3a83..ba210032 100644
--- a/ethosu/vela/cascade_builder.py
+++ b/ethosu/vela/cascade_builder.py
@@ -105,7 +105,11 @@ class CascadeBuilder:
def _estimate_sram_usage(self, sched_op, cost) -> int:
"""Estimate the SRAM required for the Op if all FeatureMaps are in SRAM"""
- ifm2_size = sched_op.ifm2_size_in_bytes()
+ if sched_op.parent_op.type.is_binary_elementwise_op():
+ # ifm2 is scalar or constant and will always persist in permanent memory
+ ifm2_size = 0
+ else:
+ ifm2_size = sched_op.ifm2_size_in_bytes()
if sched_op.requires_full_ifm:
ifm_size = sched_op.ifm_size_in_bytes()
else: