Closed
[Bug-Report|缺陷反馈]: cross_check特殊值分支误拒绝正确舍入的Promote输出 #390
raoliang_sacAdd on  20 days agoClosed at  13 days ago
raoliang_sac
20 days ago Create

Describe the current behavior / 问题描述

cross_check特殊值分支直接比较FP32输出与FP64 Promote golden。当GPU为Inf/NaN,正确舍入但不等于FP64原值的NPU输出被误报NaN/Inf mismatch。

Environment / 环境信息

ops-test-kit主线a2058078e7d650cb8511da74a1795b72410b7563;Python3.12、NumPy。设备复现使用Ascend950PR_9579、本任务CANN9.3.0 Toolkit/20260923 ops包及A100 Torch CUDA服务。

Steps to reproduce the issue / 重现步骤

使用CrossCheckComparison比较NPU float32(1)、golden float64(1+2^-24)、third_party float32(Inf)。原特殊分支判失败。FP16和负值有同类问题。

Describe the expected behavior / 预期结果

NPU与有限golden按实际输出dtype正确舍入后的结果相等时通过;偏差一个相邻浮点值仍失败。普通有限数值比较保留FP64参考与原容差。

新增24组测试修复前均失败,修复后comparison测试258项通过;RaggedBinCount原19条冻结输入真实GPU三方19/19通过。

Special notes / 备注

不改变golden、正常有限值误差比值或NaN/Inf之间的匹配规则。BN3D旧产物的3条真实数值失败重放后仍失败。

关联PR:https://gitcode.com/cann/ops-test-kit/pull/483

likedislike
RuiWang_Collaborators
19 days ago Comments:

已在 master(e5cfa88)复核:所描述行为与当前实现一致——cross_check 特殊值分支(ttk/core_modules/common/comparison/cross_check.py:191-214)规则 2 对有限位采用逐位相等比较;Promote 下 golden 以提升精度(如 fp32→fp64)生成,NPU 输出按声明 dtype 正确舍入、但与 fp64 真值逐位不等的场景会判 FAIL(reason=NaN/Inf mismatch)。

当前实现是按既有规范落地的(规则语义与现有 tests/core_modules/common/comparison/test_cross_check.py 的 NaN/Inf 用例一致)。是否改为"golden 按实际输出 dtype 正确舍入后与 NPU 相等即通过"属规范层面的变更,需要评审决策,暂不按缺陷处理;对应修改(PR 483)待评审结论后再定合入。

likedislike
RuiWang_Collaborators
13 days ago Comments:

已解决:主线 PR #518(zl_hw,3ecd9ac,2026-10-26 合入)实现了同等修复——cross_check 特殊值分支对有限 golden 按输出 dtype 折叠(fold_to_output_dtype)后再比较,Promote 输出被正确舍入时不再误拒。本 issue 关闭。

关联原 PR #483(AI 声明门禁未过,已 close 未合入,主线另路修复)。

likedislike
RRuiWang_Collaborators
13 days ago Close issue
RRuiWang_Collaborators
13 days ago Added label: resolvedbug
RRuiWang_Collaborators
7 days ago Assign wangrui_ as responsible person