diff options
author | Fredrik Svedberg <fredrik.svedberg@arm.com> | 2023-02-13 11:32:12 +0100 |
---|---|---|
committer | Fredrik Svedberg <fredrik.svedberg@arm.com> | 2023-02-13 15:46:27 +0000 |
commit | 33c01e68984bf455d3a1f00c7f43ab2a6bb75cbe (patch) | |
tree | a1e9aaff21357b679a463cf6f1cde6dafd6e18d1 /ethosu/vela | |
parent | 49396338b8b37544fff06dff45c0dc05c31e64e9 (diff) | |
download | ethos-u-vela-33c01e68984bf455d3a1f00c7f43ab2a6bb75cbe.tar.gz |
MLBEDSW-7274 Add support for Variable Tensors
Added support for Variable Tensor, including offline planning.
Change-Id: I39f33fee207f1f1a4574a0f53f7377eec8709e15
Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com>
Diffstat (limited to 'ethosu/vela')
-rw-r--r-- | ethosu/vela/live_range.py | 7 | ||||
-rw-r--r-- | ethosu/vela/nn_graph.py | 5 | ||||
-rw-r--r-- | ethosu/vela/reader_util.py | 4 |
3 files changed, 11 insertions, 5 deletions
diff --git a/ethosu/vela/live_range.py b/ethosu/vela/live_range.py index e9806026..b18afecc 100644 --- a/ethosu/vela/live_range.py +++ b/ethosu/vela/live_range.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2020-2022 Arm Limited and/or its affiliates <open-source-office@arm.com> +# SPDX-FileCopyrightText: Copyright 2020-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> # # SPDX-License-Identifier: Apache-2.0 # @@ -282,6 +282,11 @@ def extract_live_ranges_from_cascaded_passes( rng = lr_graph.get_or_create_range(tens, cpu_tensor_alignment) rng.mark_usage(end_time) + # Variable tensor live-range is for entire inference + for tens, rng in lr_graph.ranges.items(): + if tens.is_variable: + rng.mark_usage(0, end_time + 1) + # Add subgraph to set of processed subgraphs lr_graph.processed_subgraphs.add(sg) return lr_graph diff --git a/ethosu/vela/nn_graph.py b/ethosu/vela/nn_graph.py index 98979f64..846632df 100644 --- a/ethosu/vela/nn_graph.py +++ b/ethosu/vela/nn_graph.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2020-2022 Arm Limited and/or its affiliates <open-source-office@arm.com> +# SPDX-FileCopyrightText: Copyright 2020-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> # # SPDX-License-Identifier: Apache-2.0 # @@ -197,7 +197,8 @@ class Subgraph: if op.type in (Op.Placeholder, Op.SubgraphInput): assert len(op.outputs) == 1 - self.input_tensors.append(op.outputs[0]) + if not op.outputs[0].is_variable: + self.input_tensors.append(op.outputs[0]) for out in op.outputs: if out not in visit_tensor_set: diff --git a/ethosu/vela/reader_util.py b/ethosu/vela/reader_util.py index 78eb4366..d30a7bb3 100644 --- a/ethosu/vela/reader_util.py +++ b/ethosu/vela/reader_util.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com> +# SPDX-FileCopyrightText: Copyright 2021-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> # # SPDX-License-Identifier: Apache-2.0 # @@ -56,7 +56,7 @@ def fixup_tensors(input_tensors, tensors): for tens in tensors: if not tens.ops: - op = Operation(Op.Const, tens.name) + op = Operation(Op.Placeholder if tens.is_variable else Op.Const, tens.name) op.set_output_tensor(tens) |