Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
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.
9 : */
10 :
11 : #include "calc_ahc_broke_transport_req.h"
12 :
13 : namespace hccl {
14 0 : CalcAHCBrokeTransportReq::CalcAHCBrokeTransportReq(std::vector<std::vector<u32>> &subCommPlaneVector,
15 : std::vector<bool> &isBridgeVector, u32 userRank, std::vector<std::vector<std::vector<u32>>> &globalSubGroups,
16 0 : std::map<AHCConcOpType, TemplateType> &ahcAlgOption, std::unordered_map<u32, bool> &isUsedRdmaMap)
17 0 : : CalcAHCTransportReqBase(subCommPlaneVector, isBridgeVector, userRank, globalSubGroups, ahcAlgOption, isUsedRdmaMap)
18 : {
19 0 : }
20 :
21 0 : CalcAHCBrokeTransportReq::~CalcAHCBrokeTransportReq()
22 : {
23 0 : }
24 :
25 0 : HcclResult CalcAHCBrokeTransportReq::DisposeSubGroups(u32 rank)
26 : {
27 0 : std::vector<std::vector<u32>> level1SubGroups;
28 0 : CommAHCBaseInfo::DisposeSubGroups(rank, globalSubGroups_, subGroups_, level1SubGroups);
29 0 : return HCCL_SUCCESS;
30 0 : }
31 :
32 0 : HcclResult CalcAHCBrokeTransportReq::CalcDstRanks(u32 rank, std::set<u32> &dstRanks, u32 ringIndex)
33 : {
34 : (void)ringIndex;
35 :
36 : // 获取 rank 对应分组信息
37 0 : DisposeSubGroups(rank);
38 :
39 : //commAHCBaseInfo_ 初始化
40 0 : CHK_RET(CommAHCInfoInit(subGroups_));
41 :
42 : //计算 AHC建链的目的dstRanks
43 0 : commAHCBaseInfo_->CalcDstRanks(rank, dstRanks);
44 :
45 0 : return HCCL_SUCCESS;
46 : }
47 :
48 0 : HcclResult CalcAHCBrokeTransportReq::CommAHCInfoInit(std::vector<std::vector<u32>> &subGroups)
49 : {
50 0 : commAHCBaseInfo_.reset(new (std::nothrow) CommBrokeAlignInfo(subGroups));
51 0 : CHK_SMART_PTR_NULL(commAHCBaseInfo_);
52 0 : CHK_RET(commAHCBaseInfo_->Init(opType_, ahcAlgOption_));
53 0 : return HCCL_SUCCESS;
54 : }
55 : } // namespace hccl
|