Disclaimer: We are planning to restructure the repository around delegates. With that some of these guidelines will change in the future.
This is a high level guideline when integrating a backend delegate with ExecuTorch.
Delegate files should be under this directory: executorch/backends/<delegate_name>/. The delegate name should be unique.
Delegate Python files such as those implementing preprocess() or partition() functions for ExecuTorch AOT flow, excluding any external third-party dependencies and their files, should be installed and available with the top level ExecuTorch package. For third-party dependencies, please refer to this.
At a minimum, a delegate must provide CMake support for building its C++ sources.
For the CMake setup:
CMakeLists.txt file using the add_subdirectory command.EXECUTORCH_BUILD_<DELEGATE_NAME>. (See EXECUTORCH_BUILD_XNNPACK for an example.)For third-party dependencies, please refer to this.
Tests should be added under executorch/backends/<delegate_name>/test. Tests can be either python or C++ tests. For adding more complex end-to-end (e2e) tests, please reach out to us.
Common test types:
partitioner() or AOT export flow (generating a .pte file from an nn.Module)init() or execute() runtime logic.A delegate must include:
executorch/backends/<delegate_name>/README.md – covering the basics of the delegate, its directory structure, features, and any known issues.executorch/backends/<delegate_name>/setup.md – documenting any additional setup steps beyond the ones listed above.