MNN icon indicating copy to clipboard operation
MNN copied to clipboard

Huawei Nova 7 运行 NPU 出错

Open xiaoguoer opened this issue 2 years ago • 3 comments

Platform:

手机 : 华为 Nova 7

Compiling Method

按照MNN-NPU使用说明进行编译。

CPU,GPU(opencl) 运行都没问题,NPU运行出问题。 定位到 NPUReduction.cpp 中 onresize函数 的 origAxis.push_back(reduce_dim[i]); 这句话。 上下文是: for (int i = 0; i < inputs[1]->length(0);++i) { int32_t *reduce_dim = inputs[1]->host<int32_t>(); origAxis.push_back(reduce_dim[i]); } 其中 int32_t *reduce_dim = inputs[1]->host<int32_t>(); 应该是取出 inputs[1] 这个tensor在host端的数据,但一写 reduce_dim[i] 就崩溃,求教是啥问题。

xiaoguoer avatar Jul 03 '22 07:07 xiaoguoer

模型方便发一下?

jxt1234 avatar Jul 05 '22 06:07 jxt1234

@jxt1234

1、就是使用了MNN demo里的模型 链接:https://pan.baidu.com/s/1-M4iNsJa75kTt47QUW3Jgg?pwd=jceg 提取码:jceg

这里面的两个模型都是相同的错误。

2、我也尝试跳过这句话(先不管预测结果对不对,将 origAxis.push_back(reduce_dim[i]); 这句话直接改成 origAxis.push_back(1);)。 随后发现,NPUbackend 的 onResizeEnd 会出错。

I/aiclient: HIAI_GetVersion_Config ERROR __system_property_get <= 0
I/aiclient: success
I/HIAI_IR_BUILD: Version is greater than and equal to 100.320.010.012, use createV2.
I/aiclient: HIAI_MemBuffer_create_from_size [ok]
I/aiclient: HIAI_GetVersion_Config ERROR __system_property_get <= 0
I/aiclient: success
I/HIAI_IR_BUILD: HIAI get RomVersion:100.335.020.100
E/HIAI_IR_BUILD: DequantizeIRGraph success.
I/aiclient: AiModelManagerImpl::CreateInstanceID create instance id: 0
I/aiclient: AiModelManagerImpl::Register: clientID:0x78e2f02d50(sync), total client num:1
I/aiclient: success
I/aiclient: Create model manager client successed!
I/aiclient: AiModelManagerClient: Create model manager client successed!
I/AIModelManagerClientHIDL: Init(149)::"AIModelManagerClientHIDL Init"
W/nclassification: type=1400 audit(0.0:7168600): avc: denied { open } for pid=12594 path="/dev/ashmem" dev="tmpfs" ino=4315 scontext=u:r:untrusted_app:s0:c172,c256,c512,c768 tcontext=u:object_r:ashmem_device:s0 tclass=chr_file permissive=0
I/aiclient: CreateAshmemFd done, name: handle_wrap_buffer, size: 14012930, fd: 92
I/aiclient: ModelBufferWrapper::createFromModelBuf [ok]
I/aiclient: ModelBufferWrapper::ModelBufferWrapper
I/aiclient: ModelBufferWrapper::getModelBuf
W/nclassification: type=1400 audit(0.0:7168601): avc: denied { open } for pid=12594 path="/dev/ashmem" dev="tmpfs" ino=4315 scontext=u:r:untrusted_app:s0:c172,c256,c512,c768 tcontext=u:object_r:ashmem_device:s0 tclass=chr_file permissive=0
I/aiclient: CreateAshmemFd done, name: handle_wrap_buffer, size: 209715200, fd: 94
I/aiclient: ModelBufferWrapper::Create [ok]
I/aiclient: ModelBufferWrapper::ModelBufferWrapper
I/aiclient: ModelBufferWrapper::getModelBuf
E/AIModelManagerClientHIDL: BuildModel(777)::"AIModelManagerClientHIDL Build model failed!"
E/aiclient: HIAI_ModelManager_buildModel Build model failed!
I/aiclient: AiModelManagerClient: Delete model manager client successed!
I/aiclient: Delete model manager client!
I/AIModelManagerClientHIDL: ~AIMODELHIDLListener(64)::"Destroy the AIMODELHIDLListener"
I/aiclient: AiModelManagerImpl::Unregister: clientID:0x78e2f02d50, total client num:0
I/aiclient: AiModelManagerImpl::DeInit no client using, client impl DeInit
I/aiclient: success
E/HIAI_IR_BUILD: BuildModelOnline build failed.
I/HCL_INTERFACE: HclItfObj has been inited
I/aiclient: AiModelManagerImpl::CreateInstanceID create instance id: 0
I/aiclient: AiModelManagerImpl::Register: clientID:0x78e2f02d30(sync), total client num:1
I/aiclient: success
I/jni/hiai_om: try calling HIAI_OM_EventListener_Create
E/jni/hiai_om: dlsym(HIAI_OM_EventListener_Create) failed: (null)
I/HCL_INTERFACE: HclItfObj has been inited
E/HIAI_DDK_MSG: InputMemBufferCreate error: invalid parameters
I/HIAI_DDK_MSG: Model manager client destructor calls unload model
I/aiclient: ret[0].
I/HIAI_DDK_MSG: ModelManagerClientImplLegacy::UnLoad taskStamp = 0
I/HIAI_DDK_MSG: Model manager client destructor calls destroy model manager
I/aiclient: AiModelManagerImpl::Unregister: clientID:0x78e2f02d30, total client num:0
I/aiclient: AiModelManagerImpl::DeInit no client using, client impl DeInit
I/aiclient: success
D/ActivityThread: add activity client record, r= ActivityRecord{dc9054e token=android.os.BinderProxy@624428c {com.yeyupiaoling.mnnclassification/com.yeyupiaoling.mnnclassification.MainActivity}} token= android.os.BinderProxy@624428c
D/MouseWheelSynthesizer: mMoveStepInDp: 64, mMoveStepInPixel: 192, mUpTimeDelayed: 100
D/ViewRootImpl: ViewRootImpl mIsInProductivePCDisplay: false
I/HwPartPowerOfficeFactory: add HwPartPowerOfficeFactoryImpl to memory.
D/InputEventReceiver: dispatchInputInterval 1000000
D/MouseWheelSynthesizer: mMoveStepInDp: 64, mMoveStepInPixel: 192, mUpTimeDelayed: 100
D/ViewRootImpl: ViewRootImpl mIsInProductivePCDisplay: false
D/InputEventReceiver: dispatchInputInterval 1000000
D/HiTouch_PressGestureDetector: onAttached, package=com.yeyupiaoling.mnnclassification, windowType=1, mIsHiTouchRestricted=false
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
W/Gralloc3: mapper 3.x is not supported
I/RmeSchedManager: init Rme, version is: v1.0
I/RtgSchedEvent: current pid:12594 AppType:-1
I/RmeSchedManager: init Rme, version is: v1.0
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/OpenGLRenderer: disableOutlineDraw is true
D/OpenGLRenderer: disableOutlineDraw is true
D/DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
W/InputMethodManager: startInputReason = 1
W/HwRemoteInputMethodManager: isCasting false because IHwDistributedWindowManager is invalid.
W/InputMethodManager: startInputReason = 5
D/ZrHung.AppEyeUiProbe: not watching, wait.
I/ViewRootImpl: dispatchDetachedFromWindow in doDie
W/libEGL: EGLNativeWindowType 0x7947228810 disconnect failed
I/AwareBitmapCacher: init lrucache size: 2097152 pid=12594
W/libEGL: EGLNativeWindowType 0x7947228450 disconnect failed
D/ActivityThread: Won't deliver top position change in state=2
E/RtgSchedManager: endActivityTransaction: margin state not match
D/ZrHung.AppEyeUiProbe: restart watching
E/RtgSchedManager: endActivityTransaction: margin state not match
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
I/RmeSchedManager: init Rme, version is: v1.0
I/RtgSchedEvent: current pid:12594 AppType:-1
I/Hwaps: APS: EventAnalyzed: initAPS: version is 11.0.0.4
D/Hwaps: Fpsrequest create,type:EXACTLY_IDENTIFY
D/Hwaps: Fpsrequest create,type:EXACTLY_IDENTIFY
D/Hwaps: Fpsrequest create,type:OPENGL_SETTING
D/Hwaps: FpsController create
D/Hwaps: APS: EventAnalyzed: reInitFpsPara :mBaseFps = 60; mMaxFps = 60
W/Settings: Setting device_provisioned has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
V/HiTouch_HiTouchSensor: User setup is finished.
I/HwViewRootImpl: removeInvalidNode jank list is null
W/HwApsManager: HwApsManagerService, registerCallback, start !
D/Hwaps: APS: EventAnalyzed: registerCallbackInApsManagerService, mPkgName:com.yeyupiaoling.mnnclassification; result = true
V/AudioManager: querySoundEffectsEnabled...
D/DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true
I/RmeSchedManager: init Rme, version is: v1.0
W/libEGL: EGLNativeWindowType 0x7947228450 disconnect failed
D/ZrHung.AppEyeUiProbe: not watching, wait.
D/ActivityThread: Won't deliver top position change in state=5
I/StubController: system app validUid:10172, isFriend:true
D/image_path :: /storage/emulated/0/DCIM/Camera/IMG_20220619_112332.jpg
D/HwGalleryCacheManagerImpl: mIsEffect:false
A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 12594 (nclassification), pid 12594 (nclassification)

其中:

E/AIModelManagerClientHIDL: BuildModel(777)::"AIModelManagerClientHIDL Build model failed!"
E/aiclient: HIAI_ModelManager_buildModel Build model failed!

是在 NPUbackend 的 onResizeEnd 中调用的 bulidIRModelAndLoad bool buildIRSuc = ir_build.BuildIRModel(model, om_model_buff); 出错了。

xiaoguoer avatar Jul 05 '22 11:07 xiaoguoer

随手跑了一个 Lenet-5,发现跑通了。

xiaoguoer avatar Jul 05 '22 12:07 xiaoguoer

@jxt1234

1、就是使用了MNN demo里的模型 链接:https://pan.baidu.com/s/1-M4iNsJa75kTt47QUW3Jgg?pwd=jceg 提取码:jceg

这里面的两个模型都是相同的错误。

2、我也尝试跳过这句话(先不管预测结果对不对,将 origAxis.push_back(reduce_dim[i]); 这句话直接改成 origAxis.push_back(1);)。 随后发现,NPUbackend 的 onResizeEnd 会出错。

I/aiclient: HIAI_GetVersion_Config ERROR __system_property_get <= 0
I/aiclient: success
I/HIAI_IR_BUILD: Version is greater than and equal to 100.320.010.012, use createV2.
I/aiclient: HIAI_MemBuffer_create_from_size [ok]
I/aiclient: HIAI_GetVersion_Config ERROR __system_property_get <= 0
I/aiclient: success
I/HIAI_IR_BUILD: HIAI get RomVersion:100.335.020.100
E/HIAI_IR_BUILD: DequantizeIRGraph success.
I/aiclient: AiModelManagerImpl::CreateInstanceID create instance id: 0
I/aiclient: AiModelManagerImpl::Register: clientID:0x78e2f02d50(sync), total client num:1
I/aiclient: success
I/aiclient: Create model manager client successed!
I/aiclient: AiModelManagerClient: Create model manager client successed!
I/AIModelManagerClientHIDL: Init(149)::"AIModelManagerClientHIDL Init"
W/nclassification: type=1400 audit(0.0:7168600): avc: denied { open } for pid=12594 path="/dev/ashmem" dev="tmpfs" ino=4315 scontext=u:r:untrusted_app:s0:c172,c256,c512,c768 tcontext=u:object_r:ashmem_device:s0 tclass=chr_file permissive=0
I/aiclient: CreateAshmemFd done, name: handle_wrap_buffer, size: 14012930, fd: 92
I/aiclient: ModelBufferWrapper::createFromModelBuf [ok]
I/aiclient: ModelBufferWrapper::ModelBufferWrapper
I/aiclient: ModelBufferWrapper::getModelBuf
W/nclassification: type=1400 audit(0.0:7168601): avc: denied { open } for pid=12594 path="/dev/ashmem" dev="tmpfs" ino=4315 scontext=u:r:untrusted_app:s0:c172,c256,c512,c768 tcontext=u:object_r:ashmem_device:s0 tclass=chr_file permissive=0
I/aiclient: CreateAshmemFd done, name: handle_wrap_buffer, size: 209715200, fd: 94
I/aiclient: ModelBufferWrapper::Create [ok]
I/aiclient: ModelBufferWrapper::ModelBufferWrapper
I/aiclient: ModelBufferWrapper::getModelBuf
E/AIModelManagerClientHIDL: BuildModel(777)::"AIModelManagerClientHIDL Build model failed!"
E/aiclient: HIAI_ModelManager_buildModel Build model failed!
I/aiclient: AiModelManagerClient: Delete model manager client successed!
I/aiclient: Delete model manager client!
I/AIModelManagerClientHIDL: ~AIMODELHIDLListener(64)::"Destroy the AIMODELHIDLListener"
I/aiclient: AiModelManagerImpl::Unregister: clientID:0x78e2f02d50, total client num:0
I/aiclient: AiModelManagerImpl::DeInit no client using, client impl DeInit
I/aiclient: success
E/HIAI_IR_BUILD: BuildModelOnline build failed.
I/HCL_INTERFACE: HclItfObj has been inited
I/aiclient: AiModelManagerImpl::CreateInstanceID create instance id: 0
I/aiclient: AiModelManagerImpl::Register: clientID:0x78e2f02d30(sync), total client num:1
I/aiclient: success
I/jni/hiai_om: try calling HIAI_OM_EventListener_Create
E/jni/hiai_om: dlsym(HIAI_OM_EventListener_Create) failed: (null)
I/HCL_INTERFACE: HclItfObj has been inited
E/HIAI_DDK_MSG: InputMemBufferCreate error: invalid parameters
I/HIAI_DDK_MSG: Model manager client destructor calls unload model
I/aiclient: ret[0].
I/HIAI_DDK_MSG: ModelManagerClientImplLegacy::UnLoad taskStamp = 0
I/HIAI_DDK_MSG: Model manager client destructor calls destroy model manager
I/aiclient: AiModelManagerImpl::Unregister: clientID:0x78e2f02d30, total client num:0
I/aiclient: AiModelManagerImpl::DeInit no client using, client impl DeInit
I/aiclient: success
D/ActivityThread: add activity client record, r= ActivityRecord{dc9054e token=android.os.BinderProxy@624428c {com.yeyupiaoling.mnnclassification/com.yeyupiaoling.mnnclassification.MainActivity}} token= android.os.BinderProxy@624428c
D/MouseWheelSynthesizer: mMoveStepInDp: 64, mMoveStepInPixel: 192, mUpTimeDelayed: 100
D/ViewRootImpl: ViewRootImpl mIsInProductivePCDisplay: false
I/HwPartPowerOfficeFactory: add HwPartPowerOfficeFactoryImpl to memory.
D/InputEventReceiver: dispatchInputInterval 1000000
D/MouseWheelSynthesizer: mMoveStepInDp: 64, mMoveStepInPixel: 192, mUpTimeDelayed: 100
D/ViewRootImpl: ViewRootImpl mIsInProductivePCDisplay: false
D/InputEventReceiver: dispatchInputInterval 1000000
D/HiTouch_PressGestureDetector: onAttached, package=com.yeyupiaoling.mnnclassification, windowType=1, mIsHiTouchRestricted=false
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
W/Gralloc3: mapper 3.x is not supported
I/RmeSchedManager: init Rme, version is: v1.0
I/RtgSchedEvent: current pid:12594 AppType:-1
I/RmeSchedManager: init Rme, version is: v1.0
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/OpenGLRenderer: disableOutlineDraw is true
D/OpenGLRenderer: disableOutlineDraw is true
D/DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
W/InputMethodManager: startInputReason = 1
W/HwRemoteInputMethodManager: isCasting false because IHwDistributedWindowManager is invalid.
W/InputMethodManager: startInputReason = 5
D/ZrHung.AppEyeUiProbe: not watching, wait.
I/ViewRootImpl: dispatchDetachedFromWindow in doDie
W/libEGL: EGLNativeWindowType 0x7947228810 disconnect failed
I/AwareBitmapCacher: init lrucache size: 2097152 pid=12594
W/libEGL: EGLNativeWindowType 0x7947228450 disconnect failed
D/ActivityThread: Won't deliver top position change in state=2
E/RtgSchedManager: endActivityTransaction: margin state not match
D/ZrHung.AppEyeUiProbe: restart watching
E/RtgSchedManager: endActivityTransaction: margin state not match
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
I/RmeSchedManager: init Rme, version is: v1.0
I/RtgSchedEvent: current pid:12594 AppType:-1
I/Hwaps: APS: EventAnalyzed: initAPS: version is 11.0.0.4
D/Hwaps: Fpsrequest create,type:EXACTLY_IDENTIFY
D/Hwaps: Fpsrequest create,type:EXACTLY_IDENTIFY
D/Hwaps: Fpsrequest create,type:OPENGL_SETTING
D/Hwaps: FpsController create
D/Hwaps: APS: EventAnalyzed: reInitFpsPara :mBaseFps = 60; mMaxFps = 60
W/Settings: Setting device_provisioned has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
V/HiTouch_HiTouchSensor: User setup is finished.
I/HwViewRootImpl: removeInvalidNode jank list is null
W/HwApsManager: HwApsManagerService, registerCallback, start !
D/Hwaps: APS: EventAnalyzed: registerCallbackInApsManagerService, mPkgName:com.yeyupiaoling.mnnclassification; result = true
V/AudioManager: querySoundEffectsEnabled...
D/DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true
I/RmeSchedManager: init Rme, version is: v1.0
W/libEGL: EGLNativeWindowType 0x7947228450 disconnect failed
D/ZrHung.AppEyeUiProbe: not watching, wait.
D/ActivityThread: Won't deliver top position change in state=5
I/StubController: system app validUid:10172, isFriend:true
D/image_path :: /storage/emulated/0/DCIM/Camera/IMG_20220619_112332.jpg
D/HwGalleryCacheManagerImpl: mIsEffect:false
A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 12594 (nclassification), pid 12594 (nclassification)

其中:

E/AIModelManagerClientHIDL: BuildModel(777)::"AIModelManagerClientHIDL Build model failed!"
E/aiclient: HIAI_ModelManager_buildModel Build model failed!

是在 NPUbackend 的 onResizeEnd 中调用的 bulidIRModelAndLoad bool buildIRSuc = ir_build.BuildIRModel(model, om_model_buff); 出错了。

有详细日志吗

yangshanjun avatar Oct 08 '22 01:10 yangshanjun