aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/greedy_allocation.py
diff options
context:
space:
mode:
authorHenrik G Olsson <henrik.olsson@arm.com>2021-03-08 18:20:00 +0100
committerHenrik G Olsson <henrik.olsson@arm.com>2021-03-09 11:38:33 +0100
commit807278a7d3cc305e232c05b7c098a13485f70203 (patch)
tree566f3d074f58c6e87d4ba185f7616e635ad53330 /ethosu/vela/greedy_allocation.py
parent41c006a3c5cc511f9437cfadbb7889668ea55016 (diff)
downloadethos-u-vela-807278a7d3cc305e232c05b7c098a13485f70203.tar.gz
MLBEDSW-4209 Use live range alignment when allocating
Change-Id: I05216cebe785a3669032a3f021a9b496c44c4d66 Signed-off-by: Henrik G Olsson <henrik.olsson@arm.com>
Diffstat (limited to 'ethosu/vela/greedy_allocation.py')
-rw-r--r--ethosu/vela/greedy_allocation.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/ethosu/vela/greedy_allocation.py b/ethosu/vela/greedy_allocation.py
index b0395def..51b07805 100644
--- a/ethosu/vela/greedy_allocation.py
+++ b/ethosu/vela/greedy_allocation.py
@@ -41,9 +41,12 @@ class GreedyAllocator:
current_offset = 0
for start_addr, lr in self.current_allocs:
aligned_current_offset = numeric_util.round_up(current_offset, new_lr.get_alignment())
- if aligned_current_offset + aligned_size <= start_addr and start_addr - current_offset < best_offset_fit:
- best_offset = current_offset
- best_offset_fit = start_addr - current_offset
+ if (
+ aligned_current_offset + aligned_size <= start_addr
+ and start_addr - aligned_current_offset < best_offset_fit
+ ):
+ best_offset = aligned_current_offset
+ best_offset_fit = start_addr - aligned_current_offset
current_offset = start_addr + lr.size