MLBEDSW-2567: CLI option to specify allocation alignment
Added the CLI option. Only applies to CPU tensors. Added an
AllocationError which is raised when Allocation fails.
Signed-off-by: Jacob Bohlin <jacob.bohlin@arm.com>
Change-Id: I89164dea3ac7b7add7bc40aec2ce8fe50600105d
diff --git a/ethosu/vela/compiler_driver.py b/ethosu/vela/compiler_driver.py
index 94900ad..92fe584 100644
--- a/ethosu/vela/compiler_driver.py
+++ b/ethosu/vela/compiler_driver.py
@@ -36,6 +36,7 @@
from .nn_graph import TensorAllocator
from .rewrite_graph import verify_graph_health
from .tensor import MemType
+from .tensor import Tensor
class CompilerOptions:
@@ -62,6 +63,7 @@
tensor_allocator=TensorAllocator.Greedy,
timing=False,
output_dir="outputs",
+ allocation_alignment=Tensor.AllocationQuantum,
):
self.verbose_graph = verbose_graph
@@ -78,6 +80,7 @@
self.tensor_allocator = tensor_allocator
self.timing = timing
self.output_dir = output_dir
+ self.allocation_alignment = allocation_alignment
def __str__(self):
return type(self).__name__ + ": " + str(self.__dict__)
@@ -192,6 +195,7 @@
options.tensor_allocator,
options.verbose_allocation,
options.show_minimum_possible_allocation,
+ allocation_alignment=options.allocation_alignment,
)
# Generate command streams and serialise Npu-ops into tensors
@@ -231,6 +235,7 @@
TensorAllocator.LinearAlloc,
options.verbose_allocation,
options.show_minimum_possible_allocation,
+ allocation_alignment=options.allocation_alignment,
)
npu_performance.calc_performance_for_network(nng, arch)