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 995 : RankGraph() = default;
30 992 : virtual ~RankGraph() = default;
31 0 : virtual HcclResult Init(const RankTable_t &rankTable, const HcclTopoAttr &topoAttr)
32 : {
33 0 : return HCCL_SUCCESS;
34 : };
35 0 : virtual HcclResult GetRankId(uint32_t *rank){return HCCL_E_NOT_SUPPORT;};
36 0 : virtual HcclResult GetRankSize(uint32_t *rankSize){return HCCL_E_NOT_SUPPORT;};
37 0 : virtual HcclResult GetDevicePort(const uint32_t rank, uint32_t *devPort){return HCCL_E_NOT_SUPPORT;};
38 0 : virtual HcclResult GetListenPort(const uint32_t rank, uint32_t *listenPort, EndpointLocType locType){return HCCL_E_NOT_SUPPORT;};
39 : virtual HcclResult GetRankGraphInfo(GraphType type, void **graph, uint32_t *len) = 0;
40 : virtual HcclResult GetLinks(uint32_t netLayer, uint32_t srcRank, uint32_t dstRank, CommLink **linkList,
41 : uint32_t *listSize) = 0;
42 : virtual HcclResult GetNetLayers(uint32_t **netLayers, uint32_t *netLayerNum) = 0;
43 0 : virtual HcclResult GetHeterogMode(HcclHeterogMode *mode) const { return HCCL_SUCCESS; }
44 : virtual HcclResult GetInstTopoTypeByNetLayer(uint32_t netLayer, CommTopo *topoType) = 0;
45 : virtual HcclResult GetInstSizeByNetLayer(uint32_t netLayer, uint32_t *rankNum) = 0;
46 : virtual HcclResult GetInstRanksByNetLayer(uint32_t netLayer, uint32_t **rankList, uint32_t *rankNum) = 0;
47 : virtual HcclResult GetInstSizeListByNetLayer(uint32_t netLayer, uint32_t **instSizeList, uint32_t *listSize) = 0;
48 : virtual HcclResult GetDeviceId(uint32_t rankId, uint32_t *deviceId) = 0;
49 : virtual HcclResult GetEndpointInfo(uint32_t rankId, const EndpointDesc *endPointDesc, EndpointAttr endpointAttr,
50 : uint32_t infoLen, void *info) = 0;
51 : };
52 : } // namespace hccl
53 : #endif
|