已合并
fix d2h pinned memeory bug #31778
zzhongmin创建于 3月13日
fix d2h pinned memeory bug #31778
已合并
zzhongmin创建于 3月13日
zzhongmin
zzhongmin成员
3月13日

【合入来源】

【修改方案】

--问题背景:在 NPU 序列化场景下,test_use_pinned_memory_for_d2h 期望 write_record 收到的是 pinned host storage
现有流程里,_reduce_ex_阶段在进入 _npu_save 前已把 storage 变成 CPU,导致原来的仅非 CPU storage 才走 pinned D2H 逻辑覆盖不到。
--解决方案:仅调整 NPU 保存路径,在 _npu_save 中保留原有 storage.device != cpu 的 pinned D2H 分支,新增 CPU fallback 当 use_pinned_memory_for_d2h=True 且当前 accelerator 为 npu 时,如果 storage 已是 CPU,也在写盘前转换为 pinned CPU storage,再 write_record。

【资料变更】

不涉及

【接口变更】

不涉及

【功能验证】

test_serialization.py -v -k test_use_pinned_memory_for_d2h用例通过

【CheckList】

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 zzhongmin 的贡献)
zzhongminzzhongmin成员
3月13日 创建了 pull request,commit c1fc9ce6
ascend-robot
ascend-robot成员
3月13日 评论:

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
test liujunzhu, suhaibo, liangsongwei (3/2) liujunzhu (1/1)
torch_npu/utils liangsongwei, liujunzhu, suhaibo (3/2) liujunzhu (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
ascend-robotascend-robot成员
3月13日 添加了label:ascend-cla/yes
zzhongmin
zzhongmin成员
3月13日 评论:

compile

likedislike
此处折叠了132条消息 查看更多
ascend-robotascend-robot成员
3月25日 添加了label:lgtm
liujunzhu
liujunzhu成员
3月25日 评论:

/approve

likedislike
ascend-robotascend-robot成员
3月25日 添加了label:approved
ascend-robot
ascend-robot成员
3月25日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: liujunzhu.
Reviewers who wrote a comment of /lgtm are: liujunzhu, suhaibo, liangsongwei.

likedislike
ascend-robotascend-robot成员
3月25日 合入了pull request