已关闭
[Bug-Report|缺陷反馈]: norm/add_rms_norm/op_kernel/add_rms_norm.h 107行 291行 299行 不符合“涉及gm内存偏移或大小必须使用int64表示”的编码风格,建议修改 #149
duanhaomiao创建于  2025年11月17日关闭于  2025年11月24日
duanhaomiao
duanhaomiao
2025年11月17日 创建

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

Describe the current behavior / 问题描述 (Mandatory / 必填)

代码检视过程中,发现算子源码可能存在性能问题。
index\apply_top_k_top_p_with_sorted\op_kernel\apply_top_k_top_p_with_sorted.h
107行
DataCopyCustom<T>(x1Local_in, x1Gm[gm_bias], numCol);
108行
DataCopyCustom<T>(x2Local, x2Gm[gm_bias], numCol);
138行:
DataCopyCustom<T>(xGm[gm_bias], x_out, numCol);
291行
DataCopyCustom<T>(yGm[progress], yLocal, numCol);
299行
DataCopyCustom<float>(rstdGm[outer_progress * rowFactor], rstdLocal, num);

norm/add_rms_norm/op_kernel/add_rms_norm_merge_n.h
114行:
DataCopyCustom<T>(x1Local, x1Gm[gm_bias], calc_row_num * numCol);
116行:
DataCopyCustom<T>(x1Local, x1Gm[gm_bias], calc_row_num, numCol);
121行:
DataCopyCustom<T>(x2Local, x2Gm[gm_bias], calc_row_num * numCol);
123行:
DataCopyCustom<T>(x2Local, x2Gm[gm_bias], calc_row_num, numCol);
157行:
DataCopyCustom<T>(xGm[gm_bias], xOut, calc_row_num * numCol);
159行:
DataCopyCustom<T>(xGm[gm_bias], xOut, calc_row_num, numCol);
262行:
DataCopyCustom<T>(yGm[progress], yLocal, calc_row_num, numCol);
271行:
DataCopyCustom<float>(rstdGm[outer_progress * rowFactor], rstdLocal, num);

规则描述:
【描述】:涉及shape大小需要使用int64表示。例如:Memset算子,该算子功能为将tensor所在内存清零,它的切分参数可能会有较大值。Int32的上限为2G,当代模型数据往往会超出该范围,因此必须使用int64表示。

Environment / 环境信息 (Mandatory / 必填)

https://gitcode.com/cann/ops-nn/blob/master/norm/add_rms_norm/op_kernel/add_rms_norm.h
https://gitcode.com/cann/ops-nn/blob/master/norm/add_rms_norm/op_kernel/add_rms_norm_merge_n.h

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

检视代码即可

Describe the expected behavior / 预期结果 (Mandatory / 必填)

gm内存偏移使用int64表示

无

Special notes for this issue/备注 (Optional / 选填)

likedislike
胡一航成员
2025年11月18日 评论:

感谢反馈,正在安排人修改

likedislike
张喻翔张喻翔
2025年11月18日 将 liujie12345678 设为负责人
duanhaomiaoduanhaomiao
2025年11月18日 issue类型由 任务 改变为 缺陷
张喻翔张喻翔
2025年11月24日 添加了label:Accepted
duanhaomiaoduanhaomiao
2025年11月24日 issue状态由 待办的 改变为 已完成
duanhaomiaoduanhaomiao
2025年11月24日 关闭了 issue
CANN-robotCANN-robot成员
3月20日 添加了label:resolved