Repository navigation
[Allocator] Add generic all block info API (#79272) - #79307
Conversation
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-06-12 11:02:18
📋 Review 摘要
PR 概述:新增 generic all block info API,让 MemoryAnalysisTool / memory_summary 在非 VMM auto_growth allocator 下也能获取块信息。
变更范围:paddle/phi/core/memory allocator visitor/mem_utils、pybind、python/paddle/device/cuda/memory_analyzer.py 和 allocator 相关测试。
影响面 Tag:[User Experience] [Execute Infrastructure]
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🔴 兼容性 | paddle/phi/core/memory/mem_utils.h:107 |
移除了已导出的 C++ 旧函数名,可能破坏下游源码/链接兼容 |
📝 PR 规范检查
标题不符合 release cherry-pick 格式:当前 [Allocator] 不是模板枚举 Tag,且缺少 [Cherry-Pick]。描述结构符合模板,已包含 devPR:https://github.com/PaddlePaddle/Paddle/pull/79272 和精度变化“否”。
标题建议(可直接复制):
[Cherry-Pick][User Experience] Add generic all block info API(#79272)
总体评价
实现路径整体清晰,新增 visitor 能覆盖非 VMM auto_growth allocator,旧 Python vmm_all_block_info 也保留了兼容入口。但 C++ exported API rename 需要补旧名 wrapper 后再合入 release 分支。
| // Get allocator all block info. | ||
| PADDLE_API extern std::vector<std::vector<std::tuple<size_t, uintptr_t, bool>>> | ||
| AllBlockInfoOfVmmAllocator(const GPUPlace& place); | ||
| AllBlockInfoOfAllocator(const GPUPlace& place); |
There was a problem hiding this comment.
🔴 兼容性 这里把已导出的 AllBlockInfoOfVmmAllocator 直接改名成 AllBlockInfoOfAllocator,但没有保留旧 C++ 符号。
mem_utils.h 中旧函数带 PADDLE_API extern,下游 C++ 代码或已编译扩展如果继续包含/链接 paddle::memory::AllBlockInfoOfVmmAllocator,在 release/3.4 分支升级后会出现源码或链接兼容性破坏。Python 的 vmm_all_block_info 旧入口已经保留,C++ 层也应保持同样的兼容 alias。
建议修复方式:保留新函数,同时在头文件和 .cc 中增加旧名 wrapper,例如:
PADDLE_API std::vector<std::vector<std::tuple<size_t, uintptr_t, bool>>>
AllBlockInfoOfVmmAllocator(const GPUPlace& place) {
return AllBlockInfoOfAllocator(place);
}
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/3.4 #79307 +/- ##
==============================================
Coverage ? 95.83%
==============================================
Files ? 5
Lines ? 24
Branches ? 0
==============================================
Hits ? 23
Misses ? 1
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
你的PR提交成功,感谢你对开源项目的贡献! |
1 similar comment
|
你的PR提交成功,感谢你对开源项目的贡献! |
PR Category
User ExperiencePR Types
ImprovementsDescription
[User Experience] Add generic all block info APIdevPR:#79272
是否引起精度变化
否