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