Pull Request已成功合入, 合并人@CANN-robot
(感谢 yangyang4536 的贡献)变更摘要
此 PR 引入了「FM 不全载」(Feature Map 部分加载)的 Small Kernel 卷积优化路径。当 FM 无法全部放入 L1 缓存但 Weight 可以完全加载到 L1 时,新增的 CONV_SMALL_KERNEL_FM_PARTLOAD 策略将 FM 按 Cin 维度分块加载,Weight 则一次性全部载入 L1,从而扩展 Small Kernel 优化的适用范围。主要涉及新增 tiling key 枚举值、tiling 判定逻辑、内核模板类 Conv2dSmallKernelFmPartload,以及在 conv2d_v2 和 extend_conv2d 两个入口的调度分发。
主要改动
- 新增
CONV_SMALL_KERNEL_FM_PARTLOADtiling key:在conv_tilingkey.h中定义宏值为2,并在CONV2D_SCALAR_OPT_SEL宏的SmallKernel选择器中增加该选项;同时conv2d_v2_tilingkey.h中将SmallKernel位宽从1_BW扩展为2_BW以支持三种状态。 - 新增 FM 不全载判定逻辑:在
conv2d_v2_base_tiling_tilingkey.cpp的GetSmallKernelVal()中,当 FM 不满足 L1 全载、Weight 满足 L1 全载、数据类型为 FP16×FP16 或 INT8×INT8、且 Weight 为 NZ 格式时,返回CONV_SMALL_KERNEL_FM_PARTLOAD。 - 新增
Conv2dSmallKernelFmPartload内核模板类:新增conv2d_small_kernel_fm_partload.h(+297 行),继承自Conv2dSmallKernelParallelism,仅覆写Init和Process,并新增LoadWeightL1Full方法。其核心策略是 Weight 一次性全量加载到 L1(不分 K 维度),FM 则按 Cin 分块复用父类的分块辅助方法,支持 M 模式和 HW 模式。 Conv2dSmallKernelParallelism访问权限调整:将conv2d_small_kernel_parallelism.h中的private:改为protected:,使子类Conv2dSmallKernelFmPartload可以访问基类的共享成员和辅助方法。- 调度分发适配:在
conv2d_v2.cpp和extend_conv2d.cpp中增加对SmallKernel == CONV_SMALL_KERNEL_FM_PARTLOAD的if constexpr分支,实例化并调用新模板类,使两个卷积入口均支持 FM 不全载优化路径。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| conv | ✅ 王慈孟, 郑李磊 (2/2) | ✅ 王慈孟, 郑李磊 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
yangyang4536, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/lgtm
/approve


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


描述
FM非全载场景缺少小kernel模板,新增模板,优化此场景性能
关联的Issue
https://gitcode.com/cann/ops-nn/issues/4984
测试
文档更新
类型标签
AI/Agent生成声明