Closed
[Documentation|文档反馈]: aclnnIsInTensorScalar 的 161002 错误码表缺 out dtype / out shape / testElement dtype 三个子项 #4248
liuhanwen8Add on  12 days agoClosed at  1 day ago
liuhanwen8
liuhanwen8
12 days ago Create

现象

资料:math/equal/docs/aclnnIsInTensorScalar.md(
https://gitcode.com/cann/ops-math/blob/master/math/equal/docs/aclnnIsInTensorScalar.md#L176 )
锚点:L176-L181,ACLNN_ERR_PARAM_INVALID / 161002 的两个子项。

逐字原文(L176-L181,161002 用 <td rowspan="2"> 折叠):

      <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>
      <td rowspan="2">161002</td>
      <td>element的数据类型不在支持范围之内。</td>
    </tr>
    <tr>
      <td>element的维度超过8维。</td>

即 161002 只声明了 2 个子项,两条都只讲 element。而实现的第一段接口对另外三处入参也做
校验,失败时同样返回 161002,资料没有对应子项:

序 实现校验点(math/equal/op_api/aclnn_isin_tensor_scalar.cpp) 失败返回 资料是否列
1 out 数据类型不是 BOOL(L146 OP_CHECK_DTYPE_NOT_MATCH) 161002 否
2 out 的 shape 与 element 不一致(L173 OP_CHECK_SHAPE_NOT_EQUAL) 161002 否
3 testElement 的数据类型不在支持面(L144 OP_CHECK_DTYPE_NOT_SUPPORT) 161002 否

资料参数表已写明「out 数据类型为 BOOL。shape 与 element 相同」,但错误码表没有列出这两条
约束被违反时的返回码;testElement 一节只写「数据类型需要与 element 满足数据类型推导规则」,
没有写不满足时返回什么码。

期望

161002 补齐 3 个子项:out 的数据类型不是 BOOL、out 的 shape 与 element 不一致、
testElement 的数据类型不在支持范围。若错误码表有意只列 element 相关子项,请在
「约束说明」里写明这三类不满足时同样返回 161002。

环境

  • 芯片 Ascend 910B3(Atlas A2 系列);CANN 9.2.0;Python 3.12(复现脚本只用标准库)
  • 仓与提交:cann/ops-math master c171dab56e5662a3a5cf75d01f1fda8fadfd5f37
    (git log --oneline -1 = c171dab5 ClampMax / InplaceClampMax 增加输入越界检查)

复现步骤

  1. git clone https://gitcode.com/cann/ops-math.git && cd ops-math
  2. 把下面「复现脚本」里的代码保存为 repro_isin_tensor_scalar_errtable.py(放在仓根目录)
  3. 执行 python3 repro_isin_tensor_scalar_errtable.py
  4. 看退出码:1 = 缺陷成立([DEFECT] 三行);0 = 资料已补齐

复现脚本

import html, re, sys
DOC = "math/equal/docs/aclnnIsInTensorScalar.md"
s = open(DOC, encoding="utf-8").read()
t = re.search(r"第一段接口完成入参校验.*?</table>", s, re.S).group(0)
rows = []
for tr in re.findall(r"<tr>(.*?)</tr>", t, re.S):
    cells = [html.unescape(re.sub(r"<[^>]+>", "", c)).strip()
             for c in re.findall(r"<td[^>]*>(.*?)</td>", tr, re.S)]
    if cells:
        rows.append(cells)
descs, cur = [], None
for c in rows:
    if len(c) >= 3:
        cur = c[1] or cur
        if cur == "161002":
            descs.append(c[2])
    elif len(c) == 1 and cur == "161002":
        descs.append(c[0])
text = " ".join(descs)
print("161002 子项:", descs)
miss = []
if not ("out" in text and "BOOL" in text.upper()):
    miss.append("out 的数据类型不是 BOOL")
if not ("out" in text and "shape" in text.lower()):
    miss.append("out 的 shape 与 element 不一致")
if "testElement" not in text:
    miss.append("testElement 的数据类型不在支持范围")
for m in miss:
    print("[DEFECT] 161002 缺子项:", m)
sys.exit(1 if miss else 0)

实测输出(python3 repro_isin_tensor_scalar_errtable.py,master c171dab5):

161002 子项: ['element的数据类型不在支持范围之内。', 'element的维度超过8维。']
[DEFECT] 161002 缺子项: out 的数据类型不是 BOOL
[DEFECT] 161002 缺子项: out 的 shape 与 element 不一致
[DEFECT] 161002 缺子项: testElement 的数据类型不在支持范围

退出码 1。

影响

  1. 使用者按错误码表排查 161002 时会看到文档里不存在的三种原因,容易误判成内部错误。
  2. 参数表对 out 的 dtype / shape 有明确约束,错误码表却无对应项,两份表口径不一致。
  3. 同仓已有同类问题在修(如 aclnnLog10 的 161002 缺「self 与 out 的 shape 不一致」子项)。

上板佐证(Ascend 910B3 / CANN 9.2.0,第一段接口返回码):

变体 关键参数 实测返回码
基线(阴性对照) element=fp32[4,4]、testElement=fp32(2)、out=bool[4,4] 0(两段均 0)
out dtype 非 BOOL out=fp32[4,4] 161002
out shape 不一致 out=bool[4,8](element [4,4]) 161002
testElement dtype 非法 testElement 以 BOOL 创建 161002

阴性对照基线两段都返回 0,说明探针本身有判据资格,这三个 161002 不是构造错误。

建议

在 aclnnIsInTensorScalar.md 的 161002 行下增加 3 条子项(与 aclnnLog10 的修法一致):
out的数据类型不是BOOL。 / out的shape与element不一致。 / testElement的数据类型不在支持范围之内。

likedislike
liuhanwen8liuhanwen8
12 days ago Added label: documentation
陈思
陈思Collaborators
11 days ago Comments:

您好,核对 ae087b184,错误码表 的 161002 说明确实没有覆盖当前实现的全部检查。

CheckDtypeValid / CheckShape 会检查 testElement 类型、out 是否为 BOOL、out 与 element 的形状是否一致,失败均由 CheckParams 返回 ACLNN_ERR_PARAM_INVALID。此外实现还检查 out 维度及推导类型是否受支持,修订时可一并对齐,避免只补三项后继续遗漏。

建议在 161002 条目补齐这些条件,保留参数表已有约束,并按产品支持列表描述类型范围。此项是返回码说明缺失,不需要改变参数校验;您提供的 910B3 结果与该路径一致,本轮未重复设备测试。

likedislike
陈思陈思Collaborators
11 days ago Assign chen_0715 as responsible person
陈思陈思Collaborators
11 days ago Added label: pending-confirmation
陈思陈思Collaborators
11 days ago Removed label: pending-confirmation
CchenyifengCollaborators
11 days ago Assign sakuraqqz as responsible person
CchenyifengCollaborators
11 days ago Removed responsible person chen_0715
SsakuraqqzCollaborators
6 days ago Associated pull request
CANN-robotCANN-robotCollaborators
1 day ago Close issue
CANN-robotCANN-robotCollaborators
1 day ago changed custom state from 进行中 to 已完成
CANN-robotCANN-robotCollaborators
1 day ago Added label: resolved