已关闭
[Bug-Report|缺陷反馈]: [BNLL] Improve log1p precision for small exponential values #5235
aqt666创建于  23 天前关闭于  19 天前
aqt666
aqt666
23 天前 创建

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

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

BNLL 在计算 log(1 + exp(-abs(x))) 时,原实现直接使用
Adds(1, e) + Ln。当 e 较小时,1 + e 的 float32 舍入会损失
有效位,并放大最终输出误差。

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

  • SoC: Ascend950DT_9592
  • CANN: 9.2.0
  • TTK: 3.0.0
  • dtype: float16、float32
  • mode: Kernel Bin release

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

  1. 构建并安装 BNLL。
  2. 使用包含阈值附近输入的 TTK Kernel 用例执行 BNLL。
  3. 对比 Adds(1, exp(-abs(x))) + Ln 与高精度
    log1p(exp(-abs(x))) 的输出。
  4. 观察 x=-10 等小指数值区域的输出误差。

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

BNLL 在小指数值区域采用数值稳定的 log1p 计算方式,降低舍入误差,
并保持 float16、float32 全量用例通过。
原始 Adds(1, e) + Ln 实现在 x=-10 附近存在约 5170 ULP 的误差。
根因是 1 + small_e 在 float32 中发生有效位损失。

  • TTK Kernel: 1096/1096 PASS
  • float32: 548/548 PASS
  • float16: 548/548 PASS
  • Ascend950DT_9592 / CANN 9.2.0

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

likedislike
aqt666aqt666
23 天前 关联了pull request:fix(bnll): improve log1p precision
yuning_chenyuning_chen成员
23 天前 将 aqt666 设为负责人
CANN-robotCANN-robot成员
19 天前 关闭了 issue
CANN-robotCANN-robot成员
19 天前 添加了label:resolved