Closed
[feat] DCP pinned staging在NPU上面的适配 #5452
AWWOLFAdd on Oct 16Closed at 11 days ago
Oct 16 Added label: triage-reviewmodule: core
TorchNPU-Bot
Oct 16 Comments:
Oct 16 Comments:
无报错,属功能建议/feature request;主题为 DCP pinned staging 支持与 npuHostRegister/npuHostUnregister 接口映射,归 module: core
添加分类标签:module: core。
当前分类由社区bot提供,如分类有误请在评论中回复。


Oct 16 changed custom category from Bug-Report to 需求
Oct 16 Modify description of issue
Oct 16 Added label: bot-triaged; Removed label: triage-review
TorchNPU-Bot
Oct 16 Comments:
Oct 16 Comments:
检测到当前 issue 已关联 PR,自动添加标签:bot-triaged


Oct 16 Change title to "[feat] DCP pinned staging support to v2.9.0-v2.12.0", originally titled "[feat] Backport NPU DCP pinned staging support to v2.9.0-v2.12.0".
Oct 16 Change title to "[feat] DCP pinned staging support to v2.9.0-v2.12.0", originally titled "[feat] Backport NPU DCP pinned staging support to v2.9.0-v2.12.0".
Oct 16 Change title to "[feat] DCP pinned staging在NPU上面的适配", originally titled "[feat] DCP pinned staging support to v2.9.0-v2.12.0".
Oct 16 Change title to "[feat] DCP pinned staging在NPU上面的适配", originally titled "[feat] DCP pinned staging support to v2.9.0-v2.12.0".
11 days ago Close issue
11 days ago changed custom state from TODO to CLOSED
11 days ago Added label: resolved
〖问题描述〗
PyTorch DCP
StateDictStager在启用pin_memory=True时依赖torch.cuda._pin_memory_utils对已分配的 shared CPU staging storage 执行 pin/unpin。NPU 场景需要将该调用映射到npuHostRegister/npuHostUnregister,使 CANN runtime 可以登记既有 host memory。〖处理方案〗
复用
transfer_to_npu现有 CUDA compatibility patch 机制,仅替换torch.cuda._pin_memory_utils的pin_memory和unpin_memory两个 helper:pin_memory(ptr, size)->torch_npu.npu.npurt().npuHostRegister(ptr, size, ACL_HOST_REG_PINNED);unpin_memory(ptr)->torch_npu.npu.npurt().npuHostUnregister(ptr)。不修改 PyTorch DCP、checkpoint 格式、load API、staging cache 或 shared storage 生命周期。
后续消除patch方案:https://gitcode.com/ZHANGJIAOGOU/pytorch_support_NPU_pinned_memory/blob/privateuse1-pinned-memory-migration/PINNED_MEMORY_PATCH_REMOVAL_PLAN.md
〖关联 PR〗
〖适配检查〗
四个目标分支均已完成 source-level 检查:补丁可无冲突应用,且
torch_npu.npu.npurt().npuHostRegister/npuHostUnregister与 ACL bridge 均存在。〖功能验证计划〗
〖资料变更〗
不涉及。
〖接口变更〗
不涉及新增用户接口。
〖备注〗
当前已完成补丁适配和静态检查;NPU 实机、PROCESS writer 与多 rank 回归由对应 PR CI/测试继续验证。