aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/compiler_driver.py
diff options
context:
space:
mode:
authorJacob Bohlin <jacob.bohlin@arm.com>2020-08-28 13:25:14 +0200
committerJacob Bohlin <jacob.bohlin@arm.com>2020-09-03 10:50:10 +0200
commit0628a8c0136eebf3af8db7fd40b7aed94ff5d670 (patch)
tree65e7a49264f2df1f969122d8d7fb812773c0d4db /ethosu/vela/compiler_driver.py
parentd2e3355813a33ccefaf112750f86c4f04d6ea12c (diff)
downloadethos-u-vela-0628a8c0136eebf3af8db7fd40b7aed94ff5d670.tar.gz
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
Diffstat (limited to 'ethosu/vela/compiler_driver.py')
-rw-r--r--ethosu/vela/compiler_driver.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/ethosu/vela/compiler_driver.py b/ethosu/vela/compiler_driver.py
index 94900ad5..92fe5840 100644
--- a/ethosu/vela/compiler_driver.py
+++ b/ethosu/vela/compiler_driver.py
@@ -36,6 +36,7 @@ from .nn_graph import PassPlacement
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 @@ Note the difference between ArchitectureFeatures and CompilerOptions
tensor_allocator=TensorAllocator.Greedy,
timing=False,
output_dir="outputs",
+ allocation_alignment=Tensor.AllocationQuantum,
):
self.verbose_graph = verbose_graph
@@ -78,6 +80,7 @@ Note the difference between ArchitectureFeatures and CompilerOptions
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 @@ def compiler_driver(nng, arch, options, scheduler_options):
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 @@ def compiler_driver(nng, arch, options, scheduler_options):
TensorAllocator.LinearAlloc,
options.verbose_allocation,
options.show_minimum_possible_allocation,
+ allocation_alignment=options.allocation_alignment,
)
npu_performance.calc_performance_for_network(nng, arch)