tensorflow: [TFLite] Failed to create Hexagon delegate on Oneplus 5
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Pop Os 18.04
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: Oneplus 5
- TensorFlow installed from (source or binary): Binary
- TensorFlow version (use command below): 2.2
- Python version: 3.7
Describe the current behavior
Device Information -
adb shell getprop ro.product.device
OnePlus5
adb shell getprop ro.board.platform
msm8998
($APP_ROOT)/app/src/main/jniLibs
├── arm64-v8a
│ ├── libhexagon_nn_skel.so
│ ├── libhexagon_nn_skel_v65.so
│ └── libhexagon_nn_skel_v66.so
└── armeabi-v7a
├── libhexagon_nn_skel.so
├── libhexagon_nn_skel_v65.so
└── libhexagon_nn_skel_v66.so
($APP_ROOT)/app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.sr_tflite"
minSdkVersion 25
targetSdkVersion 29
versionCode 1
versionName "1.0"
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
aaptOptions {
noCompress "tflite"
}
}
// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
def tfl_version = "0.0.0-nightly"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment-ktx:2.0.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.0.0'
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly'
implementation 'org.tensorflow:tensorflow-lite-hexagon:0.0.0-nightly'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation("org.tensorflow:tensorflow-lite:${tfl_version}") { changing = true }
implementation("org.tensorflow:tensorflow-lite-gpu:${tfl_version}") { changing = true }
implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly'
}
I followed the TensorFlow Lite Hexagon delegate guide on Oneplus 5. Tensorflow Lite was failed to create Hexagon delegate.
Log
020-05-14 16:26:19.906 27848-27848/com.example.sr_tflite I/System.out: *******/data/app/com.example.sr_tflite-WR6XEFKEipjZ_vWQYv9MSQ==/lib/arm64
2020-05-14 16:26:19.947 27848-27848/com.example.sr_tflite V/com.example.sr_tflite: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1859: Successfully created user PD on domain 0 (attrs 0x0)
2020-05-14 16:26:19.960 27848-28029/com.example.sr_tflite V/com.example.sr_tflite: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:270: rpc latency thread start
2020-05-14 16:26:19.961 27848-28027/com.example.sr_tflite E/com.example.sr_tflite: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/apps_std_imp.c:729:Error 45: fopen failed for oemconfig.so. (No such file or directory)
2020-05-14 16:26:19.961 27848-28027/com.example.sr_tflite E/com.example.sr_tflite: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/apps_std_imp.c:729:Error 45: fopen failed for libhexagon_nn_skel.so. (No such file or directory)
2020-05-14 16:26:19.961 27848-27848/com.example.sr_tflite D/com.example.sr_tflite: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:983: Error fffffffb: remote handle open domain failed. domain 0, name file:///libhexagon_nn_skel.so?hexagon_nn_domains_skel_handle_invoke&_modver=1.0&_dom=adsp, dlerror cannot open oemconfig.so
2020-05-14 16:26:19.961 27848-27848/com.example.sr_tflite D/com.example.sr_tflite: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:920: Error ffffffff: remote handle invoke failed. domain 0, handle 0, sc 1010200, pra 0x7fde45af88
2020-05-14 16:26:19.961 27848-27848/com.example.sr_tflite D/com.example.sr_tflite: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1034: Error ffffffff: remote handle close failed. error
2020-05-14 16:26:19.961 27848-27848/com.example.sr_tflite D/com.example.sr_tflite: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1020: Error fffffffb: remote handle64 open failed. name file:///libhexagon_nn_skel.so?hexagon_nn_domains_skel_handle_invoke&_modver=1.0&_dom=adsp
2020-05-14 16:26:19.961 27848-27848/com.example.sr_tflite W/tflite: Failed to fetch Hexagon NN version. This might be because you're using incompatible versions of libhexagon_interface and libhexagon_nn_skel. You must use compatible versions. Refer to Tensorflow Lite Hexagon Delegate Guide.
2020-05-14 16:26:19.961 27848-27848/com.example.sr_tflite I/tflite: Hexagon Delegate is not supported.
2020-05-14 16:26:19.962 27848-27848/com.example.sr_tflite D/AndroidRuntime: Shutting down VM
2020-05-14 16:26:19.966 27848-27848/com.example.sr_tflite E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sr_tflite, PID: 27848
java.lang.UnsupportedOperationException: This Device doesn't support Hexagon DSP execution.
at org.tensorflow.lite.experimental.HexagonDelegate.<init>(HexagonDelegate.java:40)
at com.example.sr_tflite_1.MainActivity$onCreate$1.onClick(MainActivity.kt:97)
at android.view.View.performClick(View.java:6669)
at android.view.View.performClickInternal(View.java:6638)
at android.view.View.access$3100(View.java:789)
at android.view.View$PerformClick.run(View.java:26145)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2020-05-14 16:26:19.977 27848-28030/com.example.sr_tflite D/OSTracker: OS Event: crash
2020-05-14 16:26:19.995 27848-27848/com.example.sr_tflite I/Process: Sending signal. PID: 27848 SIG: 9
I have downloaded the latest hexagon_nn_skel.run (v1.17) from the page but it still says Failed to fetch Hexagon NN version. This might be because you're using incompatible versions of libhexagon_interface and libhexagon_nn_skel. You must use compatible versions. Refer to Tensorflow Lite Hexagon Delegate Guide. 2020-05-14 16:26:19.961 27848-27848/com.example.sr_tflite I/tflite: Hexagon Delegate is not supported.
Do i need to pull some other so files from somewhere else or my device is not supported.
Thanks
Describe the expected behavior
The DSP delegate should be initialized as my SoC is in the list of supported hardwares.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 28 (9 by maintainers)
I’m using the QNP/SNPE SDK directly but I see the same problem. But I found a solution.
If I set minSdkVersion <= 22, DSP works fine.
But if I set minSdkVersion>=23, I get
And I cannot use the DSP. Only CPU and GPU delegates.
Either this has something to do with the android.bundle.enableUncompressedNativeLibs thing added to Gradle or the way dlopen is handled in sdkVersion >= 23
https://developer.android.com/about/versions/marshmallow/android-6.0-changes