[SOT] Place dynamic shape tensor on CPU#76416
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes performance by preventing dynamic shape tensors from being unnecessarily moved to GPU at program initialization, avoiding repeated memory copies back to CPU during static graph execution. This is a performance improvement specifically for the SOT (Symbol Operator Tracing) module.
- Changed
SymbolicVariabletensor creation to usefill_constantwithforce_cpu=Trueinstead ofpaddle.full - Added heuristic function
maybe_dynamic_shape_tensorto identify likely dynamic shape tensors - Modified
_prepare_inputsto skip GPU placement for identified dynamic shape tensors
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| python/paddle/jit/sot/opcode_translator/executor/function_graph.py | Refactored symbolic variable tensor creation to use fill_constant with force_cpu=True flag |
| python/paddle/jit/dy2static/utils.py | Added heuristic function to detect potential dynamic shape tensors |
| python/paddle/jit/dy2static/pir_partial_program.py | Integrated dynamic shape tensor detection to skip GPU placement during input preparation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (80.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #76416 +/- ##
==========================================
Coverage ? 80.00%
==========================================
Files ? 2
Lines ? 15
Branches ? 0
==========================================
Hits ? 12
Misses ? 3
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
--------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
PR Category
Execute Infrastructure
PR Types
Performance
Description
避免将 dynamic shape Tensor 在 Program 开始前 move 到 GPU 上,从而导致静态图部分反复 memcpy 回 CPU