已关闭
[Bug-Report|缺陷反馈]: 在CANN8.5.1 下执行社区master下移植的RadixTopk算子在某些shape下出现精度与CANN8.5.1下自带的TopK精度不一致的情况,请分析,谢谢 #2757
LetsAiGo创建于  29 天前关闭于  15 天前
LetsAiGo
29 天前 创建

Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.

一、问题描述 (必填)

在CANN8.5.1 下运行社区master下移植的RadixTopk算子在某些shape下出现精度与CANN8.5.1下自带的TopK精度不一致的情况,请分析,谢谢

同时执行如下shape时,报错 ((1,67815225), -1, 3802), 精度问题,
((1,908209), -1, 1254),
((1,7847955), -1, 3796),
((1,67815225), -1, 3802),
image.png

如果只执行 报错 ((1,67815225), -1, 3802)的shape时,则无精度问题
image.png

二、环境信息 (可选)

三、重现步骤 (可选)

一个shape单独执行无问题,正常
多个shape一起执行时,输出结果 与cann包自带torch.topk对比 报错精度不匹配

四、预期结果 (可选)

多个shape一起执行时 与 单个shape执行时 算子都精度都正常

💡 备注(选填)

likedislike
陈思
陈思成员
28 天前 评论:

初步分析

现有截图能确认:参数化用例连续执行三个 shape 后,(1, 67815225), dim=-1, k=3802 的 BF16 用例出现 745 个超差,而该 shape 单独执行通过。但这还不能直接证明 RadixTopK 存在跨调用状态污染:如果每个参数用例都重新随机生成输入,多 shape 和单 shape 两种运行方式会消费不同的随机数序列,因此最后一个 shape 实际拿到的可能不是同一份 tensor。

当前源码中也能看到 workspace/UB 清零及同步路径,仅凭截图暂时无法定位到具体遗漏点。

likedislike
sunchun成员
28 天前 评论:
likedislike
CANN-robotCANN-robot成员
28 天前 将 huang-wei-chen 设为负责人
Hhuang-wei-chen成员
28 天前 关联了pull request:修复RadixTopK同步错误
CANN-robotCANN-robot成员
15 天前 关闭了 issue
CANN-robotCANN-robot成员
15 天前 添加了label:resolved