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_to_all_v_aiv_direct_executor.h"
12 :
13 : namespace hccl {
14 :
15 0 : CollRunAlltoAllAivDirect::CollRunAlltoAllAivDirect(
16 0 : const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher)
17 0 : : CollAlltoAllExecutor(dispatcher, topoMatcher)
18 0 : {}
19 :
20 : // 超节点内建SDMA链路;超节点间建RDMA链路
21 0 : HcclResult CollRunAlltoAllAivDirect::CalcLevel0CommInfo(
22 : TransportMemType inputType, TransportMemType outputType, std::vector<LevelNSubCommTransport>& opTransport)
23 : {
24 0 : CommParaInfo commCombinePara(COMM_LEVEL0, CommType::COMM_TAG_MESH);
25 0 : CHK_RET(CalcCommPlaneInfo(tag_, commCombinePara, opTransport[COMM_LEVEL0], inputType, outputType));
26 :
27 0 : LevelNSubCommTransport& commTransportLevel0 = opTransport[COMM_LEVEL0];
28 0 : for (u32 subCommIndex = 0; subCommIndex < commTransportLevel0.size(); subCommIndex++) {
29 0 : for (auto& transportRequest : commTransportLevel0[subCommIndex].transportRequests) {
30 0 : transportRequest.isUsedRdma = topoAttr_.isUsedRdmaMap.at(transportRequest.remoteUserRank);
31 : }
32 : }
33 0 : return HCCL_SUCCESS;
34 0 : }
35 :
36 0 : HcclResult CollRunAlltoAllAivDirect::CalcLevel1CommInfo(
37 : TransportMemType inputType, TransportMemType outputType, std::vector<LevelNSubCommTransport>& opTransport)
38 : {
39 0 : CommParaInfo commCombinePara(COMM_MESH_L1, CommType::COMM_TAG_MESH);
40 0 : CHK_RET(CalcCommPlaneInfo(tag_, commCombinePara, opTransport[COMM_MESH_L1], inputType, outputType));
41 :
42 0 : LevelNSubCommTransport& commTransportLevel0 = opTransport[COMM_MESH_L1];
43 0 : for (u32 subCommIndex = 0; subCommIndex < commTransportLevel0.size(); subCommIndex++) {
44 0 : for (auto& transportRequest : commTransportLevel0[subCommIndex].transportRequests) {
45 0 : transportRequest.isUsedRdma = true;
46 : }
47 : }
48 0 : return HCCL_SUCCESS;
49 0 : }
50 :
51 : HcclResult
52 0 : CollRunAlltoAllAivDirect::CalcTransportMemType(TransportMemType& inputType, TransportMemType& outputType) const
53 : {
54 0 : inputType = TransportMemType::CCL_INPUT;
55 0 : outputType = TransportMemType::CCL_OUTPUT;
56 :
57 0 : HCCL_INFO(
58 : "[CollRunAlltoAllAivDirect][CalcTransportMemType] tag[%s] inputType[%d], outputType[%d]", tag_.c_str(),
59 : inputType, outputType);
60 0 : return HCCL_SUCCESS;
61 : }
62 :
63 0 : HcclResult CollRunAlltoAllAivDirect::CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport)
64 : {
65 0 : TransportMemType inputType = TransportMemType::RESERVED;
66 0 : TransportMemType outputType = TransportMemType::RESERVED;
67 :
68 0 : CHK_RET(CalcTransportMemType(inputType, outputType));
69 : // level0 hccs 全连接通信域
70 0 : CHK_RET(CalcLevel0CommInfo(inputType, outputType, opTransport));
71 : // level1 roce deviceid通信域
72 0 : CHK_RET(CalcLevel1CommInfo(inputType, outputType, opTransport));
73 :
74 0 : return HCCL_SUCCESS;
75 : }
76 :
77 : REGISTER_EXEC("RunAlltoAllAivDirect", AlltoAllVAivDirect, CollRunAlltoAllAivDirect);
78 : } // namespace hccl
|