diff options
author | Louis Verhaard <louis.verhaard@arm.com> | 2020-12-03 12:26:25 +0100 |
---|---|---|
committer | Louis Verhaard <louis.verhaard@arm.com> | 2020-12-11 12:24:25 +0100 |
commit | 9bfe0f86ea525055954b160a3c678024743030ec (patch) | |
tree | 384bac88fcc613abd357fbbf266ea30e34cbe526 /ethosu/vela/greedy_allocation.py | |
parent | 93719a9b8c160de3acf047eacb9196f13167bddb (diff) | |
download | ethos-u-vela-9bfe0f86ea525055954b160a3c678024743030ec.tar.gz |
MLBEDSW-1373: Added search based allocator
Added a new tensor allocator that is based on searching,
implemented in C++ (C++11 compatible).
Change-Id: Ie96e9fcfc8e6c58d1fa53911f37de290eeba88cf
Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
Diffstat (limited to 'ethosu/vela/greedy_allocation.py')
-rw-r--r-- | ethosu/vela/greedy_allocation.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/ethosu/vela/greedy_allocation.py b/ethosu/vela/greedy_allocation.py index 58d948c2..b0395def 100644 --- a/ethosu/vela/greedy_allocation.py +++ b/ethosu/vela/greedy_allocation.py @@ -16,7 +16,6 @@ # Description: # Allocate tensor addresses using a greedy algorithm. from . import numeric_util -from .errors import AllocationError class GreedyAllocator: @@ -70,33 +69,8 @@ class GreedyAllocator: self.alloc(new_lr) - self.verify_allocation(alignment) return self.memory_required - def verify_allocation(self, alignment): - lrs = list(self.live_ranges.ranges.values()) - for n in lrs: - for tens in n.tensors: - if not all(op and op.run_on_npu for op in tens.ops + tens.consumer_list): - # This is a CPU tensor, verify alignment - if tens.address % alignment != 0: - raise AllocationError("Tensor {} not aligned to {} bytes".format(tens.name, alignment)) - - for m in lrs: - if n != m and n.overlaps_ranges(m): - overlap, tens_n, tens_m = n.overlaps_address(m) - if overlap and not (tens_n.equivalent(tens_m) and tens_n.address == tens_m.address): - raise AllocationError( - "Overlapping buffers: {}: {} -> {} and {}: {} -> {}".format( - n.name, - tens_n.address, - tens_n.address + n.size, - m.name, - tens_m.address, - tens_m.address + m.size, - ) - ) - def allocate_live_ranges(nng, arch, live_ranges, mem_area, alignment, verbose_allocation=False): g = GreedyAllocator(nng, arch, live_ranges, mem_area) |