diff options
author | Jacob Bohlin <jacob.bohlin@arm.com> | 2020-08-28 13:25:14 +0200 |
---|---|---|
committer | Jacob Bohlin <jacob.bohlin@arm.com> | 2020-09-03 10:50:10 +0200 |
commit | 0628a8c0136eebf3af8db7fd40b7aed94ff5d670 (patch) | |
tree | 65e7a49264f2df1f969122d8d7fb812773c0d4db /ethosu/vela/vela.py | |
parent | d2e3355813a33ccefaf112750f86c4f04d6ea12c (diff) | |
download | ethos-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/vela.py')
-rw-r--r-- | ethosu/vela/vela.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ethosu/vela/vela.py b/ethosu/vela/vela.py index 91899c28..923d8ec8 100644 --- a/ethosu/vela/vela.py +++ b/ethosu/vela/vela.py @@ -36,6 +36,7 @@ from .nn_graph import PassPlacement from .nn_graph import TensorAllocator from .scheduler import ParetoMetric from .tensor import MemArea +from .tensor import Tensor def process(fname, arch, model_reader_options, compiler_options, scheduler_options): @@ -259,7 +260,12 @@ def main(args=None): default=1.0, help=("Performs an additional scaling of weight compression scale estimate (default: %(default)s)"), ) - + parser.add_argument( + "--allocation-alignment", + type=int, + default=Tensor.AllocationQuantum, + help=("Controls the allocation byte alignment of cpu tensors (default: %(default)s)"), + ) args = parser.parse_args(args=args) # Read configuration file @@ -280,6 +286,12 @@ def main(args=None): else: force_block_config = None + alignment = args.allocation_alignment + if alignment < 16: + parser.error("the following argument needs to be greater or equal to 16: ALLOCATION_ALIGNMENT") + if alignment & (alignment - 1) != 0: + parser.error("the following argument needs to be a power of 2: ALLOCATION_ALIGNMENT") + arch = architecture_features.ArchitectureFeatures( vela_config=config, system_config=args.system_config, @@ -307,6 +319,7 @@ def main(args=None): tensor_allocator=args.tensor_allocator, timing=args.timing, output_dir=args.output_dir, + allocation_alignment=alignment, ) scheduler_options = scheduler.SchedulerOptions( |