Repository navigation
Espressif: Add ESP-IDF component generator and int8 wake-word profile - #24293
JakeStevens wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24293
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 19 Pending, 2 Unclassified FailuresAs of commit 81bead7 with merge base 822cb60 ( NEW FAILURE - The following job has failed:
UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
7efdb0e to
c897b6b
Compare
rascani
left a comment
There was a problem hiding this comment.
Should we add this to CI too?
|
|
||
| config ET_ENABLE | ||
| bool "Build the ExecuTorch runtime into the firmware" | ||
| default y |
There was a problem hiding this comment.
We should default this to n so we don't bloat users unless they need this.
There was a problem hiding this comment.
For the IDF component, WDYT about having it include all ops/delegates we might use, and then use configuration or cmake to select what what actually gets used. I'm concerned we'd start creating N x M profiles for all the model combinations we'd want to support.
There was a problem hiding this comment.
Agreed, this is the better long-term shape. Punting to a follow-up PR so this one stays focused.
c897b6b to
8fa3ce4
Compare
Add the hand-written glue the component generator (next PR) stamps out: a registry-shaped CMakeLists.txt gated by CONFIG_ET_ENABLE with WHOLE_ARCHIVE kernel registration and size options (-Os, program verification, debug asserts, kernel registry size), the idf_component.yml and README templates, and et_model, a small C inference API over Program/Method whose method, planned and optional scratch arenas are caller-provided or placed with heap_caps. The component carries only the core runtime and BufferDataLoader, and the shared PAL is copied in by the generator rather than forked here. Authored with AI assistance using Claude Code.
build_idf_component.sh generates a self-contained, source-vendored ESP-IDF component from this repository, modeled on the Arduino packaging script: - Schema headers generated with a host flatc (built from third-party/flatbuffers when unavailable); consumers need only ESP-IDF. - Per-profile kernel registration via ExecuTorch selective-build codegen. Profiles may mix aten:: ops (portable kernels) with cadence:: ops (Cadence backend generic/portable kernels, via backends/cadence/aot/functions.yaml with the selection filtered to the profile's roots). Each profile gets its own generated registration; Kconfig selects one without regeneration. - Core runtime and kernel sources vendored from the same build_variables.bzl lists the CMake build uses. - VERSION records the ExecuTorch commit and per-profile op-set SHA-256 + kernel counts, so model exports can be checked against the vendored component. - The component is off until CONFIG_ET_ENABLE=y, so vendoring it leaves firmware unchanged. - idf_component_smoke/ is a minimal consumer. CI (test_espressif_idf_component.sh) generates every shipped profile, builds the consumer for ESP32-S3 against each, and runs the smoke profile on the emulator. Profiles: smoke (add/mul, for CI) and wakeword_int8 (Hey Muse StreamingWakeWord, Cadence-backend int8 export). README documents the generated-component flow next to the existing executor runner. Authored with AI assistance using Claude Code.
8fa3ce4 to
81bead7
Compare
✅ Added the |
Summary
Add
examples/espressif/build_idf_component.sh, which generates asource-vendored, registry-shaped ESP-IDF component from this
repository, following the same approach as the Arduino library
packaging but with an ESP-IDF layout.
The generator produces the schema headers, vendors the runtime and
needed kernel sources (using the same
build_variables.bzllists asthe CMake build), copies the component template from #24292 and the
shared PAL from #24291, and writes
et_generated.cmake,Kconfig,idf_component.yml, licenses, and aVERSIONfile recording theExecuTorch commit and per-profile op-set hashes. Kernel
registration is generated per profile in
idf_profiles/<name>.ops;the component's Kconfig selects which profile compiles, so switching
profiles needs no regeneration. This PR ships one example profile,
wakeword_int8, which mixes portable ATen glue ops with Cadencebackend generic (portable) int8 kernels.
Consumers of the generated component need only ESP-IDF — no host
CMake build and no
flatc. Application code and models are notincluded; they stay with the application.
Stacked on #24292
Test plan
./examples/espressif/build_idf_component.sh --profiles wakeword_int8 --out /tmp/et-idf-out(component version
1.6.0~3, 80 sources / 292 headers; theknown exporter/runtime version-skew warning is printed when the
installed Python package was built from a different commit).
src/platform/esp_pal.cppisbyte-identical to
examples/espressif/platform/esp_pal.cpp(
cmp).component and calls
et_model_create, foresp32s3andesp32c5with ESP-IDF v6.0.1 (idf.py set-target <target> build);both complete with
Project build complete.