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 "coll_all_gather_ars_for_910_93_executor.h"
12 :
13 : namespace hccl {
14 0 : CollAllGatherARSFor91093Executor::CollAllGatherARSFor91093Executor(const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher> &topoMatcher)
15 0 : : CollAllGatherRingFor91093Executor(dispatcher, topoMatcher)
16 : {
17 0 : DMAReduceFlag_ = false; //设置成不带削减的非并发流
18 0 : }
19 :
20 0 : HcclResult CollAllGatherARSFor91093Executor::CalcStreamNum(u32& streamNum)
21 : {
22 0 : u32 totalStreamNum = LEVEL0_PLANE_NUM_IN_NPRING_SINGLE;
23 0 : if (intraRingSize_ > FACTOR_TWO && topoAttr_.isARSDoubleRing) {
24 0 : totalStreamNum = LEVEL0_PLANE_NUM_IN_NPRING_DOUBLE;
25 : }
26 :
27 0 : streamNum = totalStreamNum - 1;
28 0 : HCCL_INFO("[CollAllGatherARSFor91093Executor][CalcStreamNum] tag[%s] streamNum_[%u]",
29 : tag_.c_str(), streamNum);
30 0 : return HCCL_SUCCESS;
31 : }
32 :
33 0 : HcclResult CollAllGatherARSFor91093Executor::CalcLevel0CommInfo(TransportMemType inputType,
34 : TransportMemType outputType,
35 : std::vector<LevelNSubCommTransport>& opTransport)
36 : {
37 0 : CHK_RET(SetCommInfoForARS(intraRingSize_));
38 0 : CommParaInfo commParaLevel0(COMM_LEVEL0, CommType::COMM_TAG_RING_INNER);
39 0 : CHK_RET(CalcCommPlaneInfo(tag_, commParaLevel0, opTransport[COMM_LEVEL0], inputType, outputType));
40 0 : CommParaInfo commARSIntra(COMM_LEVEL0_LOGICAL, CommType::COMM_TAG_RING_INNER);
41 0 : CHK_RET(CalcCommPlaneInfo(tag_, commARSIntra, opTransport[COMM_LEVEL0_LOGICAL], inputType, outputType));
42 0 : return HCCL_SUCCESS;
43 0 : }
44 :
45 0 : HcclResult CollAllGatherARSFor91093Executor::CalcLevel1CommInfo(TransportMemType inputType,
46 : TransportMemType outputType,
47 : std::vector<LevelNSubCommTransport>& opTransport)
48 : {
49 0 : if (algType_.algoLevel1 == AlgTypeLevel1::ALG_LEVEL1_RING) {
50 0 : HCCL_DEBUG("[CalcARSInterCommInfo] use ring comm type");
51 0 : CommParaInfo commARSInter(COMM_LEVEL1_LOGICAL, CommType::COMM_TAG_RING_INNER);
52 0 : CHK_RET(CalcCommPlaneInfo(tag_, commARSInter, opTransport[COMM_LEVEL1_LOGICAL], inputType, outputType));
53 0 : } else if(algType_.algoLevel1 == AlgTypeLevel1::ALG_LEVEL1_NB) {
54 0 : HCCL_DEBUG("[CalcARSInterCommInfo] use NB comm type");
55 0 : CommParaInfo commARSInter(COMM_LEVEL1_LOGICAL, CommType::COMM_TAG_NONUNIFORM_BRUCK);
56 0 : CHK_RET(CalcCommPlaneInfo(tag_, commARSInter, opTransport[COMM_LEVEL1_LOGICAL], inputType, outputType));
57 0 : } else {
58 0 : HCCL_DEBUG("[CalcARSInterCommInfo] use NHR comm type");
59 0 : CommParaInfo commARSInter(COMM_LEVEL1_LOGICAL, CommType::COMM_TAG_NONUNIFORM_HIERARCHICAL_RING);
60 0 : CHK_RET(CalcCommPlaneInfo(tag_, commARSInter, opTransport[COMM_LEVEL1_LOGICAL], inputType, outputType));
61 0 : }
62 0 : return HCCL_SUCCESS;
63 : }
64 :
65 0 : HcclResult CollAllGatherARSFor91093Executor::GetLevelCommInfo()
66 : {
67 0 : logicalLevel0plane_ = COMM_LEVEL0_LOGICAL;
68 0 : CHK_RET(CheckCommSize(logicalLevel0plane_, COMM_INDEX_0 + 1));
69 0 : logicalLevel0CommInfo_ = GetSubCommInfo(logicalLevel0plane_, COMM_INDEX_0);
70 0 : logicalLevel1plane_ = COMM_LEVEL1_LOGICAL;
71 0 : CHK_RET(CheckCommSize(logicalLevel1plane_, logicalLevel0CommInfo_.localRank + 1));
72 0 : logicalLevel1CommInfo_ = GetSubCommInfo(logicalLevel1plane_, logicalLevel0CommInfo_.localRank);
73 0 : return HCCL_SUCCESS;
74 : }
75 :
76 0 : HcclResult CollAllGatherARSFor91093Executor::CalcOptimalIntraRing(const OpParam& param)
77 : {
78 0 : intraRingSize_ = CalcOptimalIntraRingsize(param.DataDes.count, param.DataDes.dataType, HcclCMDType::HCCL_CMD_ALLGATHER);
79 0 : HCCL_INFO("intraRingSize_[%u]",intraRingSize_);
80 0 : return HCCL_SUCCESS;
81 : }
82 :
83 : REGISTER_EXEC("AllGatherARSFor91093Executor", AllGatherARSFor91093, CollAllGatherARSFor91093Executor);
84 : } // namespace hccl
|