已合并
fixing experimental option and ReduceScatter BIRS #2185
Davydov_Danil创建于 7月23日
fixing experimental option and ReduceScatter BIRS #2185
已合并
Davydov_Danil创建于 7月23日
共 16 个文件变更+54-52
@@ -182,7 +182,7 @@ elseif(BUILD_OPEN_PROJECT)
182 182 
183 # Device 侧编译构建183 # Device 侧编译构建
184 if(ENABLE_DEVICE)184 if(ENABLE_DEVICE)
185- add_cann_device_project(hccl)185+ add_cann_device_project(hccl EXT_ARGS -D ENABLE_EXPERIMENTAL=${ENABLE_EXPERIMENTAL})
186 endif()186 endif()
187 187 
188 set(HCCL_HEAD188 set(HCCL_HEAD
Mbuild.sh+9-0文件内容审核中,请稍后刷新重试
@@ -14,6 +14,7 @@ set(PRODUCT_SIDE "device")
14set(HCCL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../" CACHE PATH "Project top directory")14set(HCCL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../" CACHE PATH "Project top directory")
15include(${HCCL_DIR}/cmake/fetch_cann_cmake.cmake)15include(${HCCL_DIR}/cmake/fetch_cann_cmake.cmake)
16project(hccl_device)16project(hccl_device)
17+option(ENABLE_EXPERIMENTAL "Enable experimental features" OFF)
17 18 
18# 初始化 CANN 项目配置19# 初始化 CANN 项目配置
19init_cann_project(PREPEND_MODULE_PATH)20init_cann_project(PREPEND_MODULE_PATH)
@@ -40,7 +40,13 @@ static HcclAlgorithm MakeAicpuAllGatherSequenceMeshNHRNHRMesh()
40 algo.hcclCmdType = HcclCMDType::HCCL_CMD_ALLGATHER;40 algo.hcclCmdType = HcclCMDType::HCCL_CMD_ALLGATHER;
41 algo.engineType = HcclAlgEngineType::COMM_ENGINE_AICPU;41 algo.engineType = HcclAlgEngineType::COMM_ENGINE_AICPU;
42 algo.topoMatch = std::make_shared<TopoMatchFourLevel>();42 algo.topoMatch = std::make_shared<TopoMatchFourLevel>();
43+#ifndef AICPU_COMPILE
43 AlgAttrsRegistry::ParseAlgName("AicpuAllGatherSequenceMeshNHRNHRMesh", algo.algAttrs);44 AlgAttrsRegistry::ParseAlgName("AicpuAllGatherSequenceMeshNHRNHRMesh", algo.algAttrs);
45+#else
46+ // AICPU 独立核库(scatter_aicpu_kernel.so)不链接 host-only 的 AlgAttrsRegistry,
47+ // 直接引用会导致 dlopen 阶段 undefined symbol, 与 REGISTER_ALG_ATTRS 在 AICPU_COMPILE 下置空同理。
48+ algo.algAttrs.name = "AicpuAllGatherSequenceMeshNHRNHRMesh";
49+#endif
44 algo.algoExecDesc = MakeAllGather4LevelAlgoExecDesc();50 algo.algoExecDesc = MakeAllGather4LevelAlgoExecDesc();
45 algo.algName = "AicpuAllGatherSequenceMeshNHRNHRMesh";51 algo.algName = "AicpuAllGatherSequenceMeshNHRNHRMesh";
46 return algo;52 return algo;
@@ -42,9 +42,11 @@ std::vector<CostModelParam> InsV2AllReduceExperimentalSoleExecutor<AlgTopoMatch,
42 42 
43template <typename AlgTopoMatch, typename InsAlgTemplate>43template <typename AlgTopoMatch, typename InsAlgTemplate>
44AlgNetMeta InsV2AllReduceExperimentalSoleExecutor<AlgTopoMatch, InsAlgTemplate>::GetAlgNetMeta(44AlgNetMeta InsV2AllReduceExperimentalSoleExecutor<AlgTopoMatch, InsAlgTemplate>::GetAlgNetMeta(
45- const TopoInfoWithNetLayerDetails* topoInfo) const45+ const TopoInfoWithNetLayerDetails* topoInfo, const OpParam& param, const char* algName) const
46{46{
47 (void)topoInfo;47 (void)topoInfo;
48+ (void)param;
49+ (void)algName;
48 AlgNetMeta meta;50 AlgNetMeta meta;
49 meta.netTypes.push_back(CommTopo::COMM_TOPO_1DMESH);51 meta.netTypes.push_back(CommTopo::COMM_TOPO_1DMESH);
50 meta.intraGroupMode = CostAggMode::SUM;52 meta.intraGroupMode = CostAggMode::SUM;
@@ -37,7 +37,8 @@ public:
37 37 
38 std::vector<CostModelParam> CalcCostCoeff(38 std::vector<CostModelParam> CalcCostCoeff(
39 HcclComm comm, TopoInfoWithNetLayerDetails* topoInfo, const char* algName, const OpParam& param) override;39 HcclComm comm, TopoInfoWithNetLayerDetails* topoInfo, const char* algName, const OpParam& param) override;
40- AlgNetMeta GetAlgNetMeta(const TopoInfoWithNetLayerDetails* topoInfo) const override;40+ AlgNetMeta GetAlgNetMeta(
41+ const TopoInfoWithNetLayerDetails* topoInfo, const OpParam& param, const char* algName) const override;
41 42 
42#ifndef AICPU_COMPILE43#ifndef AICPU_COMPILE
43 HcclResult44 HcclResult
@@ -7,11 +7,6 @@
7# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.7# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8# See LICENSE in the root of the software repository for the full text of the License.8# See LICENSE in the root of the software repository for the full text of the License.
9# -----------------------------------------------------------------------------------------------------------9# -----------------------------------------------------------------------------------------------------------
10- 
11-if(NOT ENABLE_EXPERIMENTAL)
12- return()
13-endif()
14- 
15add_subdirectory(template)10add_subdirectory(template)
16add_subdirectory(topo)11add_subdirectory(topo)
17add_subdirectory(recursive_executor)12add_subdirectory(recursive_executor)
@@ -9,6 +9,7 @@
9 */9 */
10 10 
11#include "allgather_mesh_template.h"11#include "allgather_mesh_template.h"
12+#include "template_factory.h"
12 13 
13namespace ops_hccl {14namespace ops_hccl {
14 15 
@@ -9,6 +9,7 @@
9 */9 */
10 10 
11#include "allgather_nhr_template.h"11#include "allgather_nhr_template.h"
12+#include "template_factory.h"
12 13 
13namespace ops_hccl {14namespace ops_hccl {
14 15 
@@ -7,11 +7,6 @@
7# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.7# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8# See LICENSE in the root of the software repository for the full text of the License.8# See LICENSE in the root of the software repository for the full text of the License.
9# -----------------------------------------------------------------------------------------------------------9# -----------------------------------------------------------------------------------------------------------
10- 
11-if(NOT ENABLE_EXPERIMENTAL)
12- return()
13-endif()
14- 
15set(src_list10set(src_list
16 ${CMAKE_CURRENT_SOURCE_DIR}/alg_template_base_experimental.cc11 ${CMAKE_CURRENT_SOURCE_DIR}/alg_template_base_experimental.cc
17)12)
@@ -7,11 +7,6 @@
7# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.7# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8# See LICENSE in the root of the software repository for the full text of the License.8# See LICENSE in the root of the software repository for the full text of the License.
9# -----------------------------------------------------------------------------------------------------------9# -----------------------------------------------------------------------------------------------------------
10- 
11-if(NOT ENABLE_EXPERIMENTAL)
12- return()
13-endif()
14- 
15set(src_list10set(src_list
16 ${CMAKE_CURRENT_SOURCE_DIR}/topo_experimental.cc11 ${CMAKE_CURRENT_SOURCE_DIR}/topo_experimental.cc
17)12)
@@ -8,10 +8,6 @@
8# See LICENSE in the root of the software repository for the full text of the License.8# See LICENSE in the root of the software repository for the full text of the License.
9# -----------------------------------------------------------------------------------------------------------9# -----------------------------------------------------------------------------------------------------------
10 10 
11-if(NOT ENABLE_EXPERIMENTAL)
12- return()
13-endif()
14- 
15add_subdirectory(birs)11add_subdirectory(birs)
16 12 
17set(src_list13set(src_list
@@ -8,10 +8,6 @@
8# See LICENSE in the root of the software repository for the full text of the License.8# See LICENSE in the root of the software repository for the full text of the License.
9# -----------------------------------------------------------------------------------------------------------9# -----------------------------------------------------------------------------------------------------------
10 10 
11-if(NOT ENABLE_EXPERIMENTAL)
12- return()
13-endif()
14- 
15add_subdirectory(template)11add_subdirectory(template)
16 12 
17set(src_list13set(src_list
@@ -8,10 +8,6 @@
8# See LICENSE in the root of the software repository for the full text of the License.8# See LICENSE in the root of the software repository for the full text of the License.
9# -----------------------------------------------------------------------------------------------------------9# -----------------------------------------------------------------------------------------------------------
10 10 
11-if(NOT ENABLE_EXPERIMENTAL)
12- return()
13-endif()
14- 
15set(src_list11set(src_list
16 ${CMAKE_CURRENT_SOURCE_DIR}/reduce_scatter_birs_inter.cc12 ${CMAKE_CURRENT_SOURCE_DIR}/reduce_scatter_birs_inter.cc
17 ${CMAKE_CURRENT_SOURCE_DIR}/reduce_scatter_birs.cc13 ${CMAKE_CURRENT_SOURCE_DIR}/reduce_scatter_birs.cc
@@ -114,7 +114,7 @@ HcclResult ReduceScatterBIRS::Preprocess(const u32 rank, const u32 rankSize, std
114 return HCCL_E_INTERNAL;114 return HCCL_E_INTERNAL;
115 }115 }
116 if (slices_.size() == 0) {116 if (slices_.size() == 0) {
117- PrepareSlicesData(unitSize, count_, rankSize);117+ CHK_RET(PrepareSlicesData(unitSize, count_, rankSize));
118 }118 }
119 return HCCL_SUCCESS;119 return HCCL_SUCCESS;
120}120}
@@ -132,7 +132,8 @@ HcclResult ReduceScatterBIRS::HCCSProcessMainLoop(
132 void* src = static_cast<void*>(static_cast<u8*>(scratchMem_.addr) + localOffsetByte);132 void* src = static_cast<void*>(static_cast<u8*>(scratchMem_.addr) + localOffsetByte);
133 void* dst = static_cast<void*>(static_cast<u8*>(hccs_links[round - 1].remoteOutput.addr) + remoteOffsetByte);133 void* dst = static_cast<void*>(static_cast<u8*>(hccs_links[round - 1].remoteOutput.addr) + remoteOffsetByte);
134 134 
135- HcommWriteOnThread(subThreads[0], hccs_links[round - 1].handle, dst, src, sliceSize);135+ CHK_RET(static_cast<HcclResult>(
136+ HcommWriteOnThread(subThreads[0], hccs_links[round - 1].handle, dst, src, sliceSize)));
136 137 
137 CHK_RET(static_cast<HcclResult>(138 CHK_RET(static_cast<HcclResult>(
138 HcommChannelNotifyRecordOnThread(subThreads[0], hccs_links[round - 1].handle, NOTIFY_IDX_DATA_SIGNAL)));139 HcommChannelNotifyRecordOnThread(subThreads[0], hccs_links[round - 1].handle, NOTIFY_IDX_DATA_SIGNAL)));
@@ -156,9 +157,9 @@ HcclResult ReduceScatterBIRS::SIOProcessMainLoop(
156 void* src = static_cast<void*>(static_cast<u8*>(inputMem_.addr) + localOffsetByte);157 void* src = static_cast<void*>(static_cast<u8*>(inputMem_.addr) + localOffsetByte);
157 void* dst = static_cast<void*>(static_cast<u8*>(sio_link.remoteOutput.addr) + remoteOffsetByte);158 void* dst = static_cast<void*>(static_cast<u8*>(sio_link.remoteOutput.addr) + remoteOffsetByte);
158 159 
159- HcommWriteReduceOnThread(160+ CHK_RET(static_cast<HcclResult>(HcommWriteReduceOnThread(
160 mainThread, sio_link.handle, dst, src, sliceSize / unitSize, static_cast<HcommDataType>(dataType_),161 mainThread, sio_link.handle, dst, src, sliceSize / unitSize, static_cast<HcommDataType>(dataType_),
161- static_cast<HcommReduceOp>(reductionOp_));162+ static_cast<HcommReduceOp>(reductionOp_))));
162 163 
163 CHK_RET(164 CHK_RET(
164 static_cast<HcclResult>(HcommChannelNotifyRecordOnThread(mainThread, sio_link.handle, NOTIFY_IDX_DATA_SIGNAL)));165 static_cast<HcclResult>(HcommChannelNotifyRecordOnThread(mainThread, sio_link.handle, NOTIFY_IDX_DATA_SIGNAL)));
@@ -207,7 +208,7 @@ HcclResult ReduceScatterBIRS::RunAsync(const u32 rank, const u32 rankSize, std::
207 "ReduceScatterBIRS run: rank[%u] rankSize[%u] inputMem[%p] to outputMem[%p] count[%llu]", rank, rankSize,208 "ReduceScatterBIRS run: rank[%u] rankSize[%u] inputMem[%p] to outputMem[%p] count[%llu]", rank, rankSize,
208 inputMem_.addr, outputMem_.addr, count_);209 inputMem_.addr, outputMem_.addr, count_);
209 210 
210- Preprocess(rank, rankSize, channels);211+ CHK_RET(Preprocess(rank, rankSize, channels));
211 212 
212 u32 rankSizeX_ = 2;213 u32 rankSizeX_ = 2;
213 if (rankSize % rankSizeX_ != 0) {214 if (rankSize % rankSizeX_ != 0) {
@@ -243,15 +244,18 @@ HcclResult ReduceScatterBIRS::RunAsync(const u32 rank, const u32 rankSize, std::
243 244 
244 GetNotifyIdxSubToMain(notifyIdxSubToMain_);245 GetNotifyIdxSubToMain(notifyIdxSubToMain_);
245 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));246 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));
247+ // 说明:Hcomm*OnThread 失败视为致命内部错误,提前返回依赖上层 comm 销毁统一清理线程/通道,
248+ // 此处不做子线程兜底同步。子线程侧等待均受 CUSTOM_TIMEOUT/ExecTimeout 约束,不会永久挂起;
249+ // PostSync 的 wait+record 成对发射,整体跳过不会造成线程 notify 计数失衡。
246 for (u32 round = 0; round < hccs_ranks.size() + 1; round++) {250 for (u32 round = 0; round < hccs_ranks.size() + 1; round++) {
247 // MainRecordSub + SubWaitMain251 // MainRecordSub + SubWaitMain
248 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));252 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));
249 253 
250- HCCSProcessMainLoop(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize);254+ CHK_RET(HCCSProcessMainLoop(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize));
W
Wwenxuemin9月15日

⚠️ [中等] [代码正确性] experimental/ops/reduce_scatter/birs/template/reduce_scatter_birs.cc:251

给 HCCSProcessMainLoop / SIOProcessMainLoop / LocalCopyMainLoop 包上 CHK_RET 后,若失败会提前 return 跳过 PostSyncInterThreads。此时 subThreads[0]/[1] 可能仍阻塞在等待主线程 NotifyRecord,导致子线程挂起、channel notify 状态不一致。

建议:在注释中明确「Hcomm*OnThread 失败即致命,提前返回依赖上层 comm 销毁清理,不再做子线程同步」;或在 RunAsync 出口增加错误清理路径兜底线程同步。

likedislike
Davydov_Danil
9月15日 评论:
251 255 
252- SIOProcessMainLoop(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize);256+ CHK_RET(SIOProcessMainLoop(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize));
253 257 
254- LocalCopyMainLoop(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize);258+ CHK_RET(LocalCopyMainLoop(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize));
255 259 
256 // SubRecordMain + MainWaitSub260 // SubRecordMain + MainWaitSub
257 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));261 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));
@@ -260,7 +264,7 @@ HcclResult ReduceScatterBIRS::RunAsync(const u32 rank, const u32 rankSize, std::
260 // MainRecordSub + SubWaitMain264 // MainRecordSub + SubWaitMain
261 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));265 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));
262 266 
263- FinalStep(rank, rankSize, rankSizeX_, sliceSize, localStrideSize);267+ CHK_RET(FinalStep(rank, rankSize, rankSizeX_, sliceSize, localStrideSize));
264 268 
265 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));269 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));
266 270 
@@ -74,7 +74,8 @@ HcclResult ReduceScatterBIRSInter::HCCSIntraStep(
74 void* src = static_cast<void*>(static_cast<u8*>(scratchMem_.addr) + localOffsetByte);74 void* src = static_cast<void*>(static_cast<u8*>(scratchMem_.addr) + localOffsetByte);
75 void* dst = static_cast<void*>(static_cast<u8*>(hccs_links[round - 1].remoteOutput.addr) + remoteOffsetByte);75 void* dst = static_cast<void*>(static_cast<u8*>(hccs_links[round - 1].remoteOutput.addr) + remoteOffsetByte);
76 76 
77- HcommWriteOnThread(subThreads[0], hccs_links[round - 1].handle, dst, src, localStrideSize * serverNum_);77+ CHK_RET(static_cast<HcclResult>(
78+ HcommWriteOnThread(subThreads[0], hccs_links[round - 1].handle, dst, src, localStrideSize * serverNum_)));
78 79 
79 CHK_RET(static_cast<HcclResult>(80 CHK_RET(static_cast<HcclResult>(
80 HcommChannelNotifyRecordOnThread(subThreads[0], hccs_links[round - 1].handle, NOTIFY_IDX_DATA_SIGNAL)));81 HcommChannelNotifyRecordOnThread(subThreads[0], hccs_links[round - 1].handle, NOTIFY_IDX_DATA_SIGNAL)));
@@ -99,9 +100,9 @@ HcclResult ReduceScatterBIRSInter::SIOIntraStep(
99 void* src = static_cast<void*>(static_cast<u8*>(scratchMem_.addr) + localOffsetByte);100 void* src = static_cast<void*>(static_cast<u8*>(scratchMem_.addr) + localOffsetByte);
100 void* dst = static_cast<void*>(static_cast<u8*>(sio_link.remoteOutput.addr) + remoteOffsetByte);101 void* dst = static_cast<void*>(static_cast<u8*>(sio_link.remoteOutput.addr) + remoteOffsetByte);
101 102 
102- HcommWriteReduceOnThread(103+ CHK_RET(static_cast<HcclResult>(HcommWriteReduceOnThread(
103 mainThread, sio_link.handle, dst, src, localStrideSize * serverNum_ / unitSize,104 mainThread, sio_link.handle, dst, src, localStrideSize * serverNum_ / unitSize,
104- static_cast<HcommDataType>(dataType_), static_cast<HcommReduceOp>(reductionOp_));105+ static_cast<HcommDataType>(dataType_), static_cast<HcommReduceOp>(reductionOp_))));
105 106 
106 CHK_RET(107 CHK_RET(
107 static_cast<HcclResult>(HcommChannelNotifyRecordOnThread(mainThread, sio_link.handle, NOTIFY_IDX_DATA_SIGNAL)));108 static_cast<HcclResult>(HcommChannelNotifyRecordOnThread(mainThread, sio_link.handle, NOTIFY_IDX_DATA_SIGNAL)));
@@ -175,8 +176,8 @@ HcclResult ReduceScatterBIRSInter::InterServer(
175 void* dst = static_cast<void*>(176 void* dst = static_cast<void*>(
176 static_cast<u8*>(channels[((round)*intraRankSize_ + rank) % rankSize].remoteOutput.addr)177 static_cast<u8*>(channels[((round)*intraRankSize_ + rank) % rankSize].remoteOutput.addr)
177 + remoteOffsetByte);178 + remoteOffsetByte);
178- HcommWriteOnThread(179+ CHK_RET(static_cast<HcclResult>(HcommWriteOnThread(
179- mainThread, channels[((round)*intraRankSize_ + rank) % rankSize].handle, dst, src, sliceSize);180+ mainThread, channels[((round)*intraRankSize_ + rank) % rankSize].handle, dst, src, sliceSize)));
180 CHK_RET(static_cast<HcclResult>(HcommChannelNotifyRecordOnThread(181 CHK_RET(static_cast<HcclResult>(HcommChannelNotifyRecordOnThread(
181 mainThread, channels[((round)*intraRankSize_ + rank) % rankSize].handle, NOTIFY_IDX_DATA_SIGNAL)));182 mainThread, channels[((round)*intraRankSize_ + rank) % rankSize].handle, NOTIFY_IDX_DATA_SIGNAL)));
182 CHK_RET(static_cast<HcclResult>(HcommChannelNotifyWaitOnThread(183 CHK_RET(static_cast<HcclResult>(HcommChannelNotifyWaitOnThread(
@@ -190,7 +191,7 @@ HcclResult ReduceScatterBIRSInter::InterServer(
190 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));191 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));
191 for (u32 step = 1; step < serverNum_; step *= 2) {192 for (u32 step = 1; step < serverNum_; step *= 2) {
192 for (u32 i = 0; i + step < serverNum_; i += 2 * step) {193 for (u32 i = 0; i + step < serverNum_; i += 2 * step) {
193- LocalReduceCCLToCCL(ptrSz + sliceSize * (i + step), ptrSz + sliceSize * i, sliceSize, mainThread);194+ CHK_RET(LocalReduceCCLToCCL(ptrSz + sliceSize * (i + step), ptrSz + sliceSize * i, sliceSize, mainThread));
194 }195 }
195 }196 }
196 void* srcSlice = static_cast<void*>(static_cast<u8*>(scratchMem_.addr) + ptrSz);197 void* srcSlice = static_cast<void*>(static_cast<u8*>(scratchMem_.addr) + ptrSz);
@@ -202,7 +203,7 @@ HcclResult ReduceScatterBIRSInter::InterServer(
202// scatter的入口函数203// scatter的入口函数
203HcclResult ReduceScatterBIRSInter::RunAsync(const u32 rank, const u32 rankSize, std::vector<ChannelInfo>& channels)204HcclResult ReduceScatterBIRSInter::RunAsync(const u32 rank, const u32 rankSize, std::vector<ChannelInfo>& channels)
204{205{
205- Preprocess(rank, rankSize, channels);206+ CHK_RET(Preprocess(rank, rankSize, channels));
严正行
严正行严正行9月4日

[LOW] 描述测试仅覆盖单机场景,本次修改的 ReduceScatterBIRSInter(跨服务器路径)错误处理行为变更无验证说明

第 206 行:CHK_RET(Preprocess(rank, rankSize, channels));

问题分析:

  • 本 PR 对 reduce_scatter_birs_inter.cc 的 RunAsync/HCCSIntraStep/SIOIntraStep/PreprocInterServer/InterServer 等函数系统性补 CHK_RET(含第 206 行 RunAsync 入口的 Preprocess、InterServer 内 HcommWriteOnThread 与 LocalReduceCCLToCCL),改变了失败语义:原先这些通信调用失败后继续执行,现在即时向上返回。
  • PR 描述 Testing 一节仅说明 "Single-node: ReduceScatterBirs was deployed on one Atlas A3 node with RankSize set between 4 and 16"。单机(serverNum==1)走的是 ReduceScatterBIRS(reduce_scatter_birs.cc,SelectAndPrepareBirsTemplate 按 isSingleServer 选 TEMPLATE_REDUCE_SCATTER_BIRS);ReduceScatterBIRSInter 的跨服务器路径(含 InterServer 的 NOTIFY_IDX_ACK/DATA_SIGNAL 等待序列)无任何测试覆盖说明。
  • 集合通信中错误传播提前返回可能导致对端 rank 在 notify 等待处超时,该行为变更至少需要在描述中说明验证方式。

建议修复:在 PR 描述 Testing 一节补充 ReduceScatterBIRSInter(多服务器)路径的测试情况;若暂无条件覆盖双机环境,明确说明该路径当前无 ST 覆盖并给出风险评估,便于合入决策。

likedislike
Davydov_Danil
9月7日 评论:
严正行
严正行
9月8日 评论:
206 u32 rankSizeX_ = 2;207 u32 rankSizeX_ = 2;
207 if (intraRankSize_ % rankSizeX_ != 0) {208 if (intraRankSize_ % rankSizeX_ != 0) {
208 HCCL_ERROR(209 HCCL_ERROR(
@@ -231,17 +232,20 @@ HcclResult ReduceScatterBIRSInter::RunAsync(const u32 rank, const u32 rankSize,
231 GetNotifyIdxMainToSub(notifyIdxMainToSub_);232 GetNotifyIdxMainToSub(notifyIdxMainToSub_);
232 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));233 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));
233 234 
234- LocalCopyPreproc(mainThread, rank, sliceSize, localStrideSize);235+ CHK_RET(LocalCopyPreproc(mainThread, rank, sliceSize, localStrideSize));
235 236 
236 GetNotifyIdxSubToMain(notifyIdxSubToMain_);237 GetNotifyIdxSubToMain(notifyIdxSubToMain_);
237 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));238 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));
239+ // 说明:Hcomm*OnThread 失败视为致命内部错误,提前返回依赖上层 comm 销毁统一清理线程/通道,
240+ // 此处不做子线程兜底同步。子线程侧等待均受 CUSTOM_TIMEOUT/ExecTimeout 约束,不会永久挂起;
241+ // PostSync 的 wait+record 成对发射,整体跳过不会造成线程 notify 计数失衡。
238 for (u32 round = 0; round < hccs_ranks.size() + 1; round++) {242 for (u32 round = 0; round < hccs_ranks.size() + 1; round++) {
239 // MainRecordSub + SubWaitMain243 // MainRecordSub + SubWaitMain
240 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));244 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));
241 245 
242- HCCSIntraStep(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize);246+ CHK_RET(HCCSIntraStep(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize));
243- SIOIntraStep(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize);247+ CHK_RET(SIOIntraStep(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize));
244- LocalCopyIntraStep(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize);248+ CHK_RET(LocalCopyIntraStep(round, rank, rankSize, rankSizeX_, sliceSize, localStrideSize));
245 249 
246 // SubRecordMain + MainWaitSub250 // SubRecordMain + MainWaitSub
247 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));251 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));
@@ -250,11 +254,11 @@ HcclResult ReduceScatterBIRSInter::RunAsync(const u32 rank, const u32 rankSize,
250 // MainRecordSub + SubWaitMain254 // MainRecordSub + SubWaitMain
251 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));255 CHK_RET(PreSyncInterThreads(mainThread, subThreads, notifyIdxMainToSub_));
252 256 
253- PreprocInterServer(rank, rankSize, rankSizeX_, sliceSize, localStrideSize, channels);257+ CHK_RET(PreprocInterServer(rank, rankSize, rankSizeX_, sliceSize, localStrideSize, channels));
254 258 
255 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));259 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));
256 260 
257- InterServer(rank, rankSize, rankSizeX_, sliceSize, localStrideSize, channels);261+ CHK_RET(InterServer(rank, rankSize, rankSizeX_, sliceSize, localStrideSize, channels));
258 262 
259 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));263 CHK_RET(PostSyncInterThreads(mainThread, subThreads, notifyIdxSubToMain_));
260 HCCL_INFO("ReduceScatterBIRS finished: rank[%u]", rank);264 HCCL_INFO("ReduceScatterBIRS finished: rank[%u]", rank);