diff options
Diffstat (limited to 'ethosu')
-rw-r--r-- | ethosu/vela/greedy_allocation.py | 2 | ||||
-rw-r--r-- | ethosu/vela/tensor_allocation.py | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/ethosu/vela/greedy_allocation.py b/ethosu/vela/greedy_allocation.py index 661644a9..58d948c2 100644 --- a/ethosu/vela/greedy_allocation.py +++ b/ethosu/vela/greedy_allocation.py @@ -59,7 +59,7 @@ class GreedyAllocator: def allocate_live_ranges(self, verbose_allocation, alignment): lrs = set() for lr in self.live_ranges.ranges.values(): - lrs.add((lr.start_time, lr.end_time, lr)) + lrs.add((lr.start_time, -lr.end_time, lr)) lrs = sorted(lrs) diff --git a/ethosu/vela/tensor_allocation.py b/ethosu/vela/tensor_allocation.py index 2d464eec..d53babc3 100644 --- a/ethosu/vela/tensor_allocation.py +++ b/ethosu/vela/tensor_allocation.py @@ -91,7 +91,7 @@ def print_allocation(lrs, mem_area, mem_type_set, sg, verbose_allocation, show_m print("allocation for", mem_area, "- constant tensors in", sg.placement.name, "subgraph(s)") else: print("allocation for", mem_area, "- non-constant tensors in Cpu and Npu subgraphs") - + mem_usage = 0 for start_time, start, end, name, end_time in sorted( ( lr.start_time, @@ -104,6 +104,8 @@ def print_allocation(lrs, mem_area, mem_type_set, sg, verbose_allocation, show_m ): name = name.replace("\x00", "") print("%9d: %#12x - %#12x: %3d - %3d %s" % ((end - start), start, end, start_time, end_time, name)) + mem_usage = max(mem_usage, end) + print("Memory usage: {} ({:#x}) bytes / {:.1f} KB".format(mem_usage, mem_usage, mem_usage / 1024)) print() if show_minimum_possible_allocation and mem_area == MemArea.Sram: |