Tencent / TNN

TNN: developed by Tencent Youtu Lab and Guangying Lab, a uniform deep learning inference framework for mobile、desktop and server. TNN is distinguished by several outstanding features, including its cross-platform capability, high performance, model compression and code pruning. Based on ncnn and Rapidnet, TNN further strengthens the support and performance optimization for mobile devices, and also draws on the advantages of good extensibility and high performance from existed open source efforts. TNN has been deployed in multiple Apps from Tencent, such as Mobile QQ, Weishi, Pitu, etc. Contributions are welcome to work in collaborative with us and make TNN a better framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

android target升级到31、33 后(target30及以下gpu正常),无法使用gpu模式。cpu 模式使用正常。 compileSdkVersion 33 buildToolsVersion "30.0.3" ndkVersion '20.1.5948944' defaultConfig { minSdkVersion 15 targetSdkVersion 33 机型:红米note12T、k60

cq186 opened this issue · comments

commented

1. 环境(environment)

  • Build OS and Version:Windows
  • RunTime OS Version:/Android/
  • RunTime DEVICE: OPENCL

5. 详细描述bug 情况 (Describe the bug)
android target升级到31、33 后,无法使用gpu。cpu 模式使用正常

6. 运行日志(runtime log)
2023-08-29 00:04:05.326 22586-22586 tnn com.tencent.tnn.demo I jint Java_com_tencent_tnn_demo_ObjectDetector_init(JNIEnv *, jobject, jstring, jint, jint, jfloat, jfloat, jint, jint) [File E:\xmatting\tnn\examples\android\demo\src\main\jni\cc\objectdetector_jni.cc][Line 36] proto content size 10348 model content size 29849719
2023-08-29 00:04:05.333 22586-22586 tnn com.tencent.tnn.demo I jint Java_com_tencent_tnn_demo_ObjectDetector_init(JNIEnv *, jobject, jstring, jint, jint, jfloat, jfloat, jint, jint) [File E:\xmatting\tnn\examples\android\demo\src\main\jni\cc\objectdetector_jni.cc][Line 45] the device type 1 device huawei_npu
2023-08-29 00:04:05.713 22586-22586 tnn com.tencent.tnn.demo E virtual tnn::Status tnn::TNNSDKSample::Init(std::shared_ptr) [File E:\xmatting\tnn\examples\base\tnn_sdk_sample.cc][Line 695] inittnn: 4096 ,cache:, libraray:
2023-08-29 00:04:05.739 22586-22586 tnn com.tencent.tnn.demo I tnn::Status tnn::OpenCLRuntime::Init() [File cl\opencl_runtime.cc][Line 124] OpenCL version: CL_TARGET_OPENCL_VERSION 200 CL_HPP_TARGET_OPENCL_VERSION 120 CL_HPP_MINIMUM_OPENCL_VERSION 110
2023-08-29 00:04:05.743 22586-22586 linker com.tencent.tnn.demo E library "/system/vendor/lib64/libOpenCL.so" ("/vendor/lib64/libOpenCL.so") needed or dlopened by "/data/app/~~mHbWpQpE9UIOuHhdNMApyA==/com.tencent.tnn.demo-rMPdy3sKQIPbA8ga49akMA==/lib/arm64/libtnn_wrapper.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/~~mHbWpQpE9UIOuHhdNMApyA==/com.tencent.tnn.demo-rMPdy3sKQIPbA8ga49akMA==/lib/arm64:/data/app/~~mHbWpQpE9UIOuHhdNMApyA==/com.tencent.tnn.demo-rMPdy3sKQIPbA8ga49akMA==/base.apk!/lib/arm64-v8a", permitted_paths="/data:/mnt/expand:/data/data/com.tencent.tnn.demo"]
2023-08-29 00:04:05.744 22586-22586 tnn com.tencent.tnn.demo E tnn::Status tnn::OpenCLContext::Init() [File cl\opencl_context.cc][Line 277] OpenCL Runtime Init() failed (ret = 36865)!
2023-08-29 00:04:05.745 22586-22586 tnn com.tencent.tnn.demo E virtual tnn::Status tnn::TNNSDKSample::Init(std::shared_ptr) [File E:\xmatting\tnn\examples\base\tnn_sdk_sample.cc][Line 720] 2222222:0 status:36865 instance:0
2023-08-29 00:04:05.745 22586-22586 tnn com.tencent.tnn.demo E virtual tnn::Status tnn::TNNSDKSample::Init(std::shared_ptr) [File E:\xmatting\tnn\examples\base\tnn_sdk_sample.cc][Line 723] result:>>>>>>>> :256
2023-08-29 00:04:05.745 22586-22586 tnn com.tencent.tnn.demo E virtual tnn::Status tnn::TNNSDKSample::Init(std::shared_ptr) [File E:\xmatting\tnn\examples\base\tnn_sdk_sample.cc][Line 727] *Warning
2023-08-29 00:04:05.745 22586-22586 tnn com.tencent.tnn.demo E virtual tnn::Status tnn::TNNSDKSample::Init(std::shared_ptr) [File E:\xmatting\tnn\examples\base\tnn_sdk_sample.cc][Line 728] CreateInst failed for compute unit (256), automatically try cpu now

7. 截图(Screenshots)

![image](https://github.com/Tencent/TNN/assets/6063018/5de2187d-b1fe-4162-a5d1-69a7cd97ab09)

![image](https://github.com/Tencent/TNN/assets/6063018/a310b851-7d38-48a4-9201-ea883de0d046)
Paste screenshorts here or pastebin

AndroidManifest.xml里面添加
<uses-native-library android:name="libOpenCL.so" android:required="false" />

https://developer.android.google.cn/guide/topics/manifest/uses-native-library-element?hl=zh-cn