[Dy2St][CUDAGraph] Set undefined place for CUDAGraph OP outputs before lowering to avoid unnecessary memcpy && Add CUDAGraph unitest#75078
Merged
DrRyanHuang merged 10 commits intoPaddlePaddle:developfrom Sep 15, 2025
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
SigureMo
reviewed
Sep 4, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #75078 +/- ##
===========================================
Coverage ? 100.00%
===========================================
Files ? 1
Lines ? 7
Branches ? 0
===========================================
Hits ? 7
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
SigureMo
reviewed
Sep 8, 2025
pir::Place in CudaGraphOp output to avoid memcpymemcpy
Member
重点不在切图,在于 lower,这个 PR 没修改切图逻辑
expected place,在当前 case 下 expected place 是 GPU |
DrRyanHuang
commented
Sep 10, 2025
gouzil
previously approved these changes
Sep 11, 2025
SigureMo
previously approved these changes
Sep 11, 2025
| @@ -9,6 +9,8 @@ set(SOT_ENVS SOT_LOG_LEVEL=0 MIN_GRAPH_SIZE=0 STRICT_MODE=False | |||
| # swgu98: Temporarily commented on Windows platform | |||
| if(WIN32) | |||
| list(REMOVE_ITEM TEST_OPS test_for_enumerate) | |||
kolinwei
previously approved these changes
Sep 11, 2025
SigureMo
approved these changes
Sep 12, 2025
luotao1
approved these changes
Sep 15, 2025
co63oc
pushed a commit
to co63oc/Paddle
that referenced
this pull request
Sep 18, 2025
…e lowering to avoid unnecessary `memcpy` (PaddlePaddle#75078)
memcpymemcpy && Add CUDAGraph unitest
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
Execute Infrastructure
PR Types
Improvements
Description
原有的切图逻辑描述有修改,看后面的 #75078 (comment) 会导致执行器在子图的末尾插入不必要的 OPmemcpy_h2d原因是我们在外部指定了输出的 place 为 GPUPlace,所以即使最后的 yield OP 输出带有 cpu_tensor,也会被在 lower 过程中插入的
memcpy_h2dOP 搬运到 GPU 上因此,在 ProcessBlock 之前,我们指定 place 为默认
phi::Place,其AllocationType为UNDEFINED这样执行器就不会向图中插入
memcpy_h2dOP,在 ProcessBlock 之后,我们再将CUDAGraphOp的输出类型设置回来就行:最终的图如下,不再有 memcpy: