Skip to content

Conversation

@liuruyan
Copy link
Contributor

@liuruyan liuruyan commented Nov 11, 2025

PR Category

Performance Optimization

PR Types

New features

Description

本PR升级Allocator基础设施,新增Allocator Visitor,解决旧装饰器模式下,非顶层Allocator功能难以拓展及暴露的问题(想要暴露一个方法,只能再虚基类中加上方法,并在链路上所有Allocator中进行实现),具体改动如下:

  1. 新增Allocator Visitor,在虚基类中接受Visitor对象,不同Visitor可以针对不同Allocator实现不同功能
  2. 新增VmmMaxFreeSize方法,其使用Visitor实现返回VMM Allocator中空闲块状态(最大空闲块及前N大空闲块总和)

注:Visitor日后可根据需求进行升级(升级可变模板参数)
Pcard-67164

@paddle-bot
Copy link

paddle-bot bot commented Nov 11, 2025

你的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.

@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 91.93548% with 5 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@42b8146). Learn more about missing BASE report.

Files with missing lines Patch % Lines
paddle/phi/core/memory/allocation/allocator.h 0.00% 1 Missing ⚠️
...addle/phi/core/memory/allocation/retry_allocator.h 50.00% 1 Missing ⚠️
...ore/memory/allocation/stream_safe_cuda_allocator.h 75.00% 1 Missing ⚠️
paddle/phi/core/memory/mem_visitor.cc 95.65% 1 Missing ⚠️
paddle/phi/core/memory/mem_visitor.h 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #76349   +/-   ##
==========================================
  Coverage           ?   91.93%           
==========================================
  Files              ?       10           
  Lines              ?       62           
  Branches           ?        0           
==========================================
  Hits               ?       57           
  Misses             ?        5           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 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.

@liuruyan liuruyan changed the title add allocator visitor 【Allocator】Add allocator visitor Nov 14, 2025
Copy link
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

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

LGTM

@liuruyan liuruyan merged commit e375b1a into PaddlePaddle:develop Nov 17, 2025
302 of 328 checks passed
LittleHeroZZZX pushed a commit to LittleHeroZZZX/Paddle that referenced this pull request Nov 19, 2025
* add allocator visitor

* fix ci

* fix dcu

* fix cuda

* fix cuda

* fix cuda

* fix ci

* fix ci

* fix ci

* add ut

* fix ci

* fix ci

* fix ci

* fix ci

* fix dcu

* fix dcu

* fix conflict

* fix conflict
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