diff options
author | Louis Verhaard <louis.verhaard@arm.com> | 2020-09-16 10:25:28 +0200 |
---|---|---|
committer | patrik.gustavsson <patrik.gustavsson@arm.com> | 2020-09-17 08:17:18 +0000 |
commit | 1356c2ab034738bcf51822de18911cc499fa2e8e (patch) | |
tree | 07f0bf0350d85ae40b1b224c27cff7826f34cdcd /ethosu/vela/tensor_allocation.py | |
parent | c3862c24baa9f141aa4f98b39dd6bd33353521fa (diff) | |
download | ethos-u-vela-1356c2ab034738bcf51822de18911cc499fa2e8e.tar.gz |
MLBEDSW-2377: Greedy allocator improvement
Allocate live ranges with longer life time first.
On average this gives better memory usage.
Change-Id: Id89e9e36a944169a2f10ce7f6e869397ef0abaf0
Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
Diffstat (limited to 'ethosu/vela/tensor_allocation.py')
-rw-r--r-- | ethosu/vela/tensor_allocation.py | 4 |
1 files changed, 3 insertions, 1 deletions
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: |