已关闭
[Bug-Report|缺陷反馈]: aclnn_remainder.cpp 509-511行,空指针返回ACLNN_ERR_INNER_NULLPTR非161001,需分析 #3184
liuhanwen8创建于 9月15日关闭于 9月19日
zjl5071
9月15日 评论:
9月15日 评论:
信息来源声明:以下分析基于昇腾知识图谱(ascend.wiki)检索结果(含错误码库核实)与 ops-math 仓库代码走查。
结论:报告属实。CheckParamsScalarTensor(aclnn_remainder.cpp L509-511)空指针检查的对象是用户输入参数,却返回 ACLNN_ERR_INNER_NULLPTR(561103),按约定应返回 ACLNN_ERR_PARAM_NULLPTR(161001)。 属低严重度错误码分类缺陷:不会崩溃、不影响计算结果,只是把"入参传空"误导成内部错误,影响用户的错误处理与日志分流。
依据:
- 错误码语义(KG 错误码库与本机 CANN 工具链
opdev/op_errno.h互证):ACLNN_ERR_PARAM_NULLPTR = 161001(输入参数空指针,参数错误类);ACLNN_ERR_INNER_NULLPTR = 561103(内部错误类,用于内部 l0 算子构建返回 nullptr 等异常)。L509-511 检查的三个指针(self:aclScalar*、other、out)均为用户直接传入的参数,语义上应归 161001; - 同文件其余 4 个同族检查函数全部符合约定:
CheckParamsTensorTensor(L440)、CheckParamsInplaceTensorTensor(L458)、CheckParamsTensorScalar(L475)、CheckParamsInplaceTensorScalar(L488)对参数空指针一律返回ACLNN_ERR_PARAM_NULLPTR——仅CheckParamsScalarTensor例外; - 调用链
aclnnRemainderScalarTensorGetWorkspaceSize(L656)→CheckParamsScalarTensor(L663)只透传错误码,非规范错误码会原样返回给调用方。
修复建议:将 L509-511 三处空指针检查的返回值改为 ACLNN_ERR_PARAM_NULLPTR(或直接对齐同族 CheckNotNull + CHECK_RET 写法),三行改动。
(昇腾知识图谱接入方式:https://gitcode.com/agent0/kg-tools)


jiangjiawei
9月16日 评论:
9月16日 评论:
/assign


9月16日 将 jiangjiawei 设为负责人
9月16日 关联了pull request:fix aclnn_remainder errcode
9月16日 关联了pull request:fix aclnn_remainder errcode
9月16日 删除了关联的pull request:fix aclnn_remainder errcode
9月19日 关闭了 issue
9月19日 添加了label:resolved
Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
一、问题描述 (必填)
https://gitcode.com/cann/ops-math/blob/master/math/floor_mod/op_api/aclnn_remainder.cpp
509-511行,空指针返回ACLNN_ERR_INNER_NULLPTR非161001,需分析
static aclnnStatus CheckParamsScalarTensor(const aclScalar* self, const aclTensor* other, const aclTensor* out)
{
// 1. 检查参数是否为空指针
OP_CHECK_NULL(self, return ACLNN_ERR_INNER_NULLPTR);
OP_CHECK_NULL(other, return ACLNN_ERR_INNER_NULLPTR);
OP_CHECK_NULL(out, return ACLNN_ERR_INNER_NULLPTR);
// 2. other和out的shape一致
OP_CHECK_SHAPE_NOT_EQUAL(other, out, return ACLNN_ERR_PARAM_INVALID);
// 3. self和other没有complex + other能cast成outDtype + outDtype为算子支持的数据类型
CHECK_RET(CheckPromoteTypeScalarTensor(self->GetDataType(), other->GetDataType(), out->GetDataType()),
ACLNN_ERR_PARAM_INVALID);
// 4. 维度数不能超过8维
CHECK_RET(CheckTensorDimSize(other), ACLNN_ERR_PARAM_INVALID);
CHECK_RET(CheckTensorDimSize(out), ACLNN_ERR_PARAM_INVALID);
}
二、环境信息 (可选)
静态分析,不涉及
三、重现步骤 (可选)
静态分析,不涉及
四、预期结果 (可选)
和其他Check函数保持一致
💡 备注(选填)