已关闭
[Bug-Report|缺陷反馈]: InplaceApplyMomentum 算子在 FP32 dtype 下 `var_out` 输出精度异常 #4737
牛康创建于 27 天前关闭于 27 天前
27 天前 关联了pull request:fix: InplaceApplyMentarum FP32 path var_out accuracy exception
27 天前 将 niukang_hw 设为负责人
27 天前 关闭了 issue
27 天前 添加了label:resolved
Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
Describe the current behavior / 问题描述 (Mandatory / 必填)
InplaceApplyMomentum 算子 FP32 dtype 下
var_out输出精度异常。TTK 100 条白盒用例中 42 条失败(PassRate 58%),失败模式为var_out=FAIL, accum_out=PASS。FP16/BF16 路径不受影响。多核场景(65536元素/43核)下两个输出均错误。根因有两个:
DataCopyPad(MTE3),缺少 V→MTE3 同步,写出未更新的脏数据GlobalTensor::GetValue()直接从 GM 读取,多核并发读取导致标量值错误Environment / 环境信息 (Mandatory / 必填)
Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
# 1. 编译安装算子 cd <ops-nn repo> source /usr/local/Ascend/cann-9.0.0/set_env.sh bash build.sh --ops=inplace_apply_momentum --soc=ascend950 cd build_out && bash cann-ops-nn-custom_linux-x86_64.run --install-path=/usr/local/Ascend/cann-9.0.0/opp --quiet --install-for-all # 2. 运行 TTK 测试(float32, shape=(65536,), 43核) cd <ops-test-kit> python3 -m ttk kernel -i <test_csv> \ --plugin <golden_dir> \ -t iam_012 --single-log # 3. 观察结果 # DYN_GOLD: FAIL,PASS (var_out=FAIL, accum_out=PASS) # precision_metrics: mere=0.0008, mare=7.83, threshold=0.0001220703125最小复现:
var=[1.0], accum=[0.5], lr=[0.01], grad=[0.1], momentum=[0.9], dtype=float32,golden 期望var_out=0.9945,实际 kernel 输出var_out=0(脏数据)。Describe the expected behavior / 预期结果 (Mandatory / 必填)
白盒用例全部 PASS(PassRate 100%),
var_out与 goldentf.raw_ops.ResourceApplyMomentum在容差范围内一致(FP32 rtol=1e-4)。Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
=== 修复前 ===
TTK Test Summary: Total=100, PASS=58, FAIL=42, PassRate=58%
iam_012 (float32, shape=(65536,), 43核):
out[0] (var_out): mere=0.0008, mare=7.83, th=0.000122, FAIL
out[1] (accum_out): mere=0.006, mare=37.0, th=0.000122, FAIL
=== 修复后 ===
TTK Test Summary: Total=100, PASS=100, FAIL=0, PassRate=100%