Skip to content

Commit 2cb852b

Browse files
Mengwei LiuMengwei Liu
authored andcommitted
Add code structure and a few other links to CONTRIBUTING.md
As titled. This PR mainly adds the mapping between our code structure to the documentations/tutorials. Also a few other touch-ups.
1 parent 7d35c68 commit 2cb852b

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

CONTRIBUTING.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,46 @@ Set up your environment by following the instructions at
99
https://pytorch.org/executorch/stable/getting-started-setup.html to clone
1010
the repo and install the necessary requirements.
1111

12+
Refer to this [document](https://pytorch.org/executorch/main/using-executorch-building-from-source.html) to build ExecuTorch from source.
13+
14+
### Dev Setup for Android
15+
For Android, please refer to the [Android documentation](docs/source/using-executorch-android.md).
16+
17+
### Dev Setup for Apple
18+
For Apple, please refer to the [iOS documentation](docs/source/using-executorch-ios.md).
19+
 
20+
21+
## Codebase structure
22+
23+
For brevity only including a portion of the subtree:
24+
25+
* [backends](backends) - Backend implementations for various hardware targets. Each backend uses partitioner to split the graph into subgraphs that can be executed on specific hardware, quantizer to optimize model precision, and runtime components to execute the graph on target hardware. For details refer to the [backend
26+
documentation](docs/source/backend-delegates-integration.md) and the [Export and Lowering tutorial](docs/source/using-executorch-export.md) for more information.
27+
* [exir](exir) - EXport Intermediate Representation (EXIR) is a format for representing the result of [`torch.export`](https://pytorch.org/docs/main/export.ir_spec.html). This directory contains utilities and passes for lowering the EXIR graphs into different [dialects](/docs/source/ir-exir.md) and eventually suitable to run on target hardware.
28+
* [examples](examples) - Example applications and demos using ExecuTorch.
29+
* [extension](extension) - Extensions to the core ExecuTorch runtime.
30+
* [android](extension/android) - JNI layer and Android native APIs for ExecuTorch. Please refer to the [Android documentation](docs/source/using-executorch-android.md) for more information.
31+
* [apple](extension/apple) - Apple native APIs for ExecuTorch. Please refer to the [iOS documentation](docs/source/using-executorch-ios.md) and [how to integrate into Apple platform](https://pytorch.org/executorch/stable/apple-runtime.html) for more information.
32+
* [data_loader](extension/data_loader) - Data loader extension.
33+
* [module](extension/module) - An abstraction that deserializes and executes an ExecuTorch artifact (.pte file). Refer to the [module documentation](docs/source/extension-module.md) for more information.
34+
* [training](extension/training) - Training extension.
35+
* [llm](extension/llm) - Library to run LLM on ExecuTorch including common optimization passes, runtime C++ components. Please refer to the [LLM documentation](docs/source/llm/getting-started.md) for more information.
36+
* [tensor](extension/tensor) - Tensor maker and `TensorPtr`, details in [this documentation](/docs/source/extension-tensor.md).
37+
* [threadpool](extension/threadpool) - Threadpool.
38+
* [kernels](kernels) - Kernel implementations for various operators.
39+
* [optimized](kernels/optimized) - Optimized kernel implementations.
40+
* [portable](kernels/portable) - Portable kernel implementations.
41+
* [quantized](kernels/quantized) - Quantized kernel implementations.
42+
* [runtime](runtime) - Core runtime components in C++, with corresponding Python APIs. These components are used to execute the ExecuTorch program. Please refer to the [runtime documentation](docs/source/runtime-overview.md) for more information.
43+
* [backend](runtime/backend) - Backend delegate registry.
44+
* [core](runtime/core) - Basic components such as `Tensor`, `EValue`, `Error` and `Result` etc.
45+
* [executor](runtime/executor) - Runtime components that execute the ExecuTorch program, such as `Program`, `Method`. Refer to the [runtime API documentation](docs/source/executorch-runtime-api-reference.rst) for more information.
46+
* [kernel](runtime/kernel) - Kernel registry.
47+
* [platform](runtime/platform) - Platform abstraction layer.
48+
* [schema](schema) - FlatBuffer schema definitions.
49+
* [tools](tools) - Tools for development and debugging. Please refer to the [tools documentation](docs/source/devtools-overview.md) for more information.
50+
* [docs](docs) - Documentation source files.
51+
1252
 
1353

1454
## Contributing workflow
@@ -221,7 +261,7 @@ CI is run automatically on all pull requests. However, if you want to run tests
221261

222262
- The `sh test/build_size_test.sh` script will compile the C++runtime along with portable kernels.
223263
- The `test/run_oss_cpp_tests.sh` script will build and run C++ tests locally
224-
- Running `pytest` from the root directory will run Python tests locally.
264+
- Running `pytest` from the root directory will run Python tests locally. Make sure to run this after finishing [Dev Install](#dev-install).
225265

226266
### Writing Tests
227267
To help keep code quality high, ExecuTorch uses a combination of unit tests and
@@ -279,7 +319,8 @@ for basics.
279319
- Good title: "Add XYZ method to ABC"
280320
- Give the PR a clear and thorough description. Don't just describe what the PR
281321
does: the diff will do that. Explain *why* you are making this change, in a
282-
way that will make sense to someone years from now.
322+
way that will make sense to someone years from now. If the PR is a bug fix,
323+
include the issue number at the beginning of the description: "Fixes #1234"
283324
- Explain how you have tested your changes by including repeatable instructions for
284325
testing the PR.
285326
- If you added tests, this can be as simple as the command you used to run the

docs/source/using-executorch-building-from-source.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ portability details.
9292
pip install -e .
9393
```
9494

95+
If C++ files are being modified, you will still have to reinstall ExecuTorch from source.
96+
97+
> **_WARNING:_**
98+
> Some modules can't be imported directly in editable mode. This is a known [issue](https://github.com/pytorch/executorch/issues/9558) and we are actively working on a fix for this. To workaround this:
99+
> ```bash
100+
> # This will fail
101+
> python -c "from executorch.exir import CaptureConfig"
102+
> # But this will succeed
103+
> python -c "from executorch.exir.capture import CaptureConfig"
104+
> ```
105+
95106
> **_NOTE:_** Cleaning the build system
96107
>
97108
> When fetching a new version of the upstream repo (via `git fetch` or `git

0 commit comments

Comments
 (0)