Skip to content

Espressif: Add ESP-IDF component template for ExecuTorch - #24292

Draft
JakeStevens wants to merge 2 commits into
pytorch:mainfrom
JakeStevens:espressif-idf-template
Draft

JakeStevens wants to merge 2 commits into
pytorch:mainfrom
JakeStevens:espressif-idf-template

Conversation

@JakeStevens

Copy link
Copy Markdown
Contributor

Summary

Add the hand-written template for a generated ExecuTorch ESP-IDF
component.

This contains only the component glue that is copied into generated
output: the component CMakeLists.txt, manifest template, README,
the small C inference API in et_model.h/et_model.cpp, and the
ESP-IDF MmapDataLoader stub (ESP-IDF has no mmap). It deliberately
does not carry a PAL copy; the generator in the next PR copies the
shared PAL from #24291.

Splitting the template out keeps the hand-written runtime glue
reviewable separately from the generator and its vendored output.
On its own this PR is inert: et_generated.cmake and Kconfig are
produced by the generator in the next PR.

Depends on #24291. Draft until that lands, since this branch is
stacked on it.

Test plan

  • With the generator PR applied, generated a component from this
    template and built a minimal ESP-IDF consumer that calls
    et_model_create for esp32s3 and esp32c5 with ESP-IDF v6.0.1;
    both builds complete.
  • Verified the template contains no PAL copy; the generated
    component's src/platform/esp_pal.cpp is byte-identical to the
    shared PAL from Espressif: Share one ESP-IDF PAL across examples #24291.

@JakeStevens JakeStevens added the release notes: examples Changes to any of our example LLMs integrations, such as Llama3 and Llava label Oct 29, 2026
@pytorch-bot

pytorch-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24292

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 2 New Failures, 6 Pending

As of commit f824807 with merge base fcacda3 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 29, 2026
@JakeStevens
JakeStevens force-pushed the espressif-idf-template branch 2 times, most recently from fc420b3 to 56fda89 Compare October 29, 2026 15:41
Move the executor runner's ESP PAL to examples/espressif/platform/esp_pal.cpp and point both the executor runner and camera_stream at it, so the Espressif examples have a single strong PAL implementation. Logging now goes through ESP_LOG with an optional ET_ESP_LOG_LEVEL floor, ticks stay on esp_timer, and the PAL allocation fallback uses malloc/free instead of the minimal nullptr behavior.
The skeleton stamped out by the component generator (next commit):

- CMakeLists.txt: registry-shaped component with a CONFIG_ET_ENABLE
  gate (registers empty unless enabled, so vendoring the component
  does not change a project's firmware) and WHOLE_ARCHIVE kernel
  registration, with the op profile selected via Kconfig from the
  generated et_generated.cmake source lists.
- et_model.h/.cpp: small C inference API over Program/Method (not
  extension::Module, whose planned buffers cannot be placed with
  heap_caps and which hard-references the mmap loader). Arenas and
  planned buffers are allocated with heap_caps placement options
  (internal RAM or PSRAM).
- esp_pal.cpp: ESP_LOG + esp_timer/cycle-counter platform layer.
- mmap_data_loader.cpp: ESP-IDF stub (no mmap; returns NotSupported)
  so the vendored Module code links; Buffer/File loaders work.
- idf_component.yml.in manifest template and component README.
@JakeStevens
JakeStevens force-pushed the espressif-idf-template branch from 56fda89 to f824807 Compare October 29, 2026 15:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: examples Changes to any of our example LLMs integrations, such as Llama3 and Llava

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant