You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit af61b8d
Browse filesBrowse the repository at this point in the historyBrowse files
Register the ESP-IDF component's kernels from a project kernel bundle
The generated component no longer bakes in op profiles. It vendors every kernel
source of the portable, quantized and Cadence generic kernel libraries into a
plain static library, ships gen_kernels.py with the libraries' yamls and
ExecuTorch's codegen templates under tools/, and registers the kernels of the
project's kernel bundle. A project declares its models and bundle with
executorch_add_model and executorch_add_kernels from project_include.cmake. At
the end of the project's configure, a deferred step checks that the bundle was
made for this component, by version and commit, and for exactly the declared
models (by SHA-256), rejects delegates the component does not provide yet, and
compiles the bundle's registration and prim op selection into the component. A
mismatch fails at configure time and prints the gen_kernels.py command that
fixes it. A bundle used without declared models is used as is, with a warning
that names the models it was made from.
Registration no longer needs WHOLE_ARCHIVE. Each registration file is compiled
through a small wrapper that defines an extern "C" anchor, and the deferred
step adds -u for each one, which reaches the link from a deferred call. Only
the bundle's files are anchored, so a project that declares no models and no
bundle links nothing from the component: CI checks that such an app is the same
size with and without it (169,728 B on ESP32-S3). The kernel library is not
even compiled without a bundle. et_model_create references a symbol that only
the bundle's registration defines, so an app that runs a model without
declaring one fails to link on et_requires_executorch_add_kernels instead of
failing every load with missing operators. CONFIG_ET_ENABLE goes away with the
profile choice. The deferred step reads the bundle's kernel count from its
selected_max_kernel_num.h, which it requires, and sizes the registry with it
unless CONFIG_ET_MAX_KERNEL_NUM, now relative to the bundle, sets a larger size
for an application that registers its own kernels; configuring one smaller
than the bundle is an error.
The smoke image on ESP32-S3 is 253,668 B, down from 266,660 B with the smoke
profile, because the bundle selects only the prim ops the model uses (none
here); with all 28 prims selected it is 266,684 B. CI also builds the smoke
consumer for ESP32-C6 (setup.sh gains --targets) with a bundle that adds the
ops of the Cadence-quantized wake word model, so the Cadence generic kernels
stay compiled and linked. It checks that a re-exported model, a model the bundle
was not made from, a bundle made for another component version or commit or
missing its kernel count, and models without a bundle each fail at configure
time, that a bundle used as is names its models, and that an app running an
undeclared model fails to link.
Projects that use an op profile, such as CONFIG_ET_OP_PROFILE_WAKEWORD_INT8,
drop CONFIG_ET_ENABLE and the profile and move to a kernel bundle made from
their model.
Authored with Claude Code.
0 commit comments