Closed
[Bug-Report|缺陷反馈]: aclnnRange 空指针错误码返回 561103,资料错误码表声明 161001(start/end/step/out 四个位置全部如此) #4256
liuhanwen8Add on 20 days agoClosed at 6 days ago
20 days ago Added label: bug-report
陈思
20 days ago Comments:
20 days ago Comments:
您好,核对 ae087b184,CheckParams 的参数判空失败仍返回 ACLNN_ERR_INNER_NULLPTR;而 错误码表 声明 start/end/step/out 为空应返回 ACLNN_ERR_PARAM_NULLPTR。四个参数共用这一检查,因此源码与您给出的 561103 现象一致。
建议将用户参数判空的返回码与文档约定对齐,保留真正内部对象创建失败的错误码,并对四个空参数及合法基线分别回归。此项发生在前端检查,不需要等待 kernel 根因调查;本轮未执行设备测试或修改代码。


20 days ago Assign chen_0715 as responsible person
20 days ago Added label: pending-confirmation
20 days ago Removed label: pending-confirmation
20 days ago Assign VoyageZhou as responsible person
20 days ago Removed responsible person chen_0715
19 days ago Associated pull request
fitZepHYr
19 days ago Comments:
19 days ago Comments:
已确认问题属实:aclnnRange 的 CheckParams 把 CheckNotNull 的失败返回透传成了 ACLNN_ERR_INNER_NULLPTR(561103),与资料声明的 161001 不符,start/end/step/out 四处一致。
补充一点:同族接口 aclnnArange 已在 upstream commit e8c3c219b(issue #2501)中修正为 ACLNN_ERR_PARAM_NULLPTR,实测安装包中 aclnnArange 已返回 161001;本次是 aclnnRange 的漏改。
修复:
math/range/op_api/aclnn_range.cpp空指针校验失败返回码改为ACLNN_ERR_PARAM_NULLPTR(一行,不改变校验逻辑、dtype 列表与执行流程);- 新增
aclnnRange_start/end/step/out_nullptr四条 UT; - 资料已声明 161001,无需修改。
验证(A2 910B3 / CANN 9.3.0,新旧库对照):
- start/end/step/out 置空:561103 → 161001;正常参数仍为 0;
bash build.sh -u --opapi --ops=range --soc=ascend910b:l2_range_test 6/6、l2_arange_test 2/2 PASSED。
兼容性:返回码由「内部对象为空」改为「参数为空」,与资料及仓库其它接口一致,内部空指针分支仍保留 561103。


6 days ago Close issue
6 days ago changed custom state from 进行中 to 已完成
6 days ago Added label: resolved
现象
aclnnRange在任一入参指针为空时,返回561103(ACLNN_ERR_INNER_NULLPTR);而资料错误码表声明的是161001(ACLNN_ERR_PARAM_NULLPTR)。四个位置(start/end/step/out)全部如此,两种确定性开关(ACL_OPT_DETERMINISTIC=0/1)下一致。实测(Atlas A2 910B2,CANN 9.2.0):
startendstepout复现脚本输出:
期望
资料
math/range/docs/aclnnRange.md的错误码表第一行:ACLNN_ERR_PARAM_NULLPTR161001是「参数为空」的标准码;561103属于内部错误族(ACLNN_ERR_INNER_NULLPTR),语义是「内部创建的对象为空」,不是「用户传了空指针」。调用方按资料写
if (ret == 161001)会漏判;按561103分流又会把「参数错」误报成「内部故障」,两者排查方向完全不同。根因
math/range/op_api/aclnn_range.cpp:186-195:inline static aclnnStatus CheckParams(const aclScalar* start, const aclScalar* end, const aclScalar* step, const aclTensor* out) { // 1. 检查参数是否为空指针 CHECK_RET(CheckNotNull(start, end, step, out), ACLNN_ERR_INNER_NULLPTR); // ← 应为 ACLNN_ERR_PARAM_NULLPTR // 2. 检查输入的数据类型是否在API支持的数据类型范围之内,需要根据api定义校验 CHECK_RET(CheckDtypeValid(start, end, step, out), ACLNN_ERR_PARAM_INVALID); // 3. 检查输入的数据的值是否合理 CHECK_RET(CheckParamsLogic(start, end, step, out) == ACLNN_SUCCESS, ACLNN_ERR_PARAM_INVALID); return ACLNN_SUCCESS; }CheckNotNull的返回值被透传成ACLNN_ERR_INNER_NULLPTR(561103),与资料声明的161001不符。同仓aclnn_arange.cpp:167是同一写法,属同族共性问题。环境
cann/ops-math,master1b415030/usr/local/Ascend/ascend-toolkit/latest/include/aclnnop/aclnn_range.h(9.2.0 发布件)复现步骤
source $ASCEND_HOME_PATH/set_env.sh,确认ASCEND_OPP_PATH=$ASCEND_HOME_PATH/opp。g++ -std=c++17 -O2 repro.cpp -o repro -I$ASCEND_HOME_PATH/include -I$ASCEND_HOME_PATH/include/aclnnop -L$ASCEND_HOME_PATH/lib64 -Wl,--allow-shlib-undefined -lascendcl -lopapi -lnnopbaseHealth=OK的卡(Health=Alarm的 die 上aclrtSetDevice会永久挂死):PROBE_DEV=<n> ./repro start(再依次end/step/out)phase1=561103。实测输出:
复现脚本
完整脚本见附件
aclnnRange_repro.cpp(d1模式跑四组)。核心:aclScalar* ps = (which == "start") ? nullptr : s; aclScalar* pe = (which == "end") ? nullptr : e; aclScalar* pst = (which == "step") ? nullptr : p; aclTensor* po = (which == "out") ? nullptr : out; uint64_t ws = 0; aclOpExecutor* ex = nullptr; aclnnStatus r1 = aclnnRangeGetWorkspaceSize(ps, pe, pst, po, &ws, &ex); printf("[%s] phase1=%d (expect 161001 per doc)\n", which.c_str(), (int)r1);