Closed
[Documentation|文档反馈]: aclnnIsInScalarTensor dtype 表声明实现不支持的 UINT16/BOOL/COMPLEX64/COMPLEX128 #4108
liuhanwen8Add on  19 days agoClosed at  12 days ago
liuhanwen8
liuhanwen8
19 days ago Create

现象

math/equal/docs/aclnnIsInScalarTensor.md 的 dtype 表(L82 element、L92 testElements)声明支持:
FLOAT、FLOAT16、DOUBLE、BFLOAT16、INT8、INT16、INT32、INT64、UINT8、UINT16、BOOL、COMPLEX64、COMPLEX128。

同一文档 L150 只对 910、310p 排除 BFLOAT16、COMPLEX64、COMPLEX128,即 Atlas A2 按资料应支持 complex。

Atlas A2 910B2 实测:UINT16、BOOL、COMPLEX64、COMPLEX128 四类的第一段接口均返回 161002。

实现侧白名单 math/equal/op_api/aclnn_isin.cpp L44 ASCEND910B_DTYPE_SUPPORT_LIST 只有:
DT_FLOAT、DT_FLOAT16、DT_BF16、DT_DOUBLE、DT_INT8、DT_INT16、DT_INT32、DT_INT64、DT_UINT8。

期望

资料的 dtype 表与 910B 实现的支持面一致。两种修法任一即可:

  1. 按实现白名单收窄 L82/L92 的 dtype 列表;
  2. 若计划支持 UINT16/BOOL/COMPLEX64/COMPLEX128,先补齐实现再声明。

环境

  • 硬件:Atlas A2 910B2(单卡)
  • CANN:9.2.0
  • 系统:Ubuntu aarch64,kernel 5.15
  • 软件:torch 2.12.0+cpu、torch_npu 2.12.0.post3
  • 仓库:cann/ops-math master 5eaca23282615bfb5d84ebe3567ee92f68a15fde

复现步骤

  1. 把下方脚本保存为 check_dtype_table.py。
  2. 运行:python3 check_dtype_table.py --repo-root <ops-math 仓库根>
  3. 观察到 [DEFECT] 与退出码 1。
  4. 如需上板复核,用同 dtype 的 aclnnIsInScalarTensorGetWorkspaceSize 直调,UINT16/BOOL/COMPLEX64/COMPLEX128 均返回 161002。

复现脚本

import argparse, os, re, sys

DOC = "math/equal/docs/aclnnIsInScalarTensor.md"
IMPL = "math/equal/op_api/aclnn_isin.cpp"
CLAIM = ["UINT16", "BOOL", "COMPLEX64", "COMPLEX128"]


def dtype_cell(text, param):
    m = re.search(r"<td>%s(.*?</td>(.*?)</tr>" % re.escape(param), text, re.S)
    return m.group(1) if m else ""


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("--repo-root", default=".")
    a = ap.parse_args()
    doc = os.path.join(a.repo_root, DOC)
    impl = os.path.join(a.repo_root, IMPL)
    if not (os.path.isfile(doc) and os.path.isfile(impl)):
        print("[NEED-INPUT] missing doc or impl")
        return 2
    text = open(doc, encoding="utf-8").read()
    code = open(impl, encoding="utf-8").read()
    cell = dtype_cell(text, "element") + dtype_cell(text, "testElements")
    claimed = [d for d in CLAIM if d in cell]
    blk = re.search(r"ASCEND910B_DTYPE_SUPPORT_LIST\s*=\s*\{(.*?)\};", code, re.S)
    if not blk:
        print("[NEED-INPUT] no ASCEND910B_DTYPE_SUPPORT_LIST")
        return 2
    impl_dt = re.findall(r"DT_[A-Z0-9_]+", blk.group(1))
    missing = [d for d in claimed if "DT_" + d not in impl_dt]
    print("[INFO] doc claims:", claimed)
    print("[INFO] impl whitelist:", sorted(set(impl_dt)))
    if not missing:
        print("[OK] doc matches impl")
        return 0
    print("[DEFECT] doc declares unsupported dtype:", ", ".join(missing))
    print("         dev ret=161002 for:", ", ".join(missing))
    return 1


if __name__ == "__main__":
    sys.exit(main())

实测输出:

[INFO] doc claims: ['UINT16', 'BOOL', 'COMPLEX64', 'COMPLEX128']
[INFO] impl whitelist: ['DT_BF16', 'DT_DOUBLE', 'DT_FLOAT', 'DT_FLOAT16', 'DT_INT16',
                        'DT_INT32', 'DT_INT64', 'DT_INT8', 'DT_UINT8']
[DEFECT] doc declares unsupported dtype: UINT16, BOOL, COMPLEX64, COMPLEX128
         dev ret=161002 for: UINT16, BOOL, COMPLEX64, COMPLEX128
rc=1

影响

  • 按资料选用 UINT16/BOOL/COMPLEX64/COMPLEX128 的调用在 A2 第一段即被拒(161002),与资料声明相反。
  • COMPLEX64/COMPLEX128 在资料里只被 910/310p 排除,A2 用户据 L150 判断为支持,实际不可用。

建议

以 ASCEND910B_DTYPE_SUPPORT_LIST 为准收窄 L82/L92;若要支持这四类,需同步补齐 Equal 的 dtype 通道与资料。

likedislike
liuhanwen8liuhanwen8
19 days ago Added label: documentation
xujiachen8Collaborators
18 days ago Comments:

您好,感谢反馈!已在 cann/ops-math@b08e885e7fac370203a51904fd0680523b9a9205 核对,aclnnIsInScalarTensor 的输入 dtype 文档与 A2 接口白名单确实不一致。

文档的 element/testElements 列表包含 UINT16、BOOL、COMPLEX64、COMPLEX128,但当前 A2 白名单只包含 FLOAT、FLOAT16、BFLOAT16、DOUBLE、INT8、INT16、INT32、INT64、UINT8。CheckDtypeValid先检查两个输入,失败在第一段返回参数无效,不会进入后续比较。这里的输入 BOOL 不受支持,与输出必须是 BOOL 是两个独立约束。

文档又仅对 910/310p 排除复数,确实会使 A2 用户误认为可用。潜在调整方向是按各产品实际入口白名单修正两处输入列表及平台补充说明;如要扩展这四类,则需要核对标量转换、Cast、Equal 和 ReduceAny 的完整通路后再声明支持,不能只看某个底层比较算子的能力。

当前可以确认上述源码与文档差异,您报告的 A2/CANN 9.2.0 四类输入返回 161002 与这一入口检查相符;本轮没有独立上板复现,也不将该结论推广为所有 IsIn 变体或所有平台的支持范围。

likedislike
Xxujiachen8Collaborators
18 days ago Assign chen_0715 as responsible person
Xxujiachen8Collaborators
18 days ago Added label: pending-confirmation
陈思陈思Collaborators
18 days ago Removed label: pending-confirmation
CchenyifengCollaborators
17 days ago Assign gcw_SUaZx3UQ as responsible person
CchenyifengCollaborators
17 days ago Removed responsible person chen_0715
Zzhangqijia1Collaborators
13 days ago Associated pull request
CANN-robotCANN-robotCollaborators
12 days ago Close issue
CANN-robotCANN-robotCollaborators
12 days ago Added label: resolved