Skip to content

Prevent Early Release of AllocationPtr in test_from_blob#65023

Merged
zyfncg merged 1 commit intoPaddlePaddle:developfrom
eee4017:lawu/blob
Jun 23, 2024
Merged

Prevent Early Release of AllocationPtr in test_from_blob#65023
zyfncg merged 1 commit intoPaddlePaddle:developfrom
eee4017:lawu/blob

Conversation

@eee4017
Copy link
Contributor

@eee4017 eee4017 commented Jun 11, 2024

PR Category

Others

PR Types

Bug fixes

Description

The Allocate() function returns a unique_ptr. When we chain the functions and call ptr(), the original unique_ptr is released, making the accessed memory invalid.

To address this issue, we must retain the unique_ptr until the memory is no longer in use.

With a stream-safe allocator, this bug is not immediately apparent because the allocator does not trigger cudaFree immediately. However, with an async allocator, the bug is detected due to stricter memory management.

@paddle-bot
Copy link

paddle-bot bot commented Jun 11, 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.

@paddle-bot paddle-bot bot added the contributor External developers label Jun 11, 2024
@jeng1220
Copy link
Collaborator

CI failed but it was NOT related to this PR

/paddle/paddle/phi/core/storage_properties.h:20:10: fatal error: 'paddle/phi/core/utils/type_registry.h' file not found
#include "paddle/phi/core/utils/type_registry.h"

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Jun 19, 2024

Sorry to inform you that 42e0daf's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@zyfncg zyfncg merged commit 9fa804e into PaddlePaddle:develop Jun 23, 2024
co63oc pushed a commit to co63oc/Paddle that referenced this pull request Jun 25, 2024
Co-authored-by: lawrence910426 <lawu@nvidia.com>
co63oc pushed a commit to co63oc/Paddle that referenced this pull request Jun 25, 2024
Co-authored-by: lawrence910426 <lawu@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers NVIDIA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants