Pull Request已成功合入, 合并人@CANN-robot
(感谢 hahaha22 的贡献)变更摘要
该 PR 修复 aclnnRemainderScalarTensor 在 RegBase(950)场景下未校验实际计算类型的问题:此前类型推导得到 INT8 等非法计算类型时会进入 FloorMod 内核选择阶段并报 Cannot find binary。本次在 CheckPromoteTypeScalarTensor 中,于原有检查顺序之后为 RegBase 增加 castDtype 白名单校验(DTYPE_SUPPORT_LIST),非法组合在 GetWorkspaceSize 阶段即返回 ACLNN_ERR_PARAM_INVALID(161002),日志明确输出 self、other 及推导后的计算类型;非 RegBase 平台保持原有先按 out 类型转换输入的路径不变。
主要改动
- RegBase 计算类型白名单校验:在
aclnn_remainder.cpp的CheckPromoteTypeScalarTensor中新增IsRegBase(npuArch) && !CheckType(castDtype, DTYPE_SUPPORT_LIST)分支,非法castDtype直接返回 false,并记录self、other与推导计算类型的错误日志,使非法 dtype 在校验阶段即被拦截。 - 原有检查顺序与路径保留:新增校验置于原有注释约束(无 complex、可 cast 至
outDtype、outDtype受支持)之后,非 RegBase 平台仍按 out 类型转换输入,行为不受影响。 - 新增 7 个 UT 用例:在
test_aclnn_remainder_scalar_tensor.cpp中覆盖 INT8/UINT8/INT16 计算类型搭配 INT32/FLOAT out 返回 161002、FLOAT32 scalar 提升 INT8 tensor 成功、非 RegBase 下 INT8 输入转 INT64 输出成功、合法与非法计算类型的空 Tensor(非法返回 161002、合法成功且 workspace 为 0)、INT32/INT64/FLOAT16/FLOAT/DOUBLE/BFLOAT16 六种支持类型及非法 out 类型。


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 |
|---|---|---|
| math/floor_mod | ✅ 宋恺, 王瑞 (2/2) | ✅ 宋恺, 王瑞 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
hahaha22, thanks for your pull request. All authors of the commits have signed the CLA. 👍


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


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


/approve


描述
修复 aclnnRemainderScalarTensor 在 950/Regbase 上未校验实际计算类型的问题。例如 INT64 scalar 与 INT8 tensor 搭配 INT32 out 时,类型推导得到 INT8;原检查仅验证向 out 的转换关系及 out 类型白名单,导致 INT8 输入进入 FloorMod 内核选择阶段,报 Cannot find binary。
参考同文件 CheckPromoteTypeTensorScalar 的检查方式,在保留原有检查顺序的基础上,为 Regbase 增加 castDtype 白名单校验。非法组合在 GetWorkspaceSize 阶段返回 ACLNN_ERR_PARAM_INVALID(161002),日志明确指出 self、other 和推导后的计算类型。
行为边界
关联的Issue
暂无 Issue 链接。对应 error_log_compliance_report.xlsx 中该接口的 D 类第 8 行(计算类型漏检)。
测试
bash build.sh -u --opapi --ops=floor_mod --soc=ascend950 --gtest_filter='*remainder_scalar_tensor*' -j88 个 ACLNN UT 全部通过,包含原有 1 个用例及新增 7 个用例,覆盖:
git diff --check通过。上述 UT 在修复移植到 master 基线前执行;移植后核对目标文件内容一致,随后仅恢复了原有 out 报错格式串,该格式恢复未重新运行 UT。UT 使用平台 mock,修复后版本尚未部署到 CANN 进行 TTK 真机测试。
文档更新
无。
类型标签
AI/Agent生成声明
关联issue