已合并
Add support for creating sub-communicators from the global domain in the rootinfo scenario. #34151
Add support for creating sub-communicators from the global domain in the rootinfo scenario. #34151
已合并
limuan创建于 4月22日
limuan
limuan成员
4月22日

【合入来源】

【修改方案】

在原有两种全局通信创建方法中:
createHCCLCommEx 函数包含两种功能:1)使用RANK_TABLE_FILE 创建全局通信器 2)从全局通信器派生新通信域
RootInfo 方式:每次创建通信域,会创建一个完整的全局通信域 ,耗时严重
因此单独提出createHCCLCommEx 中创建子通信域的逻辑,在存在全局通信的情况下,直接基于全局通信域创建子通信域,减少通信域创建时间
image.png

【资料变更】

不涉及

【接口变更】

不涉及

【功能验证】

说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤
新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图
image.png
image.png
image.png

【CheckList】

PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 limuan 的贡献)
limuanlimuan成员
4月22日 创建了 pull request,commit eea05e52
ascend-robot
ascend-robot成员
4月22日 评论:

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
torch_npu/csrc/distributed renyujin, senzhen-town (2/2) renyujin (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

limuan, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
ascend-robotascend-robot成员
4月22日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
4月22日 评论:

当前仓库存在以下 保护分支

Protected Branch Version Release
master
v2.7.1
v2.10.0
v2.8.0
v2.9.0
v2.11.0

评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作

注意:

  1. /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
  2. 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭
likedislike
limuan
limuan成员
4月22日 评论:

compile

likedislike
ascend-robotascend-robot成员
4月22日 添加了label:ci-pipeline-running
ascend-robotascend-robot成员
4月22日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
4月22日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
4月22日 评论:
流水线 PR-pipeline_pytorch#16507 已完成
阶段 任务名 状态 详情
编译构建 Build_X86 >>>
Build_ARM >>>
Build_LibTorch_x86 >>>
Build_X86_torchair 🛑 >>>
Build_ARM_torchair 🛑 >>>
恶意代码检查 Antipoison >>>
编码安全与规范检查 CodeCheck >>>
check_error >>>
开源片段检查 SCA >>>
开发者测试 UT_X86_Part_01 🛑 >>>
UT_X86_Part_02 🛑 >>>
UT_ARM_A3_Part_01 🛑 >>>
UT_ARM_A3_Part_02 🛑 >>>
UT_DIST_X86_Part_01 >>>
UT_DIST_X86_Part_02 >>>
UT_DIST_X86_Part_03 >>>
UT_DIST_X86_Part_04 >>>
UT_inductor_Part_01 🛑 >>>
UT_inductor_Part_02 🛑 >>>
UT_inductor_Part_03 🛑 >>>
UT_inductor_Part_04 🛑 >>>
UT_ARM_A2_Part_01 >>>
UT_ARM_A2_Part_02 >>>
流水线 PR-pipeline_pytorch >>>
likedislike
limuanlimuan成员
4月22日 修改了pull request 的描述
limuanlimuan成员
4月22日 修改了pull request 的描述
梁松伟
梁松伟成员4月22日进行代码检视2
torch_npu/csrc/distributed/ProcessGroupHCCL.cpp
@@ -2706,30 +2717,29 @@
27062717 try {
27072718 globalHcclComm = global_->getHcclCommByDevices(devices);
27082719 } catch (const std::exception& e) {
2709- TORCH_NPU_HCCL_LOGI("create the global HCCL Communicator failed, the exception info is %s, switch to original interface.", e.what());
2720+ TORCH_NPU_HCCL_LOGI("Get global HCCL communicator failed: %s, switch to original interface.", e.what());
27102721 return false;
27112722 }
27122723 if (!globalHcclComm) {
2713- TORCH_NPU_HCCL_LOGI("Create sub hccl comm by hcclCreateSubCommConfig failed, globalHcclComm is nullptr, switch to original interface.");
2724+ TORCH_NPU_HCCL_LOGI("Create sub hccl comm failed, globalHcclComm is nullptr, switch to original interface.");
27142725 return false;
27152726 }
27162727 
2728+ c10_npu::OptionalNPUGuard npuGuard;
27172729 uint64_t hcclid = (std::hash<string>{}(options_->group_id));
27182730 auto subStartTime = std::chrono::steady_clock::now();
27192731 for (size_t i = 0; i < devices.size(); ++i) {
@@ -2780,7 +2792,7 @@ bool ProcessGroupHCCL::createHCCLCommEx(
27802792 auto subEndTime = std::chrono::steady_clock::now();
27812793 auto subTimeElapsed = std::chrono::duration_cast<std::chrono::milliseconds>(subEndTime - subStartTime);
27822794 TORCH_NPU_HCCL_LOGI("Create sub hccl comm by hcclCreateSubCommConfig success, group id is %s, subCommId is %llu, devicesKey is %s, use %d ms.",
2783- options_->group_id.c_str(), hcclid, devicesKey.c_str(), subTimeElapsed.count());
2795+ options_->group_id.c_str(), hcclid, devicesKey.c_str(), static_cast<int>(subTimeElapsed.count()));
27842796 return true;
27852797}
27862798 
@@ -2861,7 +2873,19 @@ std::vector<std::shared_ptr<HCCLComm>>& ProcessGroupHCCL::createHCCLComm(
28612873 };
28622874 at_npu::native::OpCommand::RunOpApiV3("hcclGroupEnd", hccl_call);
28632875 }
2864- if (!createHCCLCommEx(devicesKey, devices, commType, commConfig, hcclComms, streamVal, p2pRank)) {
梁松伟
梁松伟4月22日评论:

新增代码逻辑,补充UT防护

likedislike
limuan
limuan成员
4月22日 评论:

UT另提pr进行看护

li_jing_hw成员
4月22日 评论:

补充有全局通信域的场景

likedislike
limuanlimuan成员
4月22日 修改了pull request 的描述
limuanlimuan成员
4月22日 解决了最后一个问题
limuan
limuan成员
4月22日 评论:

已补充全局通信域创建验证截图

likedislike
renyujin成员
4月22日 评论:

/lgtm

likedislike
senzhen-town成员
4月22日 评论:

/lgtm

likedislike
ascend-robotascend-robot成员
4月22日 添加了label:lgtm
renyujin成员
4月23日 评论:

/approve

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

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: renyujin.
Reviewers who wrote a comment of /lgtm are: renyujin, senzhen-town.

likedislike
ascend-robotascend-robot成员
4月23日 合入了pull request
Wwjlflyer成员
5月7日 关联了issue:[RFC]: HCCL协商模式支持通过全局通信域创建子通信域