c_api内存池的几个bug
- 修了一下c_api allocator参数的几个bug
- 做了个内存池最大使用内存限制功能,功能比较粗糙
- 提升了 allocator 的 emptyCache() 方法,小内存的设备需要
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Codecov Report
Merging #3817 (9b917d5) into master (f79073c) will increase coverage by
1.53%. The diff coverage is17.36%.
@@ Coverage Diff @@
## master #3817 +/- ##
==========================================
+ Coverage 91.75% 93.29% +1.53%
==========================================
Files 674 674
Lines 171538 172106 +568
==========================================
+ Hits 157402 160564 +3162
+ Misses 14136 11542 -2594
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/allocator.h | 87.50% <ø> (ø) |
|
| src/c_api.cpp | 31.72% <2.87%> (-5.19%) |
:arrow_down: |
| src/allocator.cpp | 75.75% <56.86%> (-0.13%) |
:arrow_down: |
| src/cpu.cpp | 63.81% <0.00%> (-1.71%) |
:arrow_down: |
| src/net.cpp | 65.37% <0.00%> (-0.12%) |
:arrow_down: |
| src/layer/vulkan/pooling_vulkan.cpp | 98.42% <0.00%> (+<0.01%) |
:arrow_up: |
| src/mat.h | 89.87% <0.00%> (+0.05%) |
:arrow_up: |
| src/layer/x86/convolution_3x3_pack8to4_int8.h | 99.43% <0.00%> (+0.09%) |
:arrow_up: |
| src/layer/x86/convolution_sgemm_pack8to1_int8.h | 99.10% <0.00%> (+0.09%) |
:arrow_up: |
| src/layer/x86/convolution_3x3_pack8to1_int8.h | 99.06% <0.00%> (+0.12%) |
:arrow_up: |
| ... and 44 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update c2fb93b...9b917d5. Read the comment docs.
This pull request introduces 2 alerts when merging 9b917d55c1c5458f2e08a79889e9c078f5c93deb into c2fb93b6ff99045dd76aae2d41218a15df189247 - view on LGTM.com
new alerts:
- 2 for Virtual call from constructor or destructor
emptyCache 看起来就是原来的 clear 嘛?所以直接把 clear 提升到基类也ok? gpu 那边的 VkAllocator 有 clear 方法
对的,一些内存比较少的国产环境中顺序推理多张图片时,识别完一张图片时,调用一下emptyCache() 可以为后续图像算法之类争取到更多一点儿内存……
叶子
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年5月21日(星期六) 晚上9:36 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [Tencent/ncnn] c_api内存池的几个bug (PR #3817)
emptyCache 看起来就是原来的 clear 嘛?所以直接把 clear 提升到基类也ok?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
我试了直接提升clear() 好像改动会更大一些,vk也有重名的,就单独加了名字。要是 cpu 和 vk 能统一内存池接口应该是最好的方案。没有写内存池的经验,逻辑可能欠妥,看着改就行。另外 clear() 不如 emptyCache()描述形象, pytorch里用的是后者。
叶子
move part of this pr to https://github.com/Tencent/ncnn/pull/4360