Closed
[Documentation|文档反馈]: aclnnSituGlu 错误码表 4 个子项与实测不符(561001 三子项实测 561002、out dtype 实测 161002) #7743
liuhanwen8Add on 23 days agoClosed at 18 days ago
23 days ago Added label: documentation
23 days ago Assign east_yang as responsible person
yuning_chen
23 days ago Comments:
23 days ago Comments:
yuning_chen
23 days ago Comments:
23 days ago Comments:
您好,该问题已收到,当前问题 @east_yang 正在处理中


east_yang
19 days ago Comments:
19 days ago Comments:
/unassign @east_yang


19 days ago Removed responsible person east_yang
east_yang
19 days ago Comments:
19 days ago Comments:
/assign @fengying555682


19 days ago Assign fengying555682 as responsible person
18 days ago Assign guijianwei as responsible person
18 days ago Removed responsible person fengying555682
18 days ago Close issue
17 days ago Added label: resolved
现象
Document Link(文档链接):https://gitcode.com/cann/ops-nn/blob/master/activation/situ_glu/docs/aclnnSituGlu.md
(错误码表在「aclnnSituGluGetWorkspaceSize → 返回值」一节)
Issues Section(问题文档片段):错误码表 4 个子项里,3 个子项声明 561001、1 个声明 561002,
实测分别是 561002 与 161002(逐条见下)。
原文(错误码表,逐字复制节选):
参数表
x行「维度(shape)」原文:1-8期望
Existing Issues(存在的问题):错误码表四个子项与实测返回码不符(Atlas A2 910B2 / CANN 9.2.0,
aclnnSituGlu两段式直调):dim越界([-rank, rank-1])x=fp32[2x32]、out=fp32[2x16]、dim=2(dim=-3同)x在dim方向非偶数x=fp32[2x3]、out=fp32[2x1]、dim=-1x/out的 shape 维度不在支持范围out的数据类型与x不匹配x=fp32[2x32]、out=fp16[2x16]资料声明「dim 越界 / 奇数切分 / shape 维度越界 → 561001,out dtype 不匹配 → 561002」,实测应为「前三者 561002、最后一者 161002」,或让实现补上 infershape 校验使 561001 真正可达。原因:aclnn 单算子直调不跑 infershape,
dim范围 /%2/ out 形状都在 tiling 里判,561001 在 A2 上不可达;outdtype 不一致在参数校验阶段即被拦成 161002。同族aclnnSituGluGrad有过同类单(#7156)。环境
npu-smi 26.1.1)、CANN 9.2.0 aarch64、g++ 11.4.0cann/ops-nnc46db05f5bb5155691263ea24a5f10b10547a28a,复现日期 2026-10-30复现步骤
repro.cppg++ -std=c++17 -O2 repro.cpp -o repro -I$ASCEND_HOME_PATH/include -L$ASCEND_HOME_PATH/lib64 -lascendcl -lopapi -lnnopbase && ./repro实测输出:
复现脚本
上板探针(改
dim/outdtype 即可覆盖上表各行):#include <cstdio> #include <vector> #include "acl/acl.h" #include "aclnnop/aclnn_situ_glu.h" static void Run(const std::vector<int64_t>& xs, int64_t dim, aclDataType odt, const std::vector<int64_t>& os) { std::vector<float> xh(64, 1.0f), oh(64, 0.0f); aclTensor *x = nullptr, *o = nullptr; void* xd = nullptr; void* od = nullptr; size_t xn = 64 * 4, on = 64 * 4; aclrtMalloc(&xd, xn, ACL_MEM_MALLOC_HUGE_FIRST); aclrtMalloc(&od, on, ACL_MEM_MALLOC_HUGE_FIRST); aclrtMemcpy(xd, xn, xh.data(), xn, ACL_MEMCPY_HOST_TO_DEVICE); aclrtMemcpy(od, on, oh.data(), on, ACL_MEMCPY_HOST_TO_DEVICE); std::vector<int64_t> s1(xs.size(), 1), s2(os.size(), 1); for (int i = (int)xs.size() - 2; i >= 0; i--) s1[i] = xs[i + 1] * s1[i + 1]; for (int i = (int)os.size() - 2; i >= 0; i--) s2[i] = os[i + 1] * s2[i + 1]; x = aclCreateTensor(xs.data(), xs.size(), ACL_FLOAT, s1.data(), 0, ACL_FORMAT_ND, xs.data(), xs.size(), xd); o = aclCreateTensor(os.data(), os.size(), odt, s2.data(), 0, ACL_FORMAT_ND, os.data(), os.size(), od); uint64_t ws = 0; aclOpExecutor* ex = nullptr; int rg = (int)aclnnSituGluGetWorkspaceSize(x, dim, 1.0, 0.0, true, o, &ws, &ex); printf("ret_gws=%d\n", rg); aclDestroyTensor(x); aclDestroyTensor(o); aclrtFree(xd); aclrtFree(od); } int main() { aclInit(nullptr); aclrtSetDevice(0); Run({2, 32}, 2, ACL_FLOAT, {2, 16}); // A 期望 561001 Run({2, 32}, -3, ACL_FLOAT, {2, 16}); // B 期望 561001 Run({2, 3}, -1, ACL_FLOAT, {2, 1}); // C 期望 561001 Run({2, 32}, -1, ACL_FLOAT16, {2, 16}); // D 期望 561002 aclFinalize(); return 0; }编译:
g++ -std=c++17 -O2 repro.cpp -o repro -I$ASCEND_HOME_PATH/include -L$ASCEND_HOME_PATH/lib64 -lascendcl -lopapi -lnnopbase影响
调用方按资料写错误分支会对不上(把参数错误当内部故障排查),且 561001 整类在 A2 上不可达,判据形同空条款。
建议
以实测码订正错误码表(三个 561001 子项改 561002、out dtype 子项改 161002),或补齐 infershape 让 561001 可达;
x/out维度支持面(实测 1–25 维可用)一并与实际对齐。