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 : #ifndef RANK_HCOMM_GRAPH_H
12 : #define RANK_HCOMM_GRAPH_H
13 :
14 : #include "topoinfo_struct.h"
15 : #include "hccl/hccl_res.h"
16 : #include "hccl_independent_common.h"
17 : #include "hccl_common.h"
18 : #include "hccl_impl_pub.h"
19 : #include "hccl_rank_graph.h"
20 : #include "hccl_rankgraph.h"
21 :
22 : namespace hccl {
23 : class RankGraph {
24 : public:
25 : static constexpr uint32_t HCCL_NETLAYER_0 = 0;
26 : static constexpr uint32_t HCCL_NETLAYER_1 = 1;
27 : static constexpr uint32_t HCCL_NETLAYER_2 = 2;
28 :
29 1055 : RankGraph() = default;
30 1051 : virtual ~RankGraph() = default;
31 0 : virtual HcclResult Init(const RankTable_t& rankTable, const HcclTopoAttr& topoAttr) { return HCCL_SUCCESS; };
32 0 : virtual HcclResult GetRankId(uint32_t* rank) { return HCCL_E_NOT_SUPPORT; };
33 0 : virtual HcclResult GetRankSize(uint32_t* rankSize) { return HCCL_E_NOT_SUPPORT; };
34 0 : virtual HcclResult GetDevicePort(const uint32_t rank, uint32_t* devPort) { return HCCL_E_NOT_SUPPORT; };
35 0 : virtual HcclResult GetListenPort(const uint32_t rank, uint32_t* listenPort, EndpointLocType locType)
36 : {
37 0 : return HCCL_E_NOT_SUPPORT;
38 : };
39 : virtual HcclResult GetRankGraphInfo(GraphType type, void** graph, uint32_t* len) = 0;
40 : virtual HcclResult
41 : GetLinks(uint32_t netLayer, uint32_t srcRank, uint32_t dstRank, CommLink** linkList, uint32_t* listSize)
42 : = 0;
43 : virtual HcclResult GetNetLayers(uint32_t** netLayers, uint32_t* netLayerNum) = 0;
44 0 : virtual HcclResult GetHeterogMode(HcclHeterogMode* mode) const { return HCCL_SUCCESS; }
45 : virtual HcclResult GetInstTopoTypeByNetLayer(uint32_t netLayer, CommTopo* topoType) = 0;
46 : virtual HcclResult GetInstSizeByNetLayer(uint32_t netLayer, uint32_t* rankNum) = 0;
47 : virtual HcclResult GetInstRanksByNetLayer(uint32_t netLayer, uint32_t** rankList, uint32_t* rankNum) = 0;
48 : virtual HcclResult GetInstSizeListByNetLayer(uint32_t netLayer, uint32_t** instSizeList, uint32_t* listSize) = 0;
49 : virtual HcclResult GetDeviceId(uint32_t rankId, uint32_t* deviceId) = 0;
50 : virtual HcclResult GetEndpointInfo(
51 : uint32_t rankId, const EndpointDesc* endPointDesc, EndpointAttr endpointAttr, uint32_t infoLen, void* info)
52 : = 0;
53 : };
54 : } // namespace hccl
55 : #endif
|