Add a single-.so Vulkan+XNNPACK executorch JNI target - #22398
Conversation
Summary: Lets the executorch Android JNI sources be compiled from a Buck package other than their own. `log.cpp` and the JNI headers were not exported, and `jni_helper.cpp` and `log.cpp` included their headers by relative path (`#include "log.h"`). That form only resolves while the file is compiled inside `extension/android/jni`; the moment another target picks the `.cpp` up as an exported source, the include fails. This exports the missing files and switches both includes to the full `<executorch/extension/android/jni/...>` path used everywhere else in the tree. Motivating case: building one `libexecutorch.so` that bundles the JNI bridge, the runtime, and both the Vulkan and XNNPACK backends. Android's linker only runs static initializers for libraries reached through an explicit `System.loadLibrary`, so splitting the backends across several `.so` files leaves their `REGISTER_BACKEND` globals unexecuted and the backends invisible at runtime. Composing everything into a single `.so` requires reusing these JNI sources from another package, which is what the include change enables. No behavior change to any existing target. Differential Revision: D118236328
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22398
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New Failures, 1 Unrelated FailureAs of commit d48ddea with merge base fdae101 ( NEW FAILURES - The following jobs have failed:
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. |
|
@youxie has exported this pull request. If you are a Meta employee, you can view the originating Diff in D118236328. |
This PR needs a
|
Summary:
Lets the executorch Android JNI sources be compiled from a Buck package other
than their own.
log.cppand the JNI headers were not exported, andjni_helper.cppandlog.cppincluded their headers by relative path (#include "log.h"). Thatform only resolves while the file is compiled inside
extension/android/jni; the moment another target picks the.cppup as anexported source, the include fails. This exports the missing files and
switches both includes to the full
<executorch/extension/android/jni/...>path used everywhere else in the tree.
Motivating case: building one
libexecutorch.sothat bundles the JNI bridge,the runtime, and both the Vulkan and XNNPACK backends. Android's linker only
runs static initializers for libraries reached through an explicit
System.loadLibrary, so splitting the backends across several.sofilesleaves their
REGISTER_BACKENDglobals unexecuted and the backends invisibleat runtime. Composing everything into a single
.sorequires reusing theseJNI sources from another package, which is what the include change enables.
No behavior change to any existing target.
Differential Revision: D118236328
cc @SS-JIA @manuelcandales @digantdesai @cbilgin