已合并
Event supports cross-process and cross-device (IPC event) #28521
liujunzhu创建于 2025年12月23日
Event supports cross-process and cross-device (IPC event) #28521
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 liujunzhu 的贡献)ascend-robot
2025年12月23日 评论:
2025年12月23日 评论:
ascend-robot
2025年12月23日 评论:
2025年12月23日 评论:
以下是根据您提交的修改文件推荐的Reviewer和Committer序列,需各模块评审通过后方可合入
| Module List | Reviewers | Committers |
|---|---|---|
| repo-Ascend/pytorch | yanpengquan, chenhao_1209, ShaoFeifan, zhanJ, chuboning | medivh-x, zqwenn, chenhao_1209, yanpengquan, wangchao430 |


AtlasAccount
2025年12月23日 评论:
2025年12月23日 评论:
2025年12月23日 添加了label:ascend-cla/yes
ascend-robot
2025年12月23日 评论:
2025年12月23日 评论:
CLA Signature Pass
@liujunzhu, thanks for your pull request. All authors of the commits have signed the CLA. 👍


liujunzhu
2025年12月23日 评论:
2025年12月23日 评论:
add_component


2025年12月23日 添加了label:MindSpore-Component
liujunzhu
2025年12月23日 评论:
2025年12月23日 评论:
compile


ascend-robot
2025年12月23日 评论:
2025年12月23日 评论:
✅ 流水线任务触发成功,正在执行,请稍候。 任务链接[6f8865d104ae4cd39a228b9d13cc8e7f]


2025年12月23日 添加了label:ci-pipeline-running
ascend-robot
2025年12月23日 评论:
2025年12月23日 评论:
get-log


2025年12月23日 删除了label:ci-pipeline-running
2025年12月23日 添加了label:ci-pipeline-running
AtlasAccount
2025年12月23日 评论:
2025年12月23日 评论:
/torch_npu/csrc/core/npu/NPUEventManager.cpp
/torch_npu/csrc/npu/Event.cpp


2025年12月23日 删除了label:ci-pipeline-running
2025年12月23日 添加了label:ci-pipeline-failed
liujunzhu
2025年12月23日 评论:
2025年12月23日 评论:
retry


2025年12月23日 删除了label:ci-pipeline-failed
2025年12月23日 添加了label:ci-pipeline-running
AtlasAccount
2025年12月23日 评论:
2025年12月23日 评论:
retry 成功,请等待!


2025年12月23日 删除了label:ci-pipeline-running
2025年12月23日 添加了label:ci-pipeline-failed
liujunzhu
2025年12月23日 评论:
2025年12月23日 评论:
retry


2025年12月23日 删除了label:ci-pipeline-failed
2025年12月23日 添加了label:ci-pipeline-running
AtlasAccount
2025年12月23日 评论:
2025年12月23日 评论:
retry 成功,请等待!


2025年12月23日 删除了label:ci-pipeline-running
2025年12月23日 添加了label:ci-pipeline-passed
AtlasAccount
2025年12月23日 评论:
2025年12月23日 评论:
| 检查项 | 状态 | 日志 | 产物 |
|---|---|---|---|
| code_check | ✅ | >>> | N/A |
| sca | ✅ | >>> | N/A |
| check_error | ✅ | >>> | N/A |
| anti_poison | ✅ | >>> | N/A |
| Build_X86_USE_CXX_ABI_GCC13 | ✅ | >>> | >>> |
| Build_LibTorch_USE_CXX_ABI_GCC13 | ✅ | >>> | >>> |
| Build_ARM_USE_CXX_ABI_GCC13 | ✅ | >>> | >>> |
| Build_ARM_inductor_gcc13 | ✅ | >>> | >>> |
| UT_X86_Part_01 | ✅ | >>> | N/A |
| UT_X86_Part_02 | ✅ | >>> | N/A |
| UT_inductor_arm | ✅ | >>> | N/A |
| openlibing链接 | 点此跳转 | ||


2025年12月23日 删除了label:ci-pipeline-passed
2025年12月23日 添加了label:ci-pipeline-passed
2025年12月24日 添加了label:lgtm
li_jing_hw
2025年12月25日 评论:
2025年12月25日 评论:
/approve


2025年12月25日 添加了label:approved
ascend-robot
2025年12月25日 评论:
2025年12月25日 评论:
Review Guide
This Pull-Request Passes Review.
Committers who writed a comment of /approve are: wangchao430, li_jing_hw.
Reviewers who writed a comment of /lgtm are: wangchao430, li_jing_hw.


2025年12月25日 合入了pull request
What type of PR is this?
/kind feature
What does this PR do / why do we need it:
event能力对齐cuda,支持跨进程与跨设备使用。
CUDA跨进程共享内存和跨设备拷贝内存时使用Event进行同步,而torch npu使用SynchronizeStream进行同步,希望torch_npu支持在跨设备和跨内存的场景也使用Event进行同步,提升整体性能。另外,需支持通过Python接口在进程间传递Event对象或Event handle并使用该Event进行进程间的同步。
相关场景如下:
1、跨进程使用Event:进程间传递interprocess=True的Event对象、Event的IPC Handle或torch.multiprocessing.reductions.reduce_event(event)的结果。
2、跨进程共享NPU内存:包括进程间通过参数或队列传递Tensor、进程间通过torch.multiprocessing.reductions.reduce_tensor()传递Tensor、进程间通过_share_npu_传递Tensor。
3、跨设备拷贝NPU内存:调用Tensor.to()或Tensor.copy_()接口。
不支持跨设备或跨进程使用interprocess=False的Event。
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewers: