Pull Request has been successfully merged by CANN-robot.
(Thank you for Huang-Peng's contribution.)变更摘要
本 PR 新增 RotatedOverlaps 算子的 Ascend 950(arch35)后端实现,落地于 objdetect/rotated_overlaps/,覆盖算子定义、形状推导、tiling、向量化内核、构建配置与测试。输入为 [B,5,N] 的 boxes/query_boxes(trans=false 时格式为 [x,y,w,h,theta],trans=true 时为 [x1,y1,x2,y2,theta]),输出为 [B,N,K] 的交叠面积(非 IoU),仅支持 float32/ND,theta 单位为度;非有限坐标与退化矩形按非法处理(非法配对输出零),首版限制 K <= 2000。
主要改动
- 算子定义与形状推导:
rotated_overlaps_def.cpp注册RotatedOverlapsOpDef(boxes/query_boxes输入、overlaps输出、trans属性及ascend950AICore 配置);rotated_overlaps_infershape.cpp推导输出[B,N,K],并校验 rank=3、坐标通道=5、batch 匹配、已知维度为正且 K 不超过 2000。 - Ascend950 tiling 实现:
rotated_overlaps_tiling_arch35.cpp按输出行划分 core(rowsPerCore),依据 UB 容量从 128/96/64/32/8 中选取 tile 长度并计算 sin/cos 数学 workspace,通过RotatedOverlapsTilingData传递批大小、行数、tile 长度等参数,并依据trans与use32Bit组合设置 tiling key。 - 向量化内核:
arch35/rotated_overlaps_kernel.h中一个 core 负责完整[b,n,:]输出行,query tile 按向量 lane 处理(无地址写竞争);每个 lane 构造 24 个凸多边形交点候选(A 的 4 顶点在 B 内、B 的 4 顶点在 A 内、16 条边对交点),经 32 路 bitonic 网络按伪角度 key 排序后以鞋带公式计算面积,非法框通过PairValid置零;rotated_overlaps_apt.cpp提供按trans/use32Bit模板化的内核入口。 - 构建与配置注册:新增
op_host/config/ascend950/rotated_overlaps_binary.json(float32/ND 的输入输出与trans属性声明)与rotated_overlaps_simplified_key.ini,并在scripts/kernel/binary_config/ascendc_config.json中注册RotatedOverlaps的 ascend950 编译项。 - 测试补充:ST 侧新增
tests/assets/golden.py(独立的 float64 Sutherland-Hodgman 裁剪参考实现)与inputs.py(确定性边界用例与通用随机用例生成);UT 侧新增test_rotated_overlaps_infershape.cpp覆盖静态/动态形状推导及各类非法输入拒绝场景。


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 | ✅ 汤平川, 陈娇, yue-ma (3/2) | ✅ 陈娇 (1/1) |
| */*/op_graph/*_proto.h | ✅ yue-ma, 汤平川, 王永光 (3/2) | ✅ 王永光 (1/1) |
| */*/op_graph/*_proto_extend.h | ✅ 王永光, yue-ma, 汤平川 (3/2) | ✅ 王永光 (1/1) |
| */*/op_host/*_def.cpp | ✅ 王永光, yue-ma, 汤平川 (3/2) | ✅ 王永光 (1/1) |
| repo-cann/ops-cv | ✅ 汤平川, yue-ma (2/2) | ✅ yue-ma, 汤平川 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
Huang-Peng, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/approve


描述
新增
RotatedOverlaps算子的 Ascend 950 (arch35) 后端实现,落地在 ops-cv/objdetect/rotated_overlaps/。主要改动
算子定义与形状推导(op_host/):
rotated_overlaps_def.cpp:注册 RotatedOverlaps OpDef(boxes/query_boxes 输入,output 输出)rotated_overlaps_infershape.cpp:输出 shape 推导([B,N,K])arch35/:Ascend950 tiling 实现(tiling_arch35 + tiling_data + tiling_key)内核(op_kernel/):
arch35/rotated_overlaps_kernel.h:向量化内核,一个 core 负责完整 [b,n,:] 输出行;query tile 按向量 lane 处理,无地址写竞争;每 lane 构造凸多边形交点候选集(A 的 4 顶点在 B 内、B 的 4 顶点在 A 内、16 条边对交点)rotated_overlaps_apt.cpp:950 内核入口构建与配置:
CMakeLists.txt+op_host/config/ascend950/(binary JSON + simplified-key)+scripts/kernel/binary_config/ascendc_config.json注册语义约束:
[x,y,w,h,theta](trans=false)或[x1,y1,x2,y2,theta](trans=true),float32/ND;输出为交叠面积(非 IoU),theta 单位为度测试:
tests/assets/golden.py(独立参考实现)+inputs.py+ ttk csv;UT:infershape 单测关联的Issue
关联Issue #772
测试
文档更新
更新 objdetect/rotated_overlaps/README.md,说明输入格式、语义约束与限制。
类型标签