Skip to content

[Allocator] Add generic all block info API (#79272) - #79307

Merged
sneaxiy merged 1 commit into
PaddlePaddle:release/3.4from
zhangting2020:cp_34
Jun 12, 2026
Merged

sneaxiy merged 1 commit into
PaddlePaddle:release/3.4from
zhangting2020:cp_34

Conversation

@zhangting2020

Copy link
Copy Markdown
Collaborator

PR Category

User Experience

PR Types

Improvements

Description

[User Experience] Add generic all block info API

devPR:#79272

是否引起精度变化

否

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 兼容性 这里把已导出的 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-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/3.4@d3c4748). Learn more about missing BASE report.

Files with missing lines Patch % Lines
paddle/phi/core/memory/mem_visitor.cc 92.30% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sneaxiy
sneaxiy merged commit 99af93f into PaddlePaddle:release/3.4 Jun 12, 2026
239 of 252 checks passed
@paddle-bot

paddle-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

1 similar comment
@paddle-bot

paddle-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants