Closed
[Bug-Report|缺陷反馈]: aclnnForeachAddListInplace golden 整型 alpha 经 fp32 导致输出塌成 INT32_MIN #8501
严明奎Add on  12 days agoClosed at  12 days ago
严明奎
严明奎Collaborators
12 days ago Create

Describe the current behavior / 问题描述

foreach_add_list_inplace 的 aclnn 通路 golden(tests/assets/golden.py)在 int32 输入下,_tp_num 将 alpha 转为 float,torch 把 int32 张量列表类型提升为 float32;alpha*x2 丢低位/溢出,最终 .to(int32) 截断,输出整片变成 INT32_MIN(-2147483648),与 NPU 实际输出和算子设计(int32 直接整数运算)均不符。

Environment Information / 环境信息

  • 昇腾硬件型号:与硬件无关(仓库内 golden 实现问题)
  • CANN 版本:不适用
  • Python 版本:与算子一致,不适用

Steps to reproduce the issue / 重现步骤

  1. 使用 TTK aclnn 通路运行 ForeachAddListInplace 的 int32 极值用例(alpha=INT32_MIN/INT32_MAX)
  2. 观察 compare 日志:Expected 恒为 -2147483648,Actual 为 x1 或回绕后的正值

Describe the expected behavior / 预期结果

golden 应按 int32 的 2's-complement 回绕语义计算,与 NPU 和竞品 torch 整型结果逐位一致。

Index: 005 Expected: -2147483648 Actual: -783 Diff: -1.000000

Special notes for this issue/备注

关联 PR:https://gitcode.com/cann/ops-nn/merge_requests/13963

likedislike
严明奎严明奎Collaborators
12 days ago Added label: bug-report
CANN-robotCANN-robotCollaborators
12 days ago Close issue
CANN-robotCANN-robotCollaborators
12 days ago changed custom state from 待办的 to 已完成
CANN-robotCANN-robotCollaborators
12 days ago Added label: resolved