Closed
[Bug-Report|缺陷反馈]: Lamb 系列算子空 Tensor tiling 有效长度错误及 LambNextRight 乘法顺序修正 #8853
陈思Add on 6 days agoClosed at 6 days ago
6 days ago Added label: bug-report
6 days ago Close issue
6 days ago changed custom state from 待办的 to 已完成
5 days ago Added label: resolved
Describe the current behavior / 问题描述
Ascend 950(arch35)下,LambNextRight、LambApplyWeightAssign、LambUpdateWithLr、LambUpdateWithLrV2 的空 Tensor 分支使用
GetRawTilingData()->GetCapacity()作为有效 tiling data 长度,并按整个容量清零。缓冲区容量并不代表实际结构体长度。PR #14193 描述记录:测试环境中容量为 2 MB,编译器预留 tiling 空间为 64 KB,导致 LambNextRight 空 Tensor 用例静态编译导出 tiling 结果失败。
此外,当前 PR 的 LambNextRight kernel 和 golden 差异将
v*b2 + (g*g)*(1-b2)调整为v*b2 + (g*(1-b2))*g;golden 注释说明该调整用于避免g*g提前溢出。Environment Information / 环境信息
op_host/arch35/,LambNextRight 的op_kernel/arch35/。ascend950。/home/c00947812/Ascend_9.1.0/cann-9.1.0。Steps to reproduce the issue / 重现步骤
bash build.sh --pkg --soc=ascend950 --ops=lamb_next_right --vendor_name=lamb_next_right -j8。LambNextRight_L1_empty_highpre_028,使用 CST 静态编译路径。SetDataSize(emptyCap),当容量为 2 MB 时,将容量作为有效长度提交,超过上述编译器预留空间。当前 PR 补充的 UT 覆盖四个算子的 FP16/FP32、容量为 0/1/结构体长度减一/恰好结构体长度/结构体长度加 16/2 MB,以及空 tiling 对象、空数据指针场景。
Describe the expected behavior / 预期结果
schMode=1对应的BroadcastBaseTilingData<...::OpDag>结构体大小作为有效长度,仅清零该结构体范围。v*b2 + (g*(1-b2))*g。Related log / screenshot / 日志 / 截图
PR 描述记录的修复后结果(本 Issue 创建过程中未重新执行测试):
LambNextRight_L1_empty_highpre_028,DYN/CST,--compare=mixed --dl=1 --xpu-perf,精度、性能、确定性及内存检查均 PASS。opParaSize=1472字节。Special notes for this issue / 备注
本 Issue 按 PR 当前代码差异整理。当前差异共涉及 10 个文件,包含四个算子的空 Tensor tiling 修复和边界 UT,以及 LambNextRight kernel/golden 的乘法顺序调整;PR 原描述中的“仅一个 tiling 源文件”与当前差异范围不同。
关联 PR:https://gitcode.com/cann/ops-nn/pull/14193