Skip to content

Commit d6f1625

Browse files
Erik-Lundellrobell
andauthored
Add optional dependency infra and use for ethos_u and vgf backends (#19149)
Optional dependencies can be installed like pip install executorch[ethos_u] - Add --optional-dependency flag to install_executorch.py to include optional deps when installing from source. - Add ethos_u and vgf as available optional dependencies The dependencies match their corresponding requirements.txt files, but there is no convenient way to share. - Installation of optional deps using setup.sh is kept for now. Signed-off-by: Erik Lundell <erik.lundell@arm.com> Co-authored-by: Rob Elliott <Robert.Elliott@arm.com>
1 parent 8a97ac7 commit d6f1625

5 files changed

Lines changed: 41 additions & 2 deletions

File tree

backends/arm/requirements-arm-ethos-u.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
# This source code is licensed under the BSD-style license found in the
44
# LICENSE file in the root directory of this source tree.
55

6+
# These dependencies need to match pyproject.toml
7+
68
ethos-u-vela == 5.0.0
79
pte-adapter-model-explorer == 0.0.2

backends/arm/requirements-arm-tosa.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# This source code is licensed under the BSD-style license found in the
44
# LICENSE file in the root directory of this source tree.
55

6+
# These dependencies need to match pyproject.toml
7+
68
ml_dtypes == 0.5.1
79
flatbuffers == 24.3.25
810
tosa-adapter-model-explorer == 0.1.0

backends/arm/requirements-arm-vgf.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# This source code is licensed under the BSD-style license found in the
44
# LICENSE file in the root directory of this source tree.
55

6+
# These dependencies need to match pyproject.toml
7+
68
ai_ml_emulation_layer_for_vulkan == 0.9.0
79
ai_ml_sdk_model_converter == 0.9.0
810
ai_ml_sdk_vgf_library == 0.9.0

install_executorch.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright (c) Meta Platforms, Inc. and affiliates.
2-
# Copyright 2024-25 Arm Limited and/or its affiliates.
2+
# Copyright 2024-2026 Arm Limited and/or its affiliates.
33
# All rights reserved.
44
#
55
# This source code is licensed under the BSD-style license found in the
@@ -195,6 +195,18 @@ def _parse_args() -> argparse.Namespace:
195195
help="Only installs necessary dependencies for core executorch and skips "
196196
" packages necessary for running example scripts.",
197197
)
198+
allowed_optional_dependencies = ["ethos_u", "vgf", "openvino"]
199+
parser.add_argument(
200+
"--optional-dependency",
201+
action="append",
202+
choices=allowed_optional_dependencies,
203+
default=[],
204+
metavar="EXTRA",
205+
help="Install a named optional dependency from pyproject.toml. Can be "
206+
"passed multiple times, for example "
207+
"--optional-dependency ethos_u --optional-dependency openvino. "
208+
f"Allowed values: {', '.join(allowed_optional_dependencies)}",
209+
)
198210
return parser.parse_args()
199211

200212

@@ -219,6 +231,10 @@ def main(args):
219231
install_requirements(install_pinned_version)
220232

221233
# Step 2: Install core package
234+
package_spec = "."
235+
if args.optional_dependency:
236+
extras = ",".join(dict.fromkeys(args.optional_dependency))
237+
package_spec = f".[{extras}]"
222238
cmd = (
223239
[
224240
sys.executable,
@@ -228,7 +244,7 @@ def main(args):
228244
]
229245
+ (["--editable"] if args.editable else [])
230246
+ [
231-
".",
247+
package_spec,
232248
"--no-build-isolation",
233249
"-v",
234250
]

pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,23 @@ dependencies=[
7777
]
7878

7979
[project.optional-dependencies]
80+
vgf = [
81+
# AoT vgf dependencies
82+
# Keep this in sync with AoT deps from backends/arm/requirements-arm-vgf.txt and
83+
# backends/arm/requirements-arm-tosa.txt.
84+
"ai_ml_emulation_layer_for_vulkan==0.9.0",
85+
"ai_ml_sdk_model_converter==0.9.0",
86+
"ml_dtypes==0.5.1",
87+
"tosa-tools==2026.2.1",
88+
]
89+
ethos_u = [
90+
# AoT ethos_u dependencies
91+
# Keep this in sync with AoT deps backends/arm/requirements-arm-ethos-u.txt and
92+
# backends/arm/requirements-arm-tosa.txt.
93+
"ethos-u-vela==5.0.0",
94+
"ml_dtypes==0.5.1",
95+
"tosa-tools==2026.2.1",
96+
]
8097
openvino = [
8198
"openvino>=2025.1.0,<2026.0.0; platform_system == 'Linux'",
8299
]

0 commit comments

Comments
 (0)