[Cherry-Pick][User Experience] Improve VMM OOM diagnostics#79446
[Cherry-Pick][User Experience] Improve VMM OOM diagnostics#79446zhangting2020 wants to merge 1 commit into
Conversation
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-07-09 14:39:03
📋 Review 摘要
PR 概述:改进 CUDA VMM OOM 信息,扩大 VMM VA 预留并在 OOM 中补充 pool/free 统计。
变更范围:Phi CUDA/VMM allocator、memory visitor、VMM allocator C++ 单测。
影响面 Tag:User Experience Execute Infrastructure
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | paddle/phi/core/memory/allocation/virtual_memory_auto_growth_best_fit_allocator.cc:310 |
native_compact 重分配失败时 pool stats 读取的是 compact 前的 free_blocks_ |
📝 PR 规范检查
标题缺少 Tag;目标分支是 release/3.4,Description 也缺少 release cherry-pick 要求的 develop 原 PR 链接。
标题建议(可直接复制):
[Cherry-Pick][User Experience] Improve VMM OOM diagnostics(#79435)
PR 描述建议(点击展开,可直接复制)
### PR Category
<!-- One of [ User Experience | Execute Infrastructure | Operator Mechanism | CINN | Custom Device | Performance Optimization | Distributed Strategy | Parameter Server | Communication Library | Auto Parallel | Inference | Environment Adaptation ] -->
User Experience
### PR Types
<!-- One of [ New features | Bug fixes | Improvements | Performance | BC Breaking | Deprecations | Docs | Devs | Not User Facing | Security | Others ] -->
Not User Facing
### Description
<!-- Describe what you’ve done -->
Improve VMM OOM diagnostics.
devPR:https://github.com/PaddlePaddle/Paddle/pull/79435
### 是否引起精度变化
<!-- one of the following [ 是 | 否 ]-->
否总体评价
变更方向合理,VMM OOM 信息会更易定位物理显存耗尽与池内碎片问题。但 native_compact 后再次 OOM 的诊断路径需要修正,否则新增 pool stats 可能在该分支输出 compact 前的旧状态。
| try { | ||
| allocate_result = AllocateOrCompact(size); | ||
| } catch (const paddle::memory::allocation::BadAlloc &e) { | ||
| auto stats = SumLargestFreeBlockSizes(free_blocks_.size()); |
There was a problem hiding this comment.
🟡 建议 native_compact 分支在 compact 后的重分配失败会让这里读到 stale free_blocks_。
AllocateOrCompact() 在底层分配 OOM 后会调用 memory_compactor_->Compact(...),而 TotalMemoryCompactor::Compact() 会用新的 all_blocks_ 替换原 list;但 free_blocks_ 只有在返回 std::nullopt 后的分支才 clear()/emplace()。如果 compact 后 underlying_allocator_->Allocate(size - free_block->size_) 再次抛 BadAlloc,会直接进入这个 catch,此时 SumLargestFreeBlockSizes(free_blocks_.size()) 仍基于 compact 前的 map 计算,OOM 提示的 total_free/max_free 会误报碎片状态。
建议在统计前先根据当前 all_blocks_ 计算/重建 free 信息,或在 compact 完成后、任何可能再次抛错的 re-alloc 之前同步刷新 free_blocks_;同时补一个 FLAGS_native_compact=true 且 re-alloc 失败的单测。
CI报告基于以下代码生成(30分钟更新一次): 1 Required任务 : 23/27 通过
2 失败详情🔴 Check PR Template / Check — PR问题(置信度: 高)分析器: 通用分析(fallback)
关键日志:
状态补充: 当前 修复建议:
关联变更: PR body/Description 🔴 Check PR Template / Check — PR问题(置信度: 高)分析器: 通用分析(fallback)
关键日志:
修复建议:
关联变更: PR body/Description |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/3.4 #79446 +/- ##
==============================================
Coverage ? 84.21%
==============================================
Files ? 3
Lines ? 19
Branches ? 0
==============================================
Hits ? 16
Misses ? 3
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sneaxiy
left a comment
There was a problem hiding this comment.
LGTM for coverage due to error messages in OOM.
|
你的PR提交成功,感谢你对开源项目的贡献! |
PR Category
User ExperiencePR Types
Not User FacingDescription
Improve VMM OOM diagnostics是否引起精度变化
否devPR:#79435