1.alloc mmz memory failed
报错如下
/mnt/sample # ./sample_nnie_main 0
[Level]:Debug,[Func]:SAMPLE_COMM_SVP_CheckSysInit [Line]:81 [Info]:Svp mpi init ok!
[Level]:Info,[Func]:SAMPLE_SVP_NNIE_FasterRcnmmz_userdev:ioctl_mmb_alloc: n [Line]:768 [Info]:FasterRcnn Load model!
[Func]:HI_MPI_SYS_MmzAlloc [Line]:888 [Info]:System alloc mmz memory failed!
[Level]:Error,[Func]:SAMPLE_COMM_SVP_NNIE_LoadModel [Line]:547 [Info]:Error(0xffffffff),Malloc memory failed!
[Level]:Error,[Func]:SAMPLE_SVP_NNIE_FasterRcnn [Line]:771 [Info]:Error,SAMPLE_COMM_SVP_NNIE_LoadModel failed!
[Level]:Debug,[Func]:SAMPLE_COMM_SVP_CheckSysExit [Line]:94 [Info]:Svp mpi exit ok!
原因 cat /proc/media-mem显示mmz剩余43M,而模型大小是59M,不够内存,需要修改mmz内存大小
/mnt/sample # cat /proc/media-mem
+---ZONE: PHYS(0x9E000000, 0x9FFFFFFF), GFP=1, nBYTES=32768KB, NAME="higo_mmz"
|-MMB: phys(0x9E000000, 0x9E000FFF), kvirt=0x00000000, flags=0x00000000, length=4KB, name="higo"
+---ZONE: PHYS(0x9D000000, 0x9DFFFFFF), GFP=0, nBYTES=16384KB, NAME="anonymous"
|-MMB: phys(0x9D000000, 0x9D01FFFF), kvirt=0x00000000, flags=0x00000000, length=128KB, name="TDE_MEMPOOL_MMB"
|-MMB: phys(0x9D020000, 0x9D414FFF), kvirt=0x00000000, flags=0x00000000, length=4052KB, name="hifb_layer0"
|-MMB: phys(0x9D415000, 0x9D424FFF), kvirt=0xC7450000, flags=0x00000001, length=64KB, name="HIFB COEF"
---MMZ_USE_INFO:
total size=49152KB(48MB),used=4248KB(4MB + 152KB),remain=44904KB(43MB + 872KB),zone_number=2,block_number=4
2.unmap mmz memory failed
报错如下
[File]:/data/facedet_nnie/detection/mtcnn/src/mtcnn_software.cpp, [mmz_userdev:get_mmbinfo_safe: Line]:25, [Error]: Error(0xa0338010): CNN_Forward failed!
[File]:/data/facedet_nnie/detection/mtcnnmmz_userdev:get_mmbinfo_safe: /src/mtcnn_software.cpp, [Line]:450, [Error] SvpSampleCnnDetectionForword failed
[Func]:HI_MPI_SYmmz_userdev:get_mmbinfo_safe: S_MmzFree [Line]:969 [Info]:System unmap mmz memory failed!
[Func]:HI_MPI_SYS_MmzFree [Line]:969 [Infmmz_userdev:mmz_userdev_release: o]:System unmap mmz memory failed!
[Func]:HI_MPI_SYS_MmzFree [Lmmz_userdev:mmz_userdev_release: ine]:969 [Info]:System unmap mmz memory failed!
[File]:/data/fammz_userdev:mmz_userdev_release: cedet_nnie/detection/mtcnn/src/mtcnn_interface.cpp, [Line]:66, [Error]: mtcnn P-Net process fail.
SvpSampleCnnDetMtcnn end ...
此时再执行 cat /dev/logmpp,看到SVP_NNIE没有初始化
/mnt/facedet_nnie # cat /dev/logmpp
<3>[svp_nnie] [Func]:SVP_NNIE_Ioctl [Line]:2917 [Info]:<3>[svp_nnie] Error(0xa0338010),SVP_NNIE is not init!
3.无/dev/nnie
报错如下
mmz_userdev:mmz_userdev_release: ine]:782 [Info]:open /dev/nnie err
[File]:/data/facedet_nnie/detection/mtcnn/src/mtcnn_software.cpmmz_userdev:mmz_userdev_release: p, [Line]:25, [Error]: Error(0xa0338010): CNN_Forward failed!
[mmz_userdev:mmz_userdev_release: File]:/data/facedet_nnie/detection/mtcnn/src/mtcnn_software.cpp, [Line]:449, [Error] SvpSampleCnnDetectionForword failed Segmentation fault
原因是 对于Hi3559V200芯片,当NNIE 部署在Linux 侧,GDC 部署在Huawei LiteOS侧时,如果加载了GDC 模块,NNIE 模块不能使用。需要把liteos端HI_S32 GDC_init()这个函数的调用禁止掉
代码路径
./reference/actioncam/modules/init/amp/liteos/src/hi_product_init_hi3559v200.c
4.Hi3559修改mmz大小
原.config
CONFIG_MEM_TOTAL_SIZE="512"
CONFIG_MEM_IPCM_BASE="0x80000000"
CONFIG_MEM_PARAM_BASE="0x80100000"
CONFIG_MEM_PARAM_SIZE="0x00100000"
CONFIG_MEM_RES_BASE="0x81f00000"
CONFIG_MEM_RES_SIZE="0x00100000"
CONFIG_MEM_HUAWEILITE_SYS_BASE="0x80200000"
CONFIG_MEM_HUAWEILITE_SYS_SIZE="0x01d00000"
CONFIG_MEM_HUAWEILITE_MMZ_BASE="0x88000000"
CONFIG_MEM_HUAWEILITE_MMZ_SIZE="0x15000000"
CONFIG_MEM_LINUX_SYS_BASE="0x82000000"
CONFIG_MEM_LINUX_SYS_SIZE="0x06000000"
CONFIG_MEM_LINUX_MMZ_BASE="0x9d000000"
CONFIG_MEM_LINUX_MMZ_ANONYMOUS_SIZE="0x01000000"
CONFIG_MEM_LINUX_MMZ_HIGO_SIZE="0x02000000"
按照起始地址排下序:
CONFIG_MEM_TOTAL_SIZE="512"
CONFIG_MEM_IPCM_BASE="0x80000000"
CONFIG_MEM_PARAM_BASE="0x80100000"
CONFIG_MEM_PARAM_SIZE="0x00100000"
CONFIG_MEM_HUAWEILITE_SYS_BASE="0x80200000"
CONFIG_MEM_HUAWEILITE_SYS_SIZE="0x01d00000"
CONFIG_MEM_RES_BASE="0x81f00000"
CONFIG_MEM_RES_SIZE="0x00100000"
CONFIG_MEM_LINUX_SYS_BASE="0x82000000"
CONFIG_MEM_LINUX_SYS_SIZE="0x06000000"
CONFIG_MEM_HUAWEILITE_MMZ_BASE="0x88000000"
CONFIG_MEM_HUAWEILITE_MMZ_SIZE="0x15000000"
CONFIG_MEM_LINUX_MMZ_BASE="0x9d000000"
CONFIG_MEM_LINUX_MMZ_ANONYMOUS_SIZE="0x01000000"
CONFIG_MEM_LINUX_MMZ_HIGO_SIZE="0x02000000"
总大小 CONFIG_MEM_TOTAL_SIZE = 512M
起始地址:CONFIG_MEM_IPCM_BASE=“0x80000000”
结束地址:0x9d000000+0x01000000+0x02000000=0xA0000000
总大小:0xA0000000-0x80000000=0x20000000=512M
我们需要增大LINUX_MMZ,那么就要从别的地方减少一点,我们减少HUAWEILITE_MMZ腾出空间来。
- 把CONFIG_MEM_HUAWEILITE_MMZ_SIZE从0x15000000减少为0x01000000
- 那么CONFIG_MEM_LINUX_MMZ_BASE就提前到0x88000000+0x01000000=0x89000000
- 总共还剩余0xA0000000-0x89000000=0x17000000,平均分为两块0x0B800000
前面的块不影响,保持不变,最终如下:
CONFIG_MEM_TOTAL_SIZE="512"
CONFIG_MEM_IPCM_BASE="0x80000000"
CONFIG_MEM_PARAM_BASE="0x80100000"
CONFIG_MEM_PARAM_SIZE="0x00100000"
CONFIG_MEM_HUAWEILITE_SYS_BASE="0x80200000"
CONFIG_MEM_HUAWEILITE_SYS_SIZE="0x01d00000"
CONFIG_MEM_RES_BASE="0x81f00000"
CONFIG_MEM_RES_SIZE="0x00100000"
CONFIG_MEM_LINUX_SYS_BASE="0x82000000"
CONFIG_MEM_LINUX_SYS_SIZE="0x06000000"
CONFIG_MEM_HUAWEILITE_MMZ_BASE="0x88000000"
CONFIG_MEM_HUAWEILITE_MMZ_SIZE="0x01000000"
CONFIG_MEM_LINUX_MMZ_BASE="0x89000000"
CONFIG_MEM_LINUX_MMZ_ANONYMOUS_SIZE="0x0b800000"
CONFIG_MEM_LINUX_MMZ_HIGO_SIZE="0x0b800000"