Closed
[Bug-Report|缺陷反馈]: aclnnRmsNormGradQuant 不支持的 dtype 返回 561103(资料要求 161002,实测 561103) #8105
liuhanwen8Add on 18 days agoClosed at 4 days ago
18 days ago Added label: bug-report
17 days ago Assign yourealize as responsible person
yuning_chen
17 days ago Comments:
17 days ago Comments:
yuning_chen
17 days ago Comments:
17 days ago Comments:
您好,该问题已收到,当前问题 @yourealize 正在处理中


12 days ago Assign sxb154714 as responsible person, remove original responsible person: yourealize
12 days ago Assign sxb154714 as responsible person, remove original responsible person: yourealize
yuning_chen
12 days ago Comments:
12 days ago Comments:
您好,该问题已收到,当前问题 @sxb154714 正在处理中


11 days ago Assign liujie12345678 as responsible person, remove original responsible person: sxb154714
11 days ago Assign liujie12345678 as responsible person, remove original responsible person: sxb154714
11 days ago Assign sun-yibo1 as responsible person, remove original responsible person: liujie12345678
11 days ago Assign sun-yibo1 as responsible person, remove original responsible person: liujie12345678
chenjiayi_
10 days ago Comments:
10 days ago Comments:
结论:master 的 aclnn 入口当前只做空指针检查,dy 的 dtype 白名单校验在 Contiguous 之前缺失,UINT8 会在 Contiguous 处变成空指针并返回 561103。
norm/rms_norm_grad_quant/op_api/aclnn_rms_norm_grad_quant.cpp:92-93只调用CheckNotNull;:107-118直接对dy/x/rstd/gamma/scalesX做Contiguous,任一返回空指针就映射为ACLNN_ERR_INNER_NULLPTR。- 资料 950 分段对
dy/x列出 FLOAT16、BFLOAT16、FLOAT32,对dxOut列出 HIFLOAT8、INT8,对dgammaOut列出 FLOAT32;错误码表把“数据类型在支持范围之外”归入 161002。 - 建议在
Contiguous前增加CheckDtypeValid,按上述三组白名单逐项校验,命中范围之外返回ACLNN_ERR_PARAM_INVALID;同时补 UINT8dy、UINT8x两条负向 UT,以及 FP16/BF16/FP32 三条正向 UT。
这样 561103 只保留给真实的内部空指针场景,参数错误稳定返回 161002。


10 days ago Associated pull request
10 days ago Modify description of issue
10 days ago Assign chenjiayi_ as responsible person
4 days ago Close issue
4 days ago changed custom state from 进行中 to 已完成
4 days ago Added label: resolved
1 day ago Removed responsible person chenjiayi_
关联:#7997(同一根因:参数非法被 561103 内部错误码掩盖;本条差异:接口为 aclnnRmsNormGradQuant,非法项是入参
dy的 dtype=UINT8)现象
一句话结论:
aclnnRmsNormGradQuant在入参dy传入资料未支持的UINT8时,第一段接口返回 561103(ACLNN_ERR_INNER_NULLPTR),而资料要求返回 161002(ACLNN_ERR_PARAM_INVALID)。与合法输入的对照(同一份脚本,只改
dy/x的 dtype):dy=x=fp16[2,64]/bf16/fp32(资料支持)dy=x=uint8[2,64](资料不支持)期望
资料《aclnnRmsNormGradQuant》「错误码」表(位于
npu=分组段之外,对全部产品生效)写明:「ACLNN_ERR_PARAM_INVALID 161002 输入或输出的数据类型不在支持范围之内。」
被测产品为 Ascend 950PR。「约束说明」的
npu="950"分段原文为「Ascend 950PR&950DT系列产品:」,其下表
dy/x列取值只有FLOAT16、BFLOAT16、FLOAT32,dxOut列取值只有HIFLOAT8、INT8。UINT8不在其中,属「数据类型不在支持范围之内」的情形。本条不主张支持类型清单有误(清单与实现一致:UINT8 确实不被支持);
本条只针对「该拒绝时返回哪个错误码」:资料与实现不符——该调用应返回 161002,
实测返回
ACLNN_ERR_INNER_NULLPTR(561103,语义是「内部空指针」,定义见include/aclnn/opdev/op_errno.h:24)。环境
npu-smi25.7.rc1),单卡npu:0cann/ops-nnmaster1efeb5c2e(git fetch于 2026-11-04);git log 0fc301c67..1efeb5c2e -- norm/rms_norm_grad_quant为空,该路径本轮无改动复现步骤
repro.cppg++ -O2 -std=c++17 repro.cpp -o repro -I$ASCEND_HOME_PATH/include -I$ASCEND_HOME_PATH/include/aclnnop -L$ASCEND_HOME_PATH/lib64 -lascendcl -lopapi -lnnopbaseexport LD_LIBRARY_PATH=$ASCEND_HOME_PATH/lib64:$LD_LIBRARY_PATH && ./reproret=0(对照),最后一行defect(uint8)应为ret=161002,实测ret=561103复现脚本
#include <acl/acl.h> #include <aclnnop/aclnn_rms_norm_grad_quant.h> #include <cstdio> #include <vector> // 建 ND 张量:host 全 1 数据 -> device static aclTensor* mk(const std::vector<int64_t>& shape, aclDataType dt) { size_t n = 1; for (auto d : shape) n *= (size_t)d; void* dev = nullptr; aclrtMalloc(&dev, n * 4, ACL_MEM_MALLOC_HUGE_FIRST); std::vector<float> host(n, 1.0f); aclrtMemcpy(dev, n * 4, host.data(), n * 4, ACL_MEMCPY_HOST_TO_DEVICE); return aclCreateTensor(shape.data(), shape.size(), dt, nullptr, 0, ACL_FORMAT_ND, shape.data(), shape.size(), dev); } // 只调第一段接口;dy 的 dtype 是唯一变量 static int probe(aclDataType dyDt, aclDataType gDt, const char* grp, const char* tag) { aclTensor* dy = mk({2, 64}, dyDt); aclTensor* x = mk({2, 64}, dyDt); aclTensor* rstd = mk({2}, ACL_FLOAT); aclTensor* gamma = mk({64}, gDt); aclTensor* scales = mk({1}, ACL_FLOAT); aclTensor* dx = mk({2, 64}, ACL_INT8); aclTensor* dgamma = mk({64}, ACL_FLOAT); uint64_t ws = 0; aclOpExecutor* ex = nullptr; aclnnStatus ret = aclnnRmsNormGradQuantGetWorkspaceSize( dy, x, rstd, gamma, scales, nullptr, "static", false, dx, dgamma, &ws, &ex); printf("%s return code = %d (dy_dtype=%d, %s)\n", grp, (int)ret, (int)dyDt, tag); return (int)ret; } int main() { aclInit(nullptr); aclrtSetDevice(0); aclrtContext ctx = nullptr; aclrtCreateContext(&ctx, 0); // 对照组:资料列出的支持 dtype,应返回 0 probe(ACL_FLOAT16, ACL_FLOAT16, "CTRL", "fp16"); probe(ACL_BF16, ACL_BF16, "CTRL", "bf16"); probe(ACL_FLOAT, ACL_FLOAT, "CTRL", "fp32"); // 缺陷组:UINT8 不在资料支持列表,应返回 161002,实测 561103 probe(ACL_UINT8, ACL_FLOAT16, "DEFECT", "uint8"); aclrtDestroyContext(ctx); aclrtResetDevice(0); aclFinalize(); return 0; }实测输出:
影响
实际是调用方传错 dtype,重试永远不会成功,也无法得到可读的参数错误提示。
aclnn_rms_norm_grad_quant.cpp:55-92),dtype 不在支持范围时
l0op::RmsNormGradQuant返回空(:131),被
CHECK_RET(..., ACLNN_ERR_INNER_NULLPTR)(:135)统一改写为 561103。建议
在
norm/rms_norm_grad_quant/op_api/aclnn_rms_norm_grad_quant.cpp的CheckNotNull(:55-74)之后、l0op::Contiguous(:108)之前,补一个 dtype 组合白名单校验(按资料
npu="950"分段的 18 行组合表),不匹配时返回ACLNN_ERR_PARAM_INVALID;或至少把
:135的「l0op 返回空」区分为 dtype 不支持(161002)与真正的内部错误(561103)。关联 PR:https://gitcode.com/cann/ops-nn/pull/14322