Closed
[Documentation|文档反馈]: [aclnnIsPosInf] 资料 self 数据类型表与头文件/实现支持面不一致(多列 DOUBLE,漏列 6 种整型与 BOOL) #4354
liuhanwen8Add on 17 days agoClosed at 13 days ago
17 days ago Added label: documentation
陈思
17 days ago Comments:
17 days ago Comments:
您好,感谢反馈!
按您注明的 ops-math 提交 365f17f0302ed5da125337d712924984e34ed892 核查,self 类型表确有错列和漏列。A2 的实际白名单为 FLOAT、FLOAT16、BFLOAT16、INT32、INT64、INT16、INT8、UINT8、BOOL,不含 DOUBLE,且与接口头文件一致。DOUBLE 会在第一阶段的 dtype 检查中被拒绝并返回 161002,与您报告的结果相符。
整型和 BOOL 的支持也有明确实现:第一阶段对这些有界类型生成全 false 结果,随后拷贝到输出;因此它们无需单独的 IsPosInf 整型计算 kernel。输出仍要求 BOOL,shape 与 self 一致。
可行的修订方向是删除文档中的 DOUBLE,补齐上述五种整型和 BOOL,并保留产品差异:310P 对应的 Atlas 推理系列分支不支持 BFLOAT16。这样可以准确描述现有 API 支持范围;新增 DOUBLE 能力需要另行评估实现支持。我们会继续跟踪类型表与接口定义的对齐。


17 days ago Assign chen_0715 as responsible person
17 days ago Added label: pending-confirmation
15 days ago Removed label: pending-confirmation
14 days ago Assign m0_55003149 as responsible person
14 days ago Removed responsible person chen_0715
13 days ago Close issue
13 days ago Added label: resolved
现象
一句话结论:
aclnnIsPosInf的资料把self的数据类型写成「FLOAT、FLOAT16、DOUBLE、BFLOAT16」,但头文件与实现的 910B 白名单里都没有 DOUBLE ——按资料写 fp64 的调用在第一段就返回
161002;同时资料漏列了实现实际接受的 6 种整型/BOOL。真机对照(Ascend 910B3 / CANN 9.2.0,同一份探针):
self=fp64[4]self=int32[4]self=fp32[4]同形为对照组self=bool[4]期望
引资料原文(
math/is_pos_inf/docs/aclnnIsPosInf.md,章节「aclnnIsPosInfGetWorkspaceSize → 参数说明」):「FLOAT、FLOAT16、DOUBLE、BFLOAT16」 →
因此
self传 fp64 时应当被接受并正常计算,不应在第一段返回161002。同时该表应与头文件
op_api/aclnn_isposinf.h:48-49、实现op_api/aclnn_isposinf.cpp:39-42的910B 白名单逐项一致;后两处都写的是 9 种(含
INT32/INT64/INT16/INT8/UINT8/BOOL,无 DOUBLE)。环境
npu-smi26.1.1cann/ops-math365f17f(master,稀疏检出math/is_pos_inf)复现步骤
repro.pycann/ops-math仓根执行python3 repro.py --repo-root .[DEFECT],退出码1真机侧附证(可选):
probe_isposinf_contract.cpp里self=fp64[4]返回161002、self=int32[4]返回0。复现脚本
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """aclnnIsPosInf 资料 dtype 表与头文件/实现支持面不一致(条目 2.2-07)。""" import os import re import sys DOC = "math/is_pos_inf/docs/aclnnIsPosInf.md" HDR = "math/is_pos_inf/op_api/aclnn_isposinf.h" IMPL = "math/is_pos_inf/op_api/aclnn_isposinf.cpp" INTS = ("INT32", "INT64", "INT16", "INT8", "UINT8", "BOOL") def main(): root = sys.argv[sys.argv.index("--repo-root") + 1] if "--repo-root" in sys.argv else "." txt = {} for name in (DOC, HDR, IMPL): path = os.path.join(root, name) if not os.path.isfile(path): print("[SKIP] 缺文件:%s" % name) return 2 txt[name] = open(path, encoding="utf-8", errors="replace").read() m = re.search(r"<td>(FLOAT[^<]*)</td>", txt[DOC]) doc_dt = (m.group(1) if m else "").strip() hdr = re.search(r"@param \[in\] self:(.*?)(?:\n \*\s*@|\*/)", txt[HDR], re.S).group(1) impl = re.search(r"ASCEND910B_DTYPE_SUPPORT_LIST\s*=\s*\{(.*?)\};", txt[IMPL], re.S).group(1) print("资料 dtype = %s" % doc_dt) print("头文件 DOUBLE=%s 整型/BOOL=%d 种" % ("DOUBLE" in hdr, sum(n in hdr for n in INTS))) print("实现白名单 DOUBLE=%s 整型/BOOL=%d 种" % ("DT_DOUBLE" in impl, sum("DT_" + n in impl for n in INTS))) bad = 0 if "DOUBLE" in doc_dt and "DOUBLE" not in hdr and "DT_DOUBLE" not in impl: print("[DEFECT] 资料列了 DOUBLE,头文件与实现的 910B 白名单都没有 → " "按资料写 fp64 的调用在第一段即被 161002 拒绝") bad += 1 if all(n in hdr for n in INTS) and all("DT_" + n in impl for n in INTS) \ and not any(n in doc_dt for n in INTS): print("[DEFECT] 头文件与实现都接受 %s,资料只列 %d 种浮点 → 漏列 6 种实际支持的 dtype" % ("/".join(INTS), len(doc_dt.split("、")))) bad += 1 if not bad: print("[OK] 资料 dtype 表与头文件/实现一致") return 0 return 1 if __name__ == "__main__": sys.exit(main())实测输出(退出码 1):
原文片段(
math/is_pos_inf/docs/aclnnIsPosInf.md:79,逐字复制):影响
161002),无 workaround:CheckDtypeValid是第一段第一道校验,先于任何 cast。INT32/INT64/INT16/INT8/UINT8/BOOL,用户不会想到这些类型可用,能力被埋没。.../kernel/ascend910b/ops_legacy/is_pos_inf/下只有float16/float32/bfloat16三个 kernel json,无double。建议
优先改资料
math/is_pos_inf/docs/aclnnIsPosInf.md:79:删掉DOUBLE,补上INT32、INT64、INT16、INT8、UINT8、BOOL,与头文件op_api/aclnn_isposinf.h:48-49对齐。若产品确实要支持 DOUBLE,则需在
op_api/aclnn_isposinf.cpp:39-42与op_host/is_pos_inf_def.cpp同步补DT_DOUBLE及对应 kernel 二进制 —— 仓内三处只有资料一份写 DOUBLE,按少数服从多数应先改资料。