-
Notifications
You must be signed in to change notification settings - Fork 796
Remove fbjni dependencies from jni_layer_training #16556
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: main
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/16556
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
- Convert jni_layer_training.cpp from fbjni to pure JNI - Replace HybridClass with native handle pattern - Replace fbjni method registration with RegisterNatives - Update TrainingModule.java to use long mNativeHandle - Update SGD.java to use long mNativeHandle - Add finalize() and destroy() methods for cleanup - Update jni_layer.cpp to pass JNIEnv* to training registration Co-authored-by: kirklandsign <[email protected]>
…Warnings for finalize() Co-authored-by: kirklandsign <[email protected]>
…ormance Co-authored-by: kirklandsign <[email protected]>
|
@copilot error: use of undeclared identifier 'jni_helper'; did you mean 'executorch::jni_helper'? |
…aration Co-authored-by: kirklandsign <[email protected]>
Summary
Converts
jni_layer_training.cppfrom fbjni to pure JNI, eliminating the fbjni dependency for the Android training module.C++ (
jni_layer_training.cpp):ExecuTorchTrainingJniandSGDHybridHybridClasses with native handle classesTrainingJniCachefor cached class/method ID lookups (Tensor, EValue, HashMap, ByteBuffer, ByteOrder, Long/Double/Boolean wrappers)RegisterNativesinstead of fbjni registrationJava (
TrainingModule.java,SGD.java):HybridDatawithlong mNativeHandlecom.facebook.jni.*importsdestroy()andfinalize()for native resource cleanupIntegration (
jni_layer.cpp):register_natives_for_training(JNIEnv*)signature to receive env from callerusing namespace executorch::jni_helper;to fix undeclared identifier build errorTest plan
Code review and CodeQL security scan passed. The JNI layer changes follow the same patterns as PR #16553 which converts the other JNI layers. Full Android build/test requires NDK toolchain.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.