Closed
[Documentation|文档反馈]: aclnnSyncBatchNormGatherStats 的 A2/A3 BF16 排除句漏列 sampleCount(实测 161002) #7474
liuhanwen8Add on 26 days agoClosed at 17 days ago
26 days ago Added label: documentation
yuning_chen
26 days ago Comments:
26 days ago Comments:
25 days ago Assign liujie12345678 as responsible person
yuning_chen
25 days ago Comments:
25 days ago Comments:
您好,问题已收到,当前 @liujie12345678 正在处理中。


24 days ago Assign gitee-duhuiping as responsible person
24 days ago Removed responsible person liujie12345678
17 days ago Close issue
16 days ago Added label: resolved
chenjiayi_
11 days ago Comments:
11 days ago Comments:
补充说明本问题的修复结果:
结论:A2/A3 的 BF16 排除句已补上 sampleCount,资料内部不再自相矛盾。
修复内容(文件/函数):
norm/sync_batch_norm_gather_stats/docs/aclnnSyncBatchNormGatherStats.md:219(npu="A3,910b"段):BF16 排除列表由totalSum、totalSquareSum、mean、variance、batchMean、batchInvstd改为并加入sampleCount。norm/sync_batch_norm_gather_stats/docs/aclnnSyncBatchNormGatherStats_en.md:同步修改英文表述。
验证:
- 静态核对:修改后的排除句与
op_api/aclnn_sync_batch_norm_gather_stats.cpp的ASCEND910_SAMPLT_COUNT_DTYPE_SUPPORT_LIST(FLOAT / FLOAT16 / INT32,不含 BF16)一致,也与 910b kernel 配置中sample_count为 int32 一致。 - 按更新后的资料,A2/A3 上 sampleCount 传 BFLOAT16 应返回 161002,与 issue 的实测结果一致。本次仅改文档。
该 issue 已随修复合入关闭。


现象
sampleCount的 BF16 支持面,资料自身矛盾,且与 Atlas A2 实测不一致:docs/aclnnSyncBatchNormGatherStats.md:130:参数表sampleCount行的「数据类型」列是BFLOAT16、FLOAT16、FLOAT、INT32;:219(<!-- npu="A3,910b" id7 -->分段):只把totalSum、totalSquareSum、mean、variance、batchMean、batchInvstd列入「数据类型不支持BFLOAT16」,未列sampleCount;INT32 → 0/0、FLOAT → 0/0、FLOAT16 → 0/0、BFLOAT16 → 161002(第一段即拒,第二段未执行)。期望
A2/A3 上
sampleCount不支持 BFLOAT16,排除句应覆盖sampleCount。应得值来源:op_api/aclnn_sync_batch_norm_gather_stats.cpp:46-50:ASCEND950_SAMPLT_COUNT_DTYPE_SUPPORT_LIST含DT_BF16,ASCEND910_SAMPLT_COUNT_DTYPE_SUPPORT_LIST仅DT_FLOAT/DT_FLOAT16/DT_INT32—— 计数 dtype 的产品差异是刻意设计;:41的 950 主 dtype 白名单含DT_BF16,:44-45的 910 主白名单仅DT_FLOAT/DT_FLOAT16,与第 1 条同构,说明 A2 整条链路不提供 BF16;kernel/ascend910b/ops_legacy/sync_batch_norm_gather_stats/SyncBatchNormGatherStats_{0,1}_high_performance.json的sample_count均为int32。环境
$ASCEND_HOME_PATH指向本机 CANN 安装目录);cann/ops-nnmaster80f6f02f(本文档 md5a38f277b,该文件最后一次改动为6d3a3af6);核对日期 2026-10-27复现步骤
check_doc.pypython3 check_doc.py --repo-root <ops-nn 仓根目录>,看退出码与[DEFECT]行复现脚本
#!/usr/bin/env python3 """断言 aclnnSyncBatchNormGatherStats 资料里 sampleCount 的 BF16 支持面自相矛盾。 用法:python3 check_doc.py --repo-root <ops-nn 根目录>;退出码 0=一致 1=缺陷 2=无法判定""" import argparse, pathlib, re, sys ap = argparse.ArgumentParser(); ap.add_argument("--repo-root", required=True) root = pathlib.Path(ap.parse_args().repo_root) doc = root / "norm/sync_batch_norm_gather_stats/docs/aclnnSyncBatchNormGatherStats.md" if not doc.is_file(): print("[SKIP] 找不到资料: %s" % doc); sys.exit(2) t = doc.read_text(encoding="utf-8") m = re.search(r"<tr>(?:(?!</tr>).)*?<td>sampleCount(aclTensor\*)</td>.*?</tr>", t, re.S) ex = re.search(r'<!--\s*npu="A3,910b"[^>]*-->(.*?)<!--\s*end', t, re.S) if not m or not ex: print("[SKIP] 参数表 sampleCount 行或 npu=" + '"A3,910b"' + " 分段缺失"); sys.exit(2) row, excl = m.group(0), ex.group(1) has = "BFLOAT16" in row print("① sampleCount 的「数据类型」列含 BFLOAT16 = %s" % has) print("② A2/A3 的 BF16 排除句含 sampleCount = %s" % ("sampleCount" in excl)) print(" 排除句原文: %s" % " ".join(excl.split())[:140]) if has and "sampleCount" not in excl: print("[DEFECT] 参数表声明 sampleCount 支持 BFLOAT16,但 A2/A3 的 BF16 排除句未覆盖它" " ⇒ 资料对 A2/A3 上该参数的支持面表述与实现(实测第一段 161002)矛盾") sys.exit(1) print("[OK] 该参数的 BF16 支持面在资料内部自洽"); sys.exit(0)实测输出(
cann/ops-nnmaster80f6f02f):影响
161002(参数非法),需反查op_api白名单才能判断是「产品不支持」而非自己参数写错;sampleCount漏列,属于资料内部自相矛盾(表列含 BF16 + 排除句不含);仅影响 dtype 选择,不改变数值结果。建议
二选一(推荐第 1 条,与现网实现一致、只改一行):① 在
:219的排除句补sampleCount;② 若设计上 A2/A3 应支持 BF16 计数(op_api会把sampleCount统一Cast到 int32,链路本身支持),则把DT_BF16加入ASCEND910_SAMPLT_COUNT_DTYPE_SUPPORT_LIST并同步 kernel 声明。查重:同仓未搜到本接口的相关 issue;同类「声明面与实现面不一致」的既有条目是 #7353(aclnnGroupNormSiluQuant)、#7361(aclnnGemm),接口与字段均不同,故单独开本条。