1
- # Dependencies Management for Backend Delegatation
1
+ # Third-Party Dependency Management for Backend Delegates
2
2
3
3
Disclaimer: We are planning to restructure the repository around delegates.
4
4
With that some of these guidelines will change in the future.
5
5
6
6
A delegate may depend on external, third-party libraries to efficiently
7
- implement ahead-of-time (AoT ) ` partition() ` or ` preprocess() ` functions, and/or
8
- to implement runtime functions such as ` init() ` or ` execute() ` , or run tests in
9
- a specific manner. This guide aims to classify different types of third-party
7
+ implement ahead-of-time (AOT ) ` partition() ` or ` preprocess() ` functions, and/or
8
+ to implement runtime functions such as ` init() ` or ` execute() ` , or to run tests
9
+ in a specific manner. This guide aims to classify different types of third-party
10
10
dependencies a delegate might depend on, and provide a high level guidance on
11
11
how to include them.
12
12
@@ -17,16 +17,15 @@ This includes dependencies used by the delegate's `partitioner()` and
17
17
will be used at later at runtime.
18
18
19
19
Depending on how the ` preprocess() ` function is implemented this can be either
20
- Python or C++ dependency. This guide will talk about only Python AoT dependencies.
20
+ Python or C++ dependency. This guide will talk about only Python AOT dependencies.
21
21
22
22
** Guidelines:**
23
23
24
24
* If ExecuTorch already includes a dependency you require, prefer
25
25
to use that if possible.
26
- * Since the dependency is only used by the files inside the
27
- ` executorch/backends/<delegate_name>/ ` - it should introduced in
28
- a way that it is needed only by the code inside the backend delegate
29
- directory.
26
+ * If the dependency is only needed by the files inside the
27
+ ` executorch/backends/<delegate_name>/ ` directory, it should be introduced in a
28
+ way such that it is used only by the code under that directory.
30
29
* The dependency should not be installed by default when installing
31
30
the ExecuTorch Python package.
32
31
@@ -41,51 +40,49 @@ subgraph for the delegate.
41
40
42
41
** Guidelines:**
43
42
44
- At a high level, only pay for what you use should be the desired approach
43
+ At a high level, " only pay for what you use" should be the desired approach
45
44
for these third-party dependencies.
46
45
47
- * Similar to the AoT dependencies, the use of this should also be restricted to
46
+ * Similar to the AOT dependencies, the use of this should also be restricted to
48
47
only the delegate runtime source files.
49
48
* If a delegate has a dependency which is already part of
50
49
` executorch/third-party ` then try to use that if possible. This
51
50
helps with reducing the binary size when the delegate is enabled.
52
- * Rest of the ExecuTorch code, outside of the delegate, should not depend on
51
+ * The rest of the ExecuTorch code, outside of the delegate, should not depend on
53
52
this. And it should should build and run correctly without this dependency
54
53
when the delegate is disabled at build time.
55
54
56
55
More details in the section [ below] ( #runtime-dependencies ) .
57
56
58
57
## Testing-Only Dependencies
59
58
60
- Some libraries, or tools are only used for executing the delegate tests. These
59
+ Some libraries or tools are only used for executing the delegate tests. These
61
60
can either be a Python dependency or a C++ dependency depending on the type of
62
61
the test.
63
62
64
63
** Guidelines:**
65
64
66
- * For a Python dependency, it should not be installed by default when
65
+ * For a Python test dependency, it should not be installed by default when
67
66
installing the ExecuTorch Python package.
68
- * If for C++ tests , it should not be part of the
69
- ExecuTorch runtime even when the delegate is built/enabled.
67
+ * For a C++ test dependency , it should not be part of the ExecuTorch runtime
68
+ even when the delegate is built/enabled.
70
69
71
- ## Other considerations
70
+ ## Other Considerations
72
71
73
72
### Versioning
74
73
75
- Explicit and specific is preferred. For example a pypi version (or a criteria ) or
74
+ Explicit and specific is preferred. For example a PyPI version (or range ) or
76
75
a git tag/release.
77
76
78
- ### End user vs. Developer experience
79
-
80
- * More details TBD
81
-
82
77
<!-- -
78
+ ### End-User vs. Developer Experience
79
+
83
80
TODO
84
81
Need to add more about developer experiences, users selecting which delegates
85
- to enable/install for both AoT and Runtime
82
+ to enable/install for both AOT and Runtime
86
83
--->
87
84
88
- ### Documenting the dependency
85
+ ### Documenting Dependencies
89
86
At a minimum, some documentation under ` executorch/backends/<delegate_name>/ `
90
87
should be provided when introducing a new dependency which includes,
91
88
@@ -106,34 +103,32 @@ dependencies under `executorch/backends/<delegate_name>/requirements.txt` to be
106
103
supplied to pip at installation time. The goal is to decouple them from the core
107
104
ExecuTorch dependencies.
108
105
109
- Version conflict should be avoided by trying to use the already included
110
- dependency by ExecuTorch or by some other backend if possible. Otherwise
111
- try some other
106
+ Version conflicts should be avoided by trying to use the dependency already
107
+ included by ExecuTorch or by some other backend if possible. Otherwise try some
108
+ other
112
109
[ recommended] ( https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts )
113
110
ways to mitigate version conflicts.
114
111
115
112
#### Local Python Packages
116
113
If it is a git repository, it should be added as a git submodule.
117
114
118
- * More details TBD
119
-
120
- <!-- Something like
115
+ <!--
116
+ TODO: Add more details. Something like
121
117
https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-from-vcs,
122
- but the URLs can't be in the requirements.txt, so not recommending this for now. -->
118
+ but the URLs can't be in the requirements.txt, so not recommending this for now.
119
+ -->
123
120
124
121
## C++ Dependencies
125
122
126
123
The recommended approach is to include a git submodule for a given C++
127
- dependency in the ` executorch/backends/<delegate_name>/third-party ` .
128
-
129
- ### buck2/CMake support
130
- At a minimum CMake support is required. Adding buck2 support should make
131
- the delegate available to more ExecuTorch users.
124
+ dependency in the ` executorch/backends/<delegate_name>/third-party ` directory.
132
125
133
- * More details TBD
126
+ ### buck2/CMake Support
127
+ At a minimum CMake support is required. Adding buck2 support is optional, but
128
+ will make the delegate available to more ExecuTorch users.
134
129
135
130
<!-- -
136
- TODO
137
- Complying with ET runtime build configurations. Standard switches for library
138
- linking (i.e. static, PIC), optimization flags pass through, etc.
131
+ TODO: Add more details about: complying with ET runtime build configurations;
132
+ standard switches for library linking (i.e. static, PIC), optimization flags
133
+ pass through, etc.
139
134
--->
0 commit comments