Ship runtime/executor and runtime/backend headers in pip wheel#19196
Ship runtime/executor and runtime/backend headers in pip wheel#19196kirklandsign merged 1 commit intomainfrom
Conversation
The hard-coded list of header directories in `setup.py`'s `CustomBuildPy` diverged from the cmake `install(DIRECTORY ...)` rules in `CMakeLists.txt`, so `runtime/executor/*.h` (e.g. `method.h`, `program.h`, `method_meta.h`) and `runtime/backend/*.h` were never copied into the pip wheel's `include/executorch/...` tree. This left users who installed `executorch` via pip and then tried to build custom C++ code against the package unable to find core runtime headers referenced by the wheel-shipped extension headers (e.g. anything that includes `executorch/runtime/executor/method.h`). Add both directories to the list so the wheel matches the cmake install surface. Long-term, the TODO already in this file applies: gather headers from cmake instead of hard-coding here. Reported on GitHub: extension headers (e.g. `extension/tensor/tensor_ptr.h`, `runtime/executor/method.h`) were missing after `pip install executorch`.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19196
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 1 New Failure, 4 Cancelled Jobs, 1 Unrelated FailureAs of commit 81d5c34 with merge base c4ec988 ( NEW FAILURE - The following job has failed:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Updates the pip wheel build to ship additional runtime headers so downstream users (e.g., Android demo / C++ extensions) can include ExecuTorch runtime APIs after pip install.
Changes:
- Add
runtime/executor/to the header directories copied into the wheel include tree. - Add
runtime/backend/to the header directories copied into the wheel include tree.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # https://discourse.cmake.org/t/installing-headers-the-modern-way-regurgitated-and-revisited/3238/3 | ||
| for include_dir in [ | ||
| "runtime/core/", | ||
| "runtime/executor/", | ||
| "runtime/kernel/", | ||
| "runtime/backend/", | ||
| "runtime/platform/", |
There was a problem hiding this comment.
While aligning the header directory list with the CMake install() rules, note that CMake also installs a generated runtime/core/version.h (from runtime/core/version.h.in). The current wheel header-copy logic only rglobs *.h from the source tree, so include/executorch/runtime/core/version.h will still be missing from the pip wheel. Consider copying the generated header from the CMake build dir (e.g. ${cmake_cache_dir}/include/executorch/runtime/core/version.h) into the wheel include tree to fully match the CMake install set.
|
/claude review |
|
@claude review |
|
Claude finished @kirklandsign's task in 1m 34s —— View job Review of PR #19196
LGTM — this is a correct and straightforward fix. The I verified the directories exist and contain the expected headers:
The ordering in the list now matches the CMake install order ( One pre-existing gap worth noting (not a blocker for this PR): CMake also installs a generated CI failure ( |
Summary
The hard-coded list of header directories in
setup.py'sCustomBuildPydiverged from the cmakeinstall(DIRECTORY ...)rules inCMakeLists.txt, soruntime/executor/*.h(e.g.method.h,program.h,method_meta.h) andruntime/backend/*.hwere never copied into the pip wheel'sinclude/executorch/...tree.Fixes: #7261
Test plan
CI