[Cherry-Pick][Operator Mechanism] Remove BLAS APIs only used on CPU - #79519
Merged
sneaxiy merged 2 commits intoJul 22, 2026
Merged
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/3.4 #79519 +/- ##
===============================================
Coverage ? 100.00%
===============================================
Files ? 3
Lines ? 33
Branches ? 0
===============================================
Hits ? 33
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wanghuancoder
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Operator Mechanism
PR Types
Bug fixes
Description
本次移除了只在 CPU 侧使用的部分 BLAS wrapper API,并将对应调用点替换为 Eigen 或直接实现。
VSUBEigenVector::Flatten后使用eigen_x - eigen_yVDIVEigenVector::Flatten后使用eigen_x / eigen_yVEXPEigen::Map后使用array().exp()VSQUAREEigen::Map后使用cwiseAbs2()VPOWEigen::Map后使用array().pow()VMULEigen::Map后使用array() * array(),部分封装为EigenVecMulVINVEigen array().exp().cwiseInverse()VMERFEigen array().erf()ASUM主要修改
paddle/phi/kernels/funcs/blas/blas.h删除上述 CPU-only API 的
Blas成员声明和BlasT转发接口。paddle/phi/kernels/funcs/blas/blas_impl.h删除上述 API 在 CPU BLAS wrapper 中的实现。
paddle/phi/kernels/cpu/elementwise.hVSUB→eigen_z.device(place) = eigen_x - eigen_yVDIV→eigen_z.device(place) = eigen_x / eigen_yVMUL→eigen_z.device(place) = eigen_x * eigen_ypaddle/phi/kernels/cpu/attention_lstm_kernel.ccVMUL替换为Eigen::Map + array() * array()paddle/phi/kernels/cpu/gelu_grad_kernel.ccVMERF→Eigen array().erf()VSQUARE、VEXP、VMUL合并为一个 Eigen 表达式:最后的
dout * first也改为 Eigen 逐元素乘法。paddle/phi/kernels/cpu/gelu_kernel.ccVMERF→Eigen array().erf()VMUL(x, out)改为:paddle/phi/kernels/cpu/hsigmoid_loss_grad.h将
VEXP与VINV合并为:paddle/phi/kernels/cpu/lrn_kernel.ccVSQUARE→input_src.cwiseAbs2()将
VPOW与VMUL合并为:paddle/phi/kernels/fusion/cpu/fused_embedding_fc_lstm_kernel.ccVMUL提取为EigenVecMulEigenVecMul内部实现:devPR:#79513
是否引起精度变化
否