已合并
fix: 修复Remainder/Greater/Equal/IsIn报错dtype支持列表双层中括号 #5512
hahaha22创建于 22 天前
fix: 修复Remainder/Greater/Equal/IsIn报错dtype支持列表双层中括号 #5512
已合并
hahaha22创建于 22 天前
hahaha22成员
22 天前

描述

修复 E 类(报错格式瑕疵)问题:报错日志 dtype 支持列表出现双层中括号 [[..]]。拆分自 PR #5464(该 PR 原含 B/E 两类修改,现拆为独立 PR 便于评审;B 类见 PR #5502)。

根因

格式串 dtype support list [%s] 与 op::ToString(std::initializer_list<DataType>) 自身输出的 [...] 叠加(该函数序列化列表时自带方括号,见 opbase data_type_utils.cpp 的 ToString 实现),导致日志出现 [[DT_INT32,...]]。

实测复现(910B3 + CANN 9.2.0,aclnnRemainderTensorScalar 传入 self=INT8/other=INT8/out=INT32):

[ERROR] ... [aclnn_remainder.cpp:227][CheckPromoteTypeTensorScalar] errno[161002]
OpName:[aclnnRemainderTensorScalar_0] expected dtype DT_INT8 should be in dtype
support list [[DT_INT32,DT_INT64,DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_BFLOAT16,]].

修改明细(7 处,[%s] 改为 %s,与 aclnn_mul.cpp:248 既有正确写法一致)

  • math/floor_mod/op_api/aclnn_remainder.cpp:3 处(Promote type :193 / expected dtype :223 / out dtype :255,对应 RemainderTensorTensor、RemainderTensorScalar/Inplace、RemainderScalarTensor)
  • math/greater/op_api/aclnn_gt_tensor.cpp:1 处(promoteType 报错,对应 GtTensor/InplaceGtTensor)
  • math/equal/op_api/aclnn_eq_tensor.cpp:1 处(promoteType 报错,对应 EqTensor/InplaceEqTensor)
  • math/equal/op_api/aclnn_eq_scalar.cpp:1 处(promote dtype 报错,对应 EqScalar)
  • math/equal/op_api/aclnn_isin_tensor_scalar.cpp:1 处(promoteType 报错,对应 IsInTensorScalar)

另:触碰的 5 个 cpp 文件按 clang-format 全量格式化(函数签名换行、OP_LOGE 参数对齐、注释空格等存量行),不改变执行逻辑,以通过 CI 全文件格式化检查。

关联的Issue

  • #3096

测试

  • 变更仅涉及 OP_LOGE 日志格式串与格式化,参数校验逻辑、返回码、执行行为均不变。
  • 已在 910B3 实测复现修复前的 [[..]] 报错,修复后输出单层 [...]。

文档更新

  • 无

类型标签

关联issue

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 hahaha22 的贡献)
Hhahaha22成员
22 天前 创建了 pull request,commit d64a50b7
Hhahaha22成员
22 天前 关联了issue:[Bug-Report|缺陷反馈]: 算子报错日志dtype支持列表双层中括号[[..]]及Pow/MaxN/IsIn资料dtype列表与代码不一致
atomgit-bot
atomgit-bot
22 天前 评论:

变更摘要

本 PR 修复 E 类报错格式瑕疵:Remainder/Greater/Equal/IsIn 相关算子的 dtype 支持列表报错日志出现双层中括号 [[..]] 的问题。根因是格式串 dtype support list [%s] 与 op::ToString(std::initializer_list<DataType>) 序列化列表时自带的 [...] 叠加所致。修复方式为将 7 处 OP_LOGE 中的 [%s] 改为 %s(与 aclnn_mul.cpp:248 既有正确写法一致),涉及 aclnn_remainder.cpp、aclnn_gt_tensor.cpp、aclnn_eq_tensor.cpp、aclnn_eq_scalar.cpp、aclnn_isin_tensor_scalar.cpp 五个文件;改动仅涉及日志格式串,参数校验逻辑、返回码与执行行为均不变。另对触碰的 5 个 cpp 文件按 clang-format 做了全量格式化(函数签名换行、OP_LOGE 参数对齐、注释空格等存量行),不改变执行逻辑,以通过 CI 全文件格式化检查。

主要改动

  • 修复日志双层中括号:将 math/floor_mod/op_api/aclnn_remainder.cpp 中 3 处(Promote type / expected dtype / out dtype,对应 RemainderTensorTensor、RemainderTensorScalar/Inplace、RemainderScalarTensor)的格式串 dtype support list [%s] 改为 %s,使日志输出为单层 [...]。
  • 修复 Greater 报错格式:将 math/greater/op_api/aclnn_gt_tensor.cpp 中 promoteType 校验的报错格式串 [%s] 改为 %s,覆盖 GtTensor/InplaceGtTensor,同时按 clang-format 调整 CURRENT_DTYPE_SUPPORT_LIST 等存量行的对齐方式。
  • 修复 Equal 系列报错格式:将 aclnn_eq_tensor.cpp、aclnn_eq_scalar.cpp、aclnn_isin_tensor_scalar.cpp 中 promoteType/promote dtype 校验的报错格式串 [%s] 改为 %s,覆盖 EqTensor/InplaceEqTensor、EqScalar、IsInTensorScalar。
  • 统一格式化存量代码:5 个触碰文件按 clang-format 全量格式化,包括 GetWorkspaceSize 系列函数签名换行、OP_LOGE 参数对齐及注释空格调整,仅涉及格式不改变逻辑。
likedislike
不准确?
atomgit-bot
atomgit-bot
22 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
22 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
22 天前 评论:

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/equal ✅ 宋恺, 王瑞 (2/2) ✅ 王瑞, 宋恺 (2/1)
math/floor_mod ✅ 宋恺, 王瑞 (2/2) ✅ 宋恺, 王瑞 (2/1)
math/greater ✅ 宋恺, 王瑞 (2/2) ✅ 宋恺, 王瑞 (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robot
CANN-robot成员
22 天前 评论:

CLA Signature Pass

hahaha22, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
22 天前 将FelixTang7,yue-ma,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,zhanw_coding设为评审人
CANN-robotCANN-robot成员
22 天前 将FelixTang7,yue-ma,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,zl_hw,songkai111,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,zhanw_coding设为审查人
hahaha22成员
22 天前 评论:

/compile

likedislike
Hhahaha22成员
22 天前 预合并成功(commit_id: b24f105adf48fa00d2ff29e6e8526b44df23b466)
CANN-robot
CANN-robot成员
22 天前 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
22 天前 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
22 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
22 天前 添加了label:ci-pipeline-passed
hahaha22成员22 天前进行代码检视1
math/greater/op_api/aclnn_gt_tensor.cpp
@@ -132,2 +128,2 @@
132- op::ToString(self->GetDataType()).GetString(), op::ToString(other->GetDataType()).GetString(),
133- op::ToString(promoteType).GetString(), op::ToString(CURRENT_DTYPE_SUPPORT_LIST).GetString());
128+ OP_LOGE(ACLNN_ERR_PARAM_INVALID,
129+ "Self dtype %s and other dtype %s get promoteType dtype %s should be in "
hahaha2222 天前评论:

这次修了 5 个文件,但仓里同样写法 dtype support list [%s] 的还有 12 个文件没修,包括 le_scalar、le_tensor、ne_scalar、ne_tensor、tensor_equal/aclnn_equal、add_n、axpy_v2、one_hot、searchsorted、reduce_sum、reduce_mean、reduce_nansum,其中 le_scalar 和 aclnn_equal 同时也被 #5467 改到。这类报错格式问题建议排个跟进 PR 一次性清完,不然修一半容易出现两批 PR 互相踩。

likedislike
hahaha22成员22 天前进行代码检视1
math/equal/op_api/aclnn_eq_scalar.cpp
@@ -239,3 +239,1 @@
239- auto outSuportList = IsRegBase(npuArch) ?
240- GetOutputDtypeSupportList() :
241- dtypeSupportList;
239+ auto outSuportList = IsRegBase(npuArch) ? GetOutputDtypeSupportList() : dtypeSupportList;
hahaha2222 天前评论:

outSuportList 少了个 p,应该是 outSupportList,这次正好重排到这一行,建议顺手把拼写改掉,le_scalar 里也有同名的这个变量。

likedislike
Hhahaha22成员
22 天前 修改了pull request 的描述
Hhahaha22成员
21 天前 修改了pull request 的描述
Hhahaha22成员
21 天前 解决了最后一个问题
sunchun成员
21 天前 评论:

您好,PR已满足合入指标,请尽快联系Committer进行合入。如暂时不需要合入,请在PR标题前加[WIP]

likedislike
songkai111成员
21 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
21 天前 添加了label:approved
RuiWang_成员
21 天前 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
21 天前 添加了label:lgtm
CANN-robotCANN-robot成员
21 天前 合入了pull request