Pull Request已成功合入, 合并人@CANN-robot
(感谢 m0_46386992 的贡献)变更摘要
本 PR 将 ROIPooling 算子从 ops-cv 迁移到 ops-nn:在 common/inc/op_graph/op_nn_proto_extend.h 中删除旧的 REG_OP(ROIPooling) 定义,并在新增的 pooling/roi_pooling/op_graph/roi_pooling_proto.h 中以相同接口(输入 x/rois/roi_actual_num,属性 pooled_h/pooled_w/spatial_scale_h/spatial_scale_w,输出 y)重新注册,同时补齐该算子在新目录下的 op 定义、shape/dtype 推导、arch35 平台的 tiling 与 SIMT kernel 实现及配套测试。
主要改动
- 算子定义迁移与重注册: 移除
op_nn_proto_extend.h中的ROIPooling注册(-67 行),在新增的roi_pooling_proto.h中通过REG_OP(ROIPooling)重新声明相同的输入、属性与输出(DT_FLOAT/DT_FLOAT16,roi_actual_num为可选DT_INT32),并在op_host/roi_pooling_def.cpp中完成OpDef注册与ascend950的OpAICoreConfig配置。 - 新增 host 侧推导与 tiling:
roi_pooling_infershape.cpp按[K, C, pooled_h, pooled_w]推导输出 shape(支持 unknown dim/rank);roi_pooling_tiling_arch35.cpp实现 dtype/shape/attr 校验、基于totalElements = K*C*pooled_h*pooled_w的 grid-stride 核数切分、workspace 与 tiling key 设置,并定义RoiPoolingTilingData结构;roi_pooling_graph_infer.cpp校验rois与xdtype 一致并透传输出 dtype。 - 新增 arch35 SIMT kernel 实现:
op_kernel/arch35/roi_pooling_simt.h提供OpRoiPoolingSimtKernel,采用 int64 全程运算与 grid-stride 循环,实现 ROI 坐标 round 映射、bin 边界计算及 bin 内 max 扫描,含 batchIdx 越界和空 bin 输出 0 的保护;roi_pooling_apt.cpp作为 kernel 入口按DTYPE_X模板实例化。 - 新增编译配置:
op_host/config/ascend950/roi_pooling_binary.json注册ROIPooling的 float32/float16 两种 kernel 二进制匹配项(ND 格式、FormatAgnostic、四个属性)。 - 新增测试与 golden 用例:
tests/assets/golden.py提供RoiPoolingKernelSpecgolden(等 scale 走torchvision.ops.roi_pool,不等 scale 走自实现 torch 路径,支持 FP16/FP32 交叉校验),并新增 tiling 与 infershape 的 gtest 单测以及 GEIR 冒烟示例examples/test_geir_roi_pooling.cpp(覆盖 S/D 模式、FP32/FP16 与多组 shape 场景)。


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 |
|---|---|---|
| */*/README.md | ✅ 陈娇, 杜慧萍, 黄迪 (3/2) | ✅ 陈娇 (1/1) |
| */*/op_graph/*_proto.h | ✅ 汤磊, 王永光, 黄迪 (3/2) | ✅ 汤磊, 王永光 (2/1) |
| */*/op_graph/*_proto_extend.h | ✅ 汤磊, 王永光 (2/2) | ✅ 汤磊, 王永光 (2/1) |
| */*/op_host/*_def.cpp | ✅ 汤磊, 王永光, 黄迪 (3/2) | ✅ 汤磊, 王永光 (2/1) |
| docs | ✅ 陈娇, 杜慧萍 (2/2) | ✅ 陈娇 (1/1) |
| pooling | ✅ 刘闯, 黄迪 (2/2) | ✅ 刘闯, 黄迪 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
m0_46386992, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/lgtm
/approve


/lgtm


描述
迁移ops-cv仓的ROIPooling到ops-nn下面,避免9.1.0升级兼容性问题,关联代码:
https://gitcode.com/cann/ops-nn/pull/9609/
关联的Issue
https://gitcode.com/cann/ops-nn/issues/5431
测试
文档更新
类型标签
AI/Agent生成声明