MLBEDSW-6563: networks failing with memory area exceeded in vela

 - For allocations that have a hard memory limit the Hill Climb allocator
should be given more attempts to find a solution that would fit
 - The fix is to use a memory limit when there is a hard constraint, and
a minimum iteration count, reset on every improvement, when there is a soft
constraint
 - Added maximum number iterations CLI option

Signed-off-by: Tim Hall <tim.hall@arm.com>
Change-Id: I19ff53a0b68412de280263626778a3102cbe52fa
diff --git a/ethosu/vela/vela.py b/ethosu/vela/vela.py
index b5f9f98..6207800 100644
--- a/ethosu/vela/vela.py
+++ b/ethosu/vela/vela.py
@@ -37,6 +37,7 @@
 from .debug_database import DebugDatabase
 from .errors import InputFileError
 from .errors import VelaError
+from .hillclimb_allocation import HillClimbAllocator
 from .nn_graph import NetworkType
 from .nn_graph import TensorAllocator
 from .tensor import MemArea
@@ -439,6 +440,14 @@
             default=1000,
             help="Set the recursion depth limit, may result in RecursionError if too low (default: %(default)s)",
         )
+        parser.add_argument(
+            "--hillclimb-max-iterations",
+            type=int,
+            default=HillClimbAllocator.MAX_ITERATIONS,
+            help=(
+                "Set the maximum number of iterations the Hill Climb tensor allocator will run (default: %(default)s)"
+            ),
+        )
         args = parser.parse_args(args=args)
 
         # Generate the supported ops report and exit
@@ -523,6 +532,7 @@
             timing=args.timing,
             output_dir=args.output_dir,
             cpu_tensor_alignment=args.cpu_tensor_alignment,
+            hillclimb_max_iterations=args.hillclimb_max_iterations,
         )
 
         scheduler_options = scheduler.SchedulerOptions(