Skip to content

Commit 06c7e30

Browse files
committed
Update base for Update on "[cmake] Fix CI job"
Summary: Fix an issue caused by #1036 Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
2 parents 375cbcb + 12bcaf6 commit 06c7e30

11 files changed

+111
-120
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ modifications to the Google C++ style guide.
5454

5555
### C++ Portability Guidelines
5656

57-
See also
58-
[Portable Programming](https://github.com/pytorch/executorch/blob/main/docs/website/docs/contributors/portable_programming.md)
57+
See also [Portable C++ Programming](/docs/source/portable-cpp-programming.md)
5958
for detailed advice.
6059

6160
#### C++ language version
@@ -110,10 +109,9 @@ must work with threading**
110109
`ArrayRef<T>`, or code that handles multiple `ScalarType` types), but for the
111110
most part avoid them if possible.
112111

113-
## For Delegate Authors
112+
## For Backend Delegate Authors
114113

115-
* Use [this](/docs/website/docs/contributors/delegates.md)
116-
guide when integrating your delegate with ExecuTorch.
117-
118-
* Refer to [this](/docs/website/docs/contributors/delegates_and_dependencies.md)
119-
set of guidelines when including a 3p depenency for your delegate.
114+
- Use [this](/docs/source/backend-delegates-integration.md) guide when
115+
integrating your delegate with ExecuTorch.
116+
- Refer to [this](/docs/source/backend-delegates-dependencies.md) set of
117+
guidelines when including a third-party depenency for your delegate.
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Dependencies Management for Backend Delegatation
1+
# Third-Party Dependency Management for Backend Delegates
22

33
Disclaimer: We are planning to restructure the repository around delegates.
44
With that some of these guidelines will change in the future.
55

66
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
1010
dependencies a delegate might depend on, and provide a high level guidance on
1111
how to include them.
1212

@@ -17,16 +17,15 @@ This includes dependencies used by the delegate's `partitioner()` and
1717
will be used at later at runtime.
1818

1919
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.
2121

2222
**Guidelines:**
2323

2424
* If ExecuTorch already includes a dependency you require, prefer
2525
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.
3029
* The dependency should not be installed by default when installing
3130
the ExecuTorch Python package.
3231

@@ -41,51 +40,49 @@ subgraph for the delegate.
4140

4241
**Guidelines:**
4342

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
4544
for these third-party dependencies.
4645

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
4847
only the delegate runtime source files.
4948
* If a delegate has a dependency which is already part of
5049
`executorch/third-party` then try to use that if possible. This
5150
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
5352
this. And it should should build and run correctly without this dependency
5453
when the delegate is disabled at build time.
5554

5655
More details in the section [below](#runtime-dependencies).
5756

5857
## Testing-Only Dependencies
5958

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
6160
can either be a Python dependency or a C++ dependency depending on the type of
6261
the test.
6362

6463
**Guidelines:**
6564

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
6766
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.
7069

71-
## Other considerations
70+
## Other Considerations
7271

7372
### Versioning
7473

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
7675
a git tag/release.
7776

78-
### End user vs. Developer experience
79-
80-
* More details TBD
81-
8277
<!---
78+
### End-User vs. Developer Experience
79+
8380
TODO
8481
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
8683
--->
8784

88-
### Documenting the dependency
85+
### Documenting Dependencies
8986
At a minimum, some documentation under `executorch/backends/<delegate_name>/`
9087
should be provided when introducing a new dependency which includes,
9188

@@ -106,34 +103,32 @@ dependencies under `executorch/backends/<delegate_name>/requirements.txt` to be
106103
supplied to pip at installation time. The goal is to decouple them from the core
107104
ExecuTorch dependencies.
108105

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
112109
[recommended](https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts)
113110
ways to mitigate version conflicts.
114111

115112
#### Local Python Packages
116113
If it is a git repository, it should be added as a git submodule.
117114

118-
* More details TBD
119-
120-
<!-- Something like
115+
<!--
116+
TODO: Add more details. Something like
121117
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+
-->
123120

124121
## C++ Dependencies
125122

126123
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.
132125

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.
134129

135130
<!---
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.
139134
--->
Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# How to integrate a Backend Delegate with ExecuTorch?
1+
# Integrating a Backend Delegate into ExecuTorch
22

33
Disclaimer: We are planning to restructure the repository around delegates.
44
With that some of these guidelines will change in the future.
@@ -8,17 +8,17 @@ This is a high level guideline when integrating a backend delegate with ExecuTor
88
## Directory Structure
99

1010
Delegate files should be under this directory:
11-
`executorch/backends/<delegate_name>/`. Delegate name should be unique.
11+
`executorch/backends/<delegate_name>/`. The delegate name should be unique.
1212

13-
## Python files
13+
## Python Source Files
1414

15-
Delegate Python files such as one implementing `preprocess()` or `partition()`
16-
functions for ExecuTorch AoT flow, excluding any external third-party
15+
Delegate Python files such as those implementing `preprocess()` or `partition()`
16+
functions for ExecuTorch AOT flow, excluding any external third-party
1717
dependencies and their files, should be installed and available with
1818
the top level ExecuTorch package. For third-party dependencies, please refer to
19-
[this](./delegates_and_dependencies.md).
19+
[this](./backend-delegates-dependencies.md).
2020

21-
## C++ sources
21+
## C++ Source Files
2222

2323
At a minimum, a delegate must provide CMake support for building its C++
2424
sources.
@@ -28,35 +28,34 @@ top level `CMakeLists.txt` file using `add_subdirectory` CMake command, and
2828
should be built conditionally with an ExecuTorch build flag like
2929
`EXECUTORCH_BUILD_<DELEGATE_NAME>`, see `EXECUTORCH_BUILD_XNNPACK` for example.
3030
For third-party dependencies, please refer to
31-
[this](./delegates_and_dependencies.md).
31+
[this](./backend-delegates-dependencies.md).
3232

33-
Adding buck2 support should make the delegate available to more
34-
ExecuTorch users.
3533

36-
* More details TBD
34+
Adding buck2 support is optional, but will make the delegate available to more
35+
ExecuTorch users.
3736

3837
<!---
39-
TODO
40-
Need to insert a CMake layer in `executorch/backends` to provide some
41-
uniform abstraction across delegates.
38+
TODO: Add more details. Need to insert a CMake layer in `executorch/backends` to
39+
provide some uniform abstraction across delegates.
4240
--->
4341

44-
4542
## Tests
4643

47-
Tests should be added under `executorch/backends/<delegate_name>/test`.
48-
Tests can be either python or C++ tests, for adding more complex e2e please reach out to us.
49-
50-
* Python unit-tests, which are simple python tests to test AoT logic such as
51-
`partitioner()`, AoT export flow i.e., `nn.Module` to generating the `.pte` file.
44+
Tests should be added under `executorch/backends/<delegate_name>/test`. Tests
45+
can be either python or C++ tests. For adding more complex end-to-end (e2e)
46+
tests, please reach out to us.
5247

53-
* Runtime C++ tests, using gtest, can be implemented to test delegate `init()`
54-
or `execute()` logic.
48+
Common test types:
49+
* Simple python unit tests that test AOT logic such as `partitioner()` or AOT
50+
export flow (generating a `.pte` file from an `nn.Module`)
51+
* Runtime C++ tests, using gtest, that test delegate `init()` or `execute()`
52+
runtime logic.
5553

5654
## Documentation
5755

5856
A delegate must contain a `executorch/backends/<delegate_name>/README.md`
59-
explaining the basics of the delegate, directory structure, features, and known-issues if any.
57+
explaining the basics of the delegate, directory structure, features, and known
58+
issues if any.
6059

61-
Any extra setup step(s) beyond the ones listed above, should be documented in
60+
Any extra setup steps beyond the ones listed above should be documented in
6261
`executorch/backends/<delegate_name>/setup.md`

0 commit comments

Comments
 (0)