Skip to content

[PIR] Fix check_view_api_used_by_inplace #69615

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
Nov 22, 2024

Conversation

ooooo-create
Copy link
Contributor

@ooooo-create ooooo-create commented Nov 22, 2024

PR Category

Execute Infrastructure

PR Types

Others

Description

https://github.com/PaddlePaddle/PaddleDetection/blob/0914611178e9db34e746a351c7fc090048eeebc0/ppdet/modeling/losses/ssd_loss.py#L115

  • 修复检查逻辑, value.detach 使用的 pd_op.share_data_ 不会和其他 inplace api 一样立刻修改显存
  • 但是产生的新的 Value 在逻辑上是不保证安全的,因为之后可能会被其他 inplace api 使用,也修改了之前的显存,目前的检查没有包含这种情况(现在只是跳过了
z = paddle.squeeze(x,-1)
y = x.detach() #不会立刻导致 z 的显存变化
# y.add_(xxx) ,就会导致 z 的显存变化

Copy link

paddle-bot bot commented Nov 22, 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 Nov 22, 2024
Comment on lines 144 to 147
op.name() == "pd_op.set_value_"
or op.name() == "pd_op.set_value_with_tensor_"
# It willn't change tensor imdeiately,but it's ouput is dangerous.
or op.name() == "pd_op.share_data_"
Copy link
Member

Choose a reason for hiding this comment

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

op.name() in ["a", "b", "c"]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

@SigureMo SigureMo merged commit 9bb2737 into PaddlePaddle:develop Nov 22, 2024
27 of 28 checks passed
@ooooo-create ooooo-create deleted the pir_stride branch March 8, 2025 04:06
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.

2 participants