TNN
TNN copied to clipboard
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
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<TNNSDKOption>) [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<TNNSDKOption>) [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<TNNSDKOption>) [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<TNNSDKOption>) [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<TNNSDKOption>) [File E:\xmatting\tnn\examples\base\tnn_sdk_sample.cc][Line 728] CreateInst failed for compute unit (256), automatically try cpu now
7. 截图(Screenshots)


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