Skip to content

[XPU] fix matmul_broadcast_bugs #66485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

lj970926
Copy link
Contributor

PR Category

Custom Device

PR Types

Bug fixes

Description

  1. fix memory bugs caused by the unexpectedly early release of x/y_broadcast_data

Copy link

paddle-bot bot commented Jul 24, 2024

你的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.

@@ -590,7 +592,6 @@ static void MatMulXPUFunction(
const XPUType* x_data = reinterpret_cast<const XPUType*>(x);
if (is_x_need_broadcast) {
XPUType* x_broadcast_data = nullptr;
xpu::ctx_guard RAII_GUARD(xpu_ctx);
x_broadcast_data = RAII_GUARD.alloc_l3_or_gm<XPUType>(batch_size * m * k);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里在if里创建RAII_GUARD会导致x_broadcast_data在if block退出的时候被释放,后续如果存在多Stream或者FC里申请了临时显存可能踩到。

Copy link
Contributor

@zhangyk0314 zhangyk0314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@cqulilujia cqulilujia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@QingshuChen QingshuChen merged commit 3fb0565 into PaddlePaddle:develop Jul 26, 2024
30 of 31 checks passed
Dale1314 pushed a commit to Dale1314/Paddle that referenced this pull request Jul 28, 2024
* [XPU] fix matmul_broadcast_bugs

* fix more bugs
lixcli pushed a commit to lixcli/Paddle that referenced this pull request Aug 5, 2024
* [XPU] fix matmul_broadcast_bugs

* fix more bugs
@houj04 houj04 added the XPU label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants