Sparse conv pass#6836
Sparse conv pass#6836DannyIsFunny merged 21 commits intoPaddlePaddle:developfrom minghaoBD:sparse_conv_PR
Conversation
…=develop [sparse_conv]add sparse conv fp32 profile,test=develop [sparse_conv] add sparse conv int8 kernels and related pass,test=develop [sparse_conv] fix sparse conv int8 precision,test=develop
|
Thanks for your contribution! |
|
代码风格检查 pre-commit run -a |
谢谢,已定位到问题并修正。 |
| return first_ic; | ||
| } | ||
|
|
||
| template int SparseConvDetectPass::ComputeSparseWeight<float>( |
There was a problem hiding this comment.
两个一样的函数名: SparseConvDetectPass::ComputeSparseWeight 有什么区别呢?能否在template 前面加上声明。解释每个参数含义和函数概功能
| ic_diffs_t); | ||
| } | ||
|
|
||
| LOG(INFO) << "zero_num: " << zero_num << " weight_num: " << weight_num |
There was a problem hiding this comment.
LOG 信息删除。或者改为VLOG(4)
|
|
Add function description and parameter defination!
| for (size_t i = 0; i < valid_places_.size(); i++) { | ||
| target = valid_places_[i].target; | ||
| if (target != TargetType::kARM) { | ||
| LOG(WARNING) << "sparse_model mode only supported on Arm. The model will " |
There was a problem hiding this comment.
这个除了warning,是不是应该return,不走sparse 设置额。应该走默认dense实现
There was a problem hiding this comment.
我的写法和你的描述是相符的:
- 这段代码的逻辑是:如果检测到valid_places_中包含ARM之外的place,就报warning,同时关闭sparse_pass按钮(https://github.com/minghaoBD/Paddle-Lite/blob/sparse_conv_PR/lite/api/tools/opt_base.cc#L68 )。
- sparse_pass按钮用于控制是否将该pass放入到这里去:https://github.com/minghaoBD/Paddle-Lite/blob/040589191b225e1f7aeeee5418e56d0aff3260e6/lite/api/cxx_api_impl.cc#L112 。所以会走到dense实现的。
- 我这么写的逻辑是参照了量化pass流程,我看军才也是通过quant_model开关来控制是否走post_quant_dynamic_pass。https://github.com/minghaoBD/Paddle-Lite/blob/040589191b225e1f7aeeee5418e56d0aff3260e6/lite/api/tools/opt_base.cc#L42
添加新功能:支持非结构化稀疏的推理计算(稀疏化矩阵乘法用以加速1x1卷积推理计算,以下简称SpMM)。由于整个PR的代码量较大,计划拆为3个PR提交,分别为:
sparse pass的PR中,我们主要做了如下方面的更改,麻烦相关同学review下: