已合并
Support allocator trace tracker in NPU caching allocator #38685
zzhongmin创建于 6月16日
Support allocator trace tracker in NPU caching allocator #38685
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 zzhongmin 的贡献)ascend-robot
6月16日 评论:
6月16日 评论:
6月16日 添加了label:ascend-cla/yes
ascend-robot
6月16日 评论:
6月16日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/pytorch | ✅ liujunzhu, hbhu_bin (2/2) | ✅ liujunzhu (1/1) |
| test | ✅ liujunzhu, hbhu_bin (2/2) | ✅ liujunzhu (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zzhongmin, thanks for your pull request. All authors of the commits have signed the CLA. 👍


6月16日 添加了label:needs-issue
此处折叠了57条消息 查看更多
6月22日 添加了label:approved
6月22日 添加了label:lgtm
6月22日 合入了pull request
ascend-robot
6月22日 评论:
6月22日 评论:
流水线 pytorch_gitcode_PR_multiVersion#11016 [ commitID:b3e91f6c ] 已完成


【合入来源】
【修改方案】
将 NPU Caching Allocator 对齐到上游 CUDA 实现,补齐 Allocator Trace Tracker 回调机制,并将 mempool 关联方式从间接反查改为直接存储。
AllocatorTraceTracker回调机制(NPUCachingAllocator.h + .cpp)AllocatorTraceTracker类型、虚方法、trace_trackers_成员、公共接口层转发及便捷函数,与 CUDA 接口对齐record_trace支持 tracker 回调分发(NPUCachingAllocator.cpp)!record_history && trace_trackers_.empty(),构造 TraceEntry 后遍历trace_trackers_调用回调TraceEntry新增mempool_字段(NPUCachingAllocator.h)MempoolId_t mempool = {0, 0}参数,新增MempoolId_t mempool_成员PrivatePool改为直接存储 mempool ID(NPUCachingAllocator.cpp)id成员,构造函数接受MempoolId_t idBlockPool::owner_MempoolId()方法create_or_incref_pool/get_private_pool,重构beginAllocateToPool/endAllocateToPoolrecord_trace调用点补齐mempool_id参数(NPUCachingAllocator.cpp)block->pool->owner_MempoolId()NPUWorkspaceAllocator补齐TraceEntry构造参数(NPUWorkspaceAllocator.cpp)MempoolId_t{0, 0}NPUPluggableAllocator补齐接口(NPUPluggableAllocator.h + .cpp)attachAllocatorTraceTrackeroverride,TORCH_CHECK(false)拒绝调用【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
test/npu/test_allocator_trace_tracker.py
【CheckList】