-
Notifications
You must be signed in to change notification settings - Fork 796
Remove fbjni dependencies completely by converting all JNI layers to pure JNI #16554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: jni-refactor
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/16554
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New FailuresAs of commit 7c41b68 with merge base 3090486 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Co-authored-by: kirklandsign <[email protected]>
…ING in CMake Co-authored-by: kirklandsign <[email protected]>
extension/android/CMakeLists.txt
Outdated
| # to the version which Android APK links against for runtime to ensure the | ||
| # libc++ dependencies are consistent. WARNING # Users need to use the SAME fbjni | ||
| # version here and in app gradle dependency for runtime compatibility! | ||
| if(NOT FBJNI_VERSION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot We don't need this anymore right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct! The warning about keeping fbjni versions in sync between CMake and Gradle is no longer relevant since we removed the fbjni Gradle dependency. Removed in commit 270e957.
Co-authored-by: kirklandsign <[email protected]>
|
@copilot We don't need code like |
... The training module (jni_layer_training.cpp) still uses fbjni headers and classes (HybridClass, local_ref, etc.). If we remove the fbjni download/setup code, the training build will fail. Should I:
|
|
@copilot Please Convert jni_layer_training.cpp to pure JNI (like the other JNI layers), removing fbjni dependency entirely |
Co-authored-by: kirklandsign <[email protected]>
Done! Converted jni_layer_training.cpp to pure JNI and removed all fbjni dependencies. Changes in commit 7c41b68:
The entire Android JNI layer is now pure JNI with no fbjni dependency. |
Summary
Removes fbjni dependencies entirely from Android build configuration by converting all JNI layers (including training module) to pure JNI.
Gradle changes:
com.facebook.fbjni:fbjni:0.7.0dependency fromexecutorch_android/build.gradlefbjniJavaOnlyVersionandsoLoaderNativeLoaderVersionvariables from rootbuild.gradlecom.facebook.soloader:nativeloader:0.10.5(still used for native library loading)CMake changes:
JNI changes:
All Android builds (including training) no longer depend on fbjni. The entire Android JNI layer is now pure JNI.
Test plan
Verified no Java code imports fbjni. Confirmed soloader usage in Module.java, ExecuTorchRuntime.java, TrainingModule.java, and SGD.java. Reviewed CMake logic to ensure fbjni completely removed. Converted training module C++ code to pure JNI following the pattern used in other JNI layers (jni_layer.cpp, jni_layer_runtime.cpp).
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.