【Allocator】Add compact func in phi generate code#76430
Merged
liuruyan merged 6 commits intoPaddlePaddle:developfrom Nov 19, 2025
Merged
【Allocator】Add compact func in phi generate code#76430liuruyan merged 6 commits intoPaddlePaddle:developfrom
liuruyan merged 6 commits intoPaddlePaddle:developfrom
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #76430 +/- ##
==========================================
Coverage ? 92.48%
==========================================
Files ? 8
Lines ? 133
Branches ? 0
==========================================
Hits ? 123
Misses ? 10
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
428e04b to
e0dbac9
Compare
zhangting2020
approved these changes
Nov 19, 2025
zyfncg
approved these changes
Nov 19, 2025
| /** | ||
| * Allocator Compact related FLAG | ||
| * Name: FLAGS_enable_compact_mem | ||
| * Since Version: 3.2.2 |
| PyObject* kwargs) { | ||
| EAGER_TRY | ||
| FLAGS_tensor_operants_mode = "phi"; | ||
| bool old_flag = FLAGS_enable_compact_mem; |
Comment on lines
+483
to
+486
| VLOG(1) << "Do Memory Compact Large Pool Manual"; | ||
| size_t compact_free_size = large_allocator->Compact(place); | ||
| VLOG(1) << "Memory Compact Large Pool Manual Finish Compact size: " | ||
| << compact_free_size; |
Contributor
Author
There was a problem hiding this comment.
这里日志级别1应该是合理的,这个日志是函数只有在触发整理时才会打印的必要提示信息
| @@ -0,0 +1,258 @@ | |||
| /* Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | |||
zhangbo9674
approved these changes
Nov 19, 2025
LittleHeroZZZX
pushed a commit
to LittleHeroZZZX/Paddle
that referenced
this pull request
Nov 19, 2025
* add compact in phi generate code * add try alloc * fix custom api * remove std::cout
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
Performance Optimization
PR Types
New features
Description
本PR新增碎片整理相关FLAGS,并在PHI算子库中加入碎片整理分支,具体如下:
其中req_total_size为申请请求大小总和,max_free_size为Allocator最大空闲块,large_N_free_size为为Allocator最大N空闲块大小总和,N为申请请求个数
TODO:Custom api 暂时跳过了碎片整理,后续应该在动态图流程里执行inferShape
Pcard-67164