Closed
[Bug-Report|缺陷反馈]: quant/trans_quant_param_v2/op_kernel/trans_quant_param_v2.h 333行 不符合“涉及gm内存偏移或大小必须使用int64表示”的编码风格,建议修改 #151
duanhaomiaoAdd on Nov 17, 2025Closed at Nov 24, 2025
Nov 17, 2025 Modify description of issue
Nov 18, 2025 Assign liujie12345678 as responsible person
Nov 18, 2025 changed custom category from 任务 to 缺陷
Nov 24, 2025 Added label: Accepted
Nov 24, 2025 changed custom state from 待办的 to 已完成
Nov 24, 2025 Close issue
Mar 20 Added label: resolved


Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
Describe the current behavior / 问题描述 (Mandatory / 必填)
代码检视过程中,发现算子源码可能存在性能问题。
quant/trans_quant_param_v2/op_kernel/trans_quant_param_v2.h
333行
DataCopyLocal(offsetFp32_, offsetGm_[gmOffset], gm2UbParams);178行
DataCopyGlobal(yGm_[eachLength * loops], resTensor, ub2GmParams1);158行
DataCopy(yGm_[eachLength * loopidx], resTensor, ub2GmParams);规则描述:
【描述】:涉及shape大小需要使用int64表示。例如:Memset算子,该算子功能为将tensor所在内存清零,它的切分参数可能会有较大值。Int32的上限为2G,当代模型数据往往会超出该范围,因此必须使用int64表示。
109行:
GM_ADDR scale, GM_ADDR offset, GM_ADDR y, GM_ADDR workspace, const TransQuantParamV2TilingData* tilingData,规则描述:
要求TilingData必须不能修改,同时为了配合CCEC编译便于常量折叠和静态编译,必须添加__restrict__ 和 const 修饰符。
Environment / 环境信息 (Mandatory / 必填)
https://gitcode.com/cann/ops-nn/blob/master/quant/trans_quant_param_v2/op_kernel/trans_quant_param_v2.h
Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
检视代码即可
Describe the expected behavior / 预期结果 (Mandatory / 必填)
gm内存偏移使用int64表示
TilingData变量添加__restrict__ 和 const 修饰符。
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
无
Special notes for this issue/备注 (Optional / 选填)