PaddlePaddle / Paddle-Lite

PaddlePaddle High Performance Deep Learning Inference Engine for Mobile and Edge (飞桨高性能深度学习端侧推理引擎)
https://www.paddlepaddle.org.cn/lite
Apache License 2.0
6.89k stars 1.6k forks source link

npu demo error compilation.cc:75 ~Compilation device_context: No device found #8362

Closed 2050airobert closed 5 months ago

2050airobert commented 2 years ago

“ /Volumes/Android/buildbot/src/android/ndk-release-r17/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type nnadapter::logging::NNAdapterException: NNAdapter C++ Exception: [F 1/ 1 15: 8:50.155 ...adapter/nnadapter/runtime/compilation.cc:75 ~Compilation] Check failed: device_context: No device found. " failed Aborted”

paddle-bot-old[bot] commented 2 years ago

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网文档常见问题历史Issue来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQ and Github Issue to get the answer.Have a nice day!

hong19860320 commented 2 years ago

能在执行前加上 export GLOG_v=5 然后执行./run_with_adb.sh ... >log.txt 2>&1 把生成的完整log文件上传上来吗?

hong19860320 commented 2 years ago

看起来需要npu driver 为 6.4.4.3版本的,我看是不是可以提供一个6.4.4.3版本的galcore.ko 给你试试。

image

hong19860320 commented 2 years ago

@yingshengBD 提供一下6.4.4.3的A311D的android 版本的galcore.ko吧

2050airobert commented 2 years ago

hi, 我的开发板是a311d amlogic 。 galcore.ko是amlogic_npu的driver吗? 我在官方docker镜像下找到了PaddleLite-generic-demo/libs/PaddleLite/linux/arm64/lib/amlogic_npu/galcore.ko, 但是我的配置是android/armeabi-v7a/lib/amlogic_npu/,这个目录下并没有galcore.ko 我的手机开发板android 9 (linux 4. 9 )自带一个galccore.ko ; 在/vendor/lib/modules/galcore.ko 是需要贵司提供相应的galcore.ko,我这边加载到开发板才能正常使用npu对吗?大概什么时候可以提供下呢?多谢

BR

------------------ 原始邮件 ------------------ 发件人: "PaddlePaddle/Paddle-Lite" @.>; 发送时间: 2022年1月27日(星期四) 上午9:51 @.>; @.**@.>; 主题: Re: [PaddlePaddle/Paddle-Lite] 晶晨amlogic a311d运行 npu demo 报错compilation.cc:75 ~Compilation device_context: No device found (Issue #8362)

@yingshengBD 提供一下6.4.4.3的A311D的android 版本的galcore.ko吧

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

yingshengBD commented 2 years ago

首先,目前我们支持的是linux的A311D和C308;Android的S905D3。 其次,Galcore驱动是6.4.4.3版本。 当前我们正在联系Amlogic的开发同事提供6.4.4.3的Android A311D的驱动。 最后,请问你用的是什么开发板呢?

2050airobert commented 2 years ago

您是说amlogic a311d 和 s905D3 c308的 NPU sdk是贵司开发的,而底层的Android A311D的驱动是需要amlogic开发提供的。 那Amlogic提供6.4.4.3的Android A311D的驱动目前已经开发好了,还是没有ready,其实如果内测通过,也可以发下初步版本给我们临时用, 当然最好是能给下release的最终版本。 我们的板子是PM提供的,需要跟他确认下,您是怕这个问题跟板子有关系吗?

------------------ 原始邮件 ------------------ 发件人: "PaddlePaddle/Paddle-Lite" @.>; 发送时间: 2022年1月27日(星期四) 上午10:53 @.>; @.**@.>; 主题: Re: [PaddlePaddle/Paddle-Lite] 晶晨amlogic a311d运行 npu demo 报错compilation.cc:75 ~Compilation device_context: No device found (Issue #8362)

首先,目前我们支持的是linux的A311D和C308;Android的S905D3。 其次,Galcore驱动是6.4.4.3版本。 当前我们正在联系Amlogic的开发同事提供6.4.4.3的Android A311D的驱动。 最后,请问你用的是什么开发板呢?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

yingshengBD commented 2 years ago

Android A311D理论上是已经开发完毕 但没有经过完整的测试验证。 NPU驱动是由晶晨提供,理论上用户买了开发板就可以问卖家要各种版本驱动,但考虑到用户体验,我们正在考虑由我们Paddle Lite统一出口指定版本的驱动。 问具体的开发板厂商是想收集市面情况,方便我们后续做支持方面的调整

yingshengBD commented 2 years ago

鉴于算子支持广度的考虑,我们建议使用https://paddle-lite.readthedocs.io/zh/develop/demo_guides/verisilicon_timvx.html,这个方法接入amlogic A311D,当前已经更新demo:PaddleLite-generic-demo.tar.gz,其中依赖库都在/PaddleLite-generic-demo/libs/PaddleLite/android/armeabi-v7a/lib/verisilicon_timvx目录下。

图片

如上图注意其中两点: 1,galcore.ko.A311D就是Android A311D的Linux 内核驱动,拷贝到开发板后通过insmod命令加载内核驱动(可能需要root权限,可以通过adb root 和 adb remount 分别获得root权限和重新挂载具备可写权限) 2,有三个XXXXBinary.so默认软链接是Android S905D3 NPU SDK 相关库,你需要把软链接修改为XXXXBinary.so.A311D;或者干脆删掉软链接并把XXXXBinary.so.A311D改成XXXXBinary.so 如此,已经经过简单测试,你可以用起来。

2050airobert commented 2 years ago

Hi, Following your advice, there is some error with attachment named "log_2.txt". Is there any wrong? I just copied all the .so file needed to the right place instead of the old so lib.
(用galcore.ko.A311D替换了/vendor/lib/module/galcore.ko, verisilicon_timvx中的其他so都按照run_with_adb.txt脚本拷贝到安卓手机侧,正常运行demo with MODEL_NAME=mobilenet_v1_int8_224_per_layer) log信息见附件,请查收,多谢

------------------ 原始邮件 ------------------ 发件人: "PaddlePaddle/Paddle-Lite" @.>; 发送时间: 2022年1月27日(星期四) 晚上8:37 @.>; @.**@.>; 主题: Re: [PaddlePaddle/Paddle-Lite] 晶晨amlogic a311d运行 npu demo 报错compilation.cc:75 ~Compilation device_context: No device found (Issue #8362)

2050airobert commented 2 years ago

1、是不是可能因为只是贵司内部简单测试,所以还有些地方没有调试完善,导致的问题呢? 2、另外还有个问题,对于amlogic a311d的maili G52 GPU现在,可以支持跑网络模型了吗? 有相应demo提供吗?

yingshengBD commented 2 years ago

还是看不到你的log_2.txt,galcore.ko和三个Binary.so都需要替换。

2050airobert commented 2 years ago

那三个Binary.so 我都替换了,跟其他so拷贝的是同一目录下,同时加上环境变量 ------------------ 原始邮件 ------------------ 发件人: "PaddlePaddle/Paddle-Lite" @.>; 发送时间: 2022年1月28日(星期五) 下午2:24 @.>; @.**@.>; 主题: Re: [PaddlePaddle/Paddle-Lite] 晶晨amlogic a311d运行 npu demo 报错compilation.cc:75 ~Compilation device_context: No device found (Issue #8362)

还是看不到你的log_2.txt,galcore.ko和三个Binary.so都需要替换。

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

yingshengBD commented 2 years ago

看不到,你直接收集信息截图吧, dmesg | grep Galcore env uname -a 把运行的命令截图 然后把运行demo报错的地方也截图

2050airobert commented 2 years ago

这次收到附件了吗? 

我替换和加载galcore.ko文件方式如下:(不能insmod) 1|w400:/data/local/tmp/test # insmod /vendor/lib/modules/galcore.ko insmod: failed to load /vendor/lib/modules/galcore.ko: Exec format error

------------------ 原始邮件 ------------------ 发件人: "PaddlePaddle/Paddle-Lite" @.>; 发送时间: 2022年1月28日(星期五) 下午2:37 @.>; @.**@.>; 主题: Re: [PaddlePaddle/Paddle-Lite] 晶晨amlogic a311d运行 npu demo 报错compilation.cc:75 ~Compilation device_context: No device found (Issue #8362)

看不到,你直接收集信息截图吧, dmesg | grep Galcore env uname -a 把运行的命令截图 然后把运行demo报错的地方也截图

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

yingshengBD commented 2 years ago

原来如此 那是galcore加载就失败了,那后面就不用看了。 这种情况与开发板的系统内核有关,我们提供的galcore是一般开发板通用的(大部分khadas、荣品、晶晨官方实验板),确实有部分开发板使用不了。 这种情况,只好联系你们的开发板的卖家,问他要一个6.4.4.3的galcore.ko。这个版本是非常通用的版本,他们一定会有

yingshengBD commented 2 years ago

所以还是建议你这边确认一下 是什么厂家的开发板 我们也好对其galcore做个记录

2050airobert commented 2 years ago

      好的,我去联系并确认下。       您说的这个A311 linux版本指的是 ubuntu吗?还是?

------------------ 原始邮件 ------------------ 发件人: "PaddlePaddle/Paddle-Lite" @.>; 发送时间: 2022年1月27日(星期四) 上午10:53 @.>; @.**@.>; 主题: Re: [PaddlePaddle/Paddle-Lite] 晶晨amlogic a311d运行 npu demo 报错compilation.cc:75 ~Compilation device_context: No device found (Issue #8362)

首先,目前我们支持的是linux的A311D和C308;Android的S905D3。 其次,Galcore驱动是6.4.4.3版本。 当前我们正在联系Amlogic的开发同事提供6.4.4.3的Android A311D的驱动。 最后,请问你用的是什么开发板呢?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

yingshengBD commented 2 years ago

ubuntu的,但是你这个情况不一定是换系统可以解决了, 可以这么理解:同样A311D,理论上每家开发板都有各自的galcore.ko,应该不同的开发板和galcore.ko一一对应,我们在demo中提供的galcore.ko只是部分开发板能用的。 这个驱动直接关乎能否调用下层npu算力。

2050airobert commented 2 years ago

1、您看了log了吗?确认没有其他异常或者不完善的地方吧? 2、paddlelite官方支持gpu 包括mali gpu,是支持几乎所有厂商的或者开发板的maili gpu吗?     目前针对amlogic 厂商,可以支持哪些系统哪些型号(a311d)等配置,有list吗?

------------------ 原始邮件 ------------------ 发件人: "PaddlePaddle/Paddle-Lite" @.>; 发送时间: 2022年1月28日(星期五) 下午2:57 @.>; @.**@.>; 主题: Re: [PaddlePaddle/Paddle-Lite] 晶晨amlogic a311d运行 npu demo 报错compilation.cc:75 ~Compilation device_context: No device found (Issue #8362)

原来如此 那是galcore加载就失败了,那后面就不用看了。 这种情况与开发板的系统内核有关,我们提供的galcore是一般开发板通用的(大部分khadas、荣品、晶晨官方实验板),确实有部分开发板使用不了。 这种情况,只好联系你们的开发板的卖家,问他要一个6.4.4.3的galcore.ko。这个版本是非常通用的版本,他们一定会有

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

yingshengBD commented 2 years ago

1,目前为止我没有看到你的log附件,现在驱动加载不了,后面的任何错误都没有意义 2,mali GPU参考文档https://paddle-lite.readthedocs.io/zh/develop/demo_guides/opencl.html,只要支持OpenCL就能用 3,目前支持的amlogic型号全部列在文档里,当然用TIM-VX也是一样,目前我们更建议用后者 图片

yingshengBD commented 2 years ago

如果你要用NPU算力且有条件更换硬件,我个人建议 可以考虑khadas VIM3或者VIM3L,这两者出厂就是6.4.4.3都不用换驱动,这都是我们的实验环境。荣品也可以。

2050airobert commented 2 years ago

您再查收下吧,附件

------------------ 原始邮件 ------------------ 发件人: "PaddlePaddle/Paddle-Lite" @.>; 发送时间: 2022年1月28日(星期五) 下午5:35 @.>; @.**@.>; 主题: Re: [PaddlePaddle/Paddle-Lite] 晶晨amlogic a311d运行 npu demo 报错compilation.cc:75 ~Compilation device_context: No device found (Issue #8362)

如果你要用NPU算力且有条件更换硬件,我个人建议 可以考虑khadas VIM3或者VIM3L,这两者出厂就是6.4.4.3都不用换驱动,这都是我们的实验环境。荣品也可以。

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

从QQ邮箱发来的超大附件

log_all.rar (236.7K, 无限期)进入下载页面:http://mail.qq.com/cgi-bin/ftnExs_download?k=213464652e289a990391ff7a1f655449580c50505a0453514c00555d5c4852525802495d0e03574b52035657080400535502535d396e660a0e533b045509481400466458&t=exs_ftn_download&code=a4de9eff

yingshengBD commented 2 years ago

OK现在可以看到了,我发现你的系统是64位的armv8 Android,而我们现在手头上提供的都是armv7 32位的驱动,所以你的加载报错是insmod: failed to load /vendor/lib/modules/galcore.ko: Exec format error。 我这边需要联系晶晨的开发人员提供,由于临近假期他们好多人也开始休假。 同时就算晶晨官方给我们提供了驱动,也可能存在系统内核的差异导致的驱动不可用,所以我们建议最好是能有开发板厂家提供给你这个驱动,但不妨试试、 为了更好跟进你这个问题,你可以加paddlelite推理部署的QQ群和微信群找我私聊,我的在各个交流群内ID是PP_yingsheng