Add a single-.so Vulkan+XNNPACK executorch JNI target (#22398) - #22398
Add a single-.so Vulkan+XNNPACK executorch JNI target (#22398)#22398youxie wants to merge 1 commit into
Conversation
🔗 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. ❌ 3 New FailuresAs of commit 8cd16f8 with merge base 02ee1ca ( NEW FAILURES - The following jobs have failed:
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.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
d48ddea to
8cd16f8
Compare
|
@claude thoroughly review this PR and look out for any regressions |
|
Claude finished @psiddh's task in 1m 36s —— View job PR Review: Single-.so Vulkan+XNNPACK JNI target
Verdict: LGTM. This is a low-risk, mechanical change. I traced the two concerns that could cause a regression and both check out. No changes requested. What the PR does
Include-path change — consistent ✅The new include style already matches the rest of the tree. Every other file in
No regression to the CMake build ✅
No regression to existing Buck targets ✅Two things worth calling out that I verified:
CI noteThe 3 red jobs ( Minor observations (non-blocking)
|
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