Skip to content

Conversation

@cangtianhuang
Copy link
Contributor

@cangtianhuang cangtianhuang commented Jun 26, 2025

PR Category

Operator Mechanism

PR Types

Improvements

Description

错误定位:

  1. ThrustCumsumKernel 自身的精度误差就极大
  2. fp32 下大 tensor 拥有累计误差

解决方案:

  1. 删除 ThrustCumsumKernel 分支处理,继续使用 CUDA cub 计算
  2. BlockPrefixCallbackOp 采用 Kahan 算法,参考:https://en.wikipedia.org/wiki/Kahan_summation_algorithm
  3. LogAddExpIdentitystd::numeric_limits<T>::lowest() 改为 -std::numeric_limits<T>::infinity() ,使其在理论上更准确

其他修改:

  1. 其他计算中的 lowest 改为 -inf,确保一致: paddle/phi/kernels/cpu/cum_kernel.cctest/legacy_test/test_logcumsumexp_op.pypaddle/fluid/primitive/decomp_rule/decomp_vjp/details.h
  2. 整理 paddle/phi/kernels/impl/logcumsumexp_grad_impl.h ,添加注释

测试:

Pcard-85711

@paddle-bot
Copy link

paddle-bot bot commented Jun 26, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@cangtianhuang
Copy link
Contributor Author

/re-run all-failed

@cangtianhuang
Copy link
Contributor Author

/re-run all-failed

@cangtianhuang cangtianhuang marked this pull request as draft July 3, 2025 17:01
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (develop@8ae7423). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #73658   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         1           
  Lines              ?         4           
  Branches           ?         0           
===========================================
  Hits               ?         4           
  Misses             ?         0           
  Partials           ?         0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants