diff options
author | Dwight Lidman <dwight.lidman@arm.com> | 2021-08-18 19:24:14 +0200 |
---|---|---|
committer | patrik.gustavsson <patrik.gustavsson@arm.com> | 2021-08-23 13:32:55 +0000 |
commit | b9c954273daf16e16264cb332ad84a3cced2663e (patch) | |
tree | 90eea46cc10f999173ce14fa0888990e4cebe910 | |
parent | 04bd3e91ccc43ff09cb98d792a544997e880dc18 (diff) | |
download | ethos-u-vela-b9c954273daf16e16264cb332ad84a3cced2663e.tar.gz |
Reinstate recursion limit CLI option
This commit adds a CLI option for setting
the recursion limit. This option was originally
removed because it was considered unnecessary,
but in some cases of very large (enormous) networks,
a RecursionError is encountered during graph traversal.
A simple solution for issues like those is to manually
increase the recursion limit.
Signed-off-by: Dwight Lidman <dwight.lidman@arm.com>
Change-Id: Id0dbf68edf59b151abfa91783b5f8f021c1bb40f
-rw-r--r-- | OPTIONS.md | 16 | ||||
-rw-r--r-- | ethosu/vela/vela.py | 8 |
2 files changed, 24 insertions, 0 deletions
@@ -223,6 +223,22 @@ be a power of two and greater or equal to 16. vela network.tflite --allocation-alignment 128 ``` +### Recursion Limit + +Sets the Python internal limit to depth of recursion. It may be +necessary to increase this from the default for very large networks +due to the recursive nature of the graph traversal algorithm. +If Vela fails with a `RecursionError`, try increasing the limit using +this option to see if it resolves the issue. +Please note that this option may not work as intended on Microsoft Windows +systems, as there is a hard limit on thread stack size. +**Type: Integer** +**Default: 1000** + +```bash +vela network.tflite --recursion-limit 2000 +``` + ## Verbose Print Options All of the options below are disabled by default and enabling them will add diff --git a/ethosu/vela/vela.py b/ethosu/vela/vela.py index b8a3b9f2..9e237f84 100644 --- a/ethosu/vela/vela.py +++ b/ethosu/vela/vela.py @@ -398,6 +398,12 @@ def main(args=None): " operator inputs and outputs (default: %(default)s)" ), ) + parser.add_argument( + "--recursion-limit", + type=int, + default=1000, + help="Set the recursion depth limit, may result in RecursionError if too low (default: %(default)s)", + ) args = parser.parse_args(args=args) # Generate the supported ops report and exit @@ -431,6 +437,8 @@ def main(args=None): if v.startswith("verbose") and v != "verbose_all": setattr(args, v, True) + sys.setrecursionlimit(args.recursion_limit) + arch = architecture_features.ArchitectureFeatures( vela_config_files=args.config, system_config=args.system_config, |