Pull Request has been successfully merged by CANN-robot.
(Thank you for wuxiyuan's contribution.)变更摘要
该 PR 为 CombinedNMS 算子增加 FP16 支持,统一 iou_threshold 参数值域(由 [0, 1] 放宽为「有限且非负」),移除 num_boxes 的 200000 硬上限并改为 int32/int64 范围校验,同时将每核抑制掩码工作区按 512 字节 GM 对齐以隔离多核缓存写入,并同步更新了单测与 golden 参考实现。
主要改动
- 算子支持 FP16 输入输出:
combined_non_max_suppression_def.cpp中boxes、scores输入及nmsed_boxes、nmsed_scores、nmsed_classes输出的DataType增加DT_FLOAT16;combined_non_max_suppression_simt.h将CombinedNonMaxSuppressionKernel及CalcIou、LoadTaskHotData、SelectClassNms、MergeBatchResults等改造为template <typename T>,UB 缓冲区按sizeof(T)分配,入口combined_non_max_suppression.cpp以DTYPE_BOXES实例化内核。 - 统一
iou_threshold参数值域:tiling 校验由[0, 1]区间改为「有限且非负」(!std::isfinite(iouThreshold) || iouThreshold < 0.0F),tests/assets/inputs.py同步放宽,并新增「接受有限非负值」「拒绝负值/非有限值」两组单测。 - 移除
num_boxes上限并补充范围约束:删除MAX_NUM_BOXES = 200000常量及对应校验,改为校验numBoxes不超过 int32 最大值、boxes 元素总数不超 int64 范围(combined_non_max_suppression_tiling.cpp与combined_non_max_suppression_infershape.cpp),并新增接受 200000 以上 box 数量、拒绝超出 int32 范围的单测。 - 抑制掩码工作区按 512 字节对齐:新增
CNMS_GM_ALIGN_BYTES = 512,suppressedOffset及每核suppressed步长按该值对齐;同时SelectClassNms的结果(selectedScores、selectedIndices、selectedCounts)由直写 GM 改为先写 UB 再经 MTE3 精确写回,避免多核 SIMT 缓存行互相覆盖。 - 测试与参考实现同步:
tests/assets/golden.py的输出数组 dtype 改为跟随输入boxes的 dtype,以匹配 FP16 支持;tiling 单测同步更新工作区偏移/大小断言(如suppressedOffset由 160 变为 512)。


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_host/*_def.cpp | ✅ 王永光, 刘伟, 冯彤 (3/2) | ✅ 王永光 (1/1) |
| repo-cann/ops-cv | ✅ 刘伟, 冯彤 (2/2) | ✅ 刘伟 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


【P0 跨文件一致性】此处为 boxes 新增 DT_FLOAT16,但算子原型 IR op_graph/combined_non_max_suppression_proto.h 的 REG_OP 仍声明 .INPUT(boxes, TensorType({DT_FLOAT})) 单一 dtype,未同步 FP16;scores / nmsed_boxes / nmsed_scores / nmsed_classes 同理。proto 是 GE 图编译契约,FP16 输入会被 proto 拒绝,def 声明的 FP16 无法生效。请同步在 proto 的 REG_OP 中为 boxes/scores/nmsed_boxes/nmsed_scores/nmsed_classes 补充 DT_FLOAT16(如 TensorType({DT_FLOAT16, DT_FLOAT}))。


/approve


/approve


/lgtm
/approve


/lgtm


描述
CombinedNonMaxSuppression 对每个 batch、每个类别独立执行贪心非极大值抑制(NMS),再按置信度从高到低合并各类别候选框,是目标检测后处理的核心算子。本 PR 在 Ascend 950 已有实现基础上支持 FP16 数据类型,统一 iouThreshold 参数值域,并放开 num_boxes 上限限制。
变更内容
关联的Issue
https://gitcode.com/cann/ops-cv/issues/959
测试
已完成自验证
文档更新
更新了README.md文件(补充 FP16 数据类型支持及 iouThreshold 值域、num_boxes 约束变更说明)
类型标签