LCOV - code coverage report
Current view: top level - legacy/ascend950/interface - rank_graph_interface.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 3 3

            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_GRAPH_INTERFACE_H
      12              : #define RANK_GRAPH_INTERFACE_H
      13              : 
      14              : #include "hccl_rank_graph.h"
      15              : #include "hccl_types.h"
      16              : #include "rank_gph.h"
      17              : 
      18              : namespace Hccl {
      19              : 
      20              :     class IRankGraph {
      21              :     public:
      22          130 :         IRankGraph(void *rankGraphPtr) : rankGraphPtr_(rankGraphPtr) {}
      23              : 
      24          256 :         virtual ~IRankGraph() = default;
      25              : 
      26              :         HcclResult GetRankId(uint32_t *rank);
      27              :         HcclResult GetRankSize(uint32_t *rankSize);
      28              :         HcclResult GetDevicePort(const uint32_t rank, uint32_t *devPort);
      29              :         HcclResult GetHostPort(const uint32_t rank, uint32_t *hostPort);
      30              :         HcclResult GetLinks(uint32_t netLayer, uint32_t srcRank, uint32_t dstRank, CommLink **linkList, uint32_t *listSize);
      31              :         HcclResult GetRankGraphInfo(void **graph, uint32_t *len);
      32              :         HcclResult GetNetLayers(uint32_t **netLayers, uint32_t *netLayerNum);
      33              :         HcclResult GetInstTopoTypeByNetLayer(uint32_t netLayer, CommTopo *topoType);
      34              :         HcclResult GetInstSizeByNetLayer(uint32_t netLayer, uint32_t *rankNum);
      35              :         HcclResult GetInstRanksByNetLayer(uint32_t netLayer, uint32_t **rankList, uint32_t *rankNum);
      36              :         HcclResult GetInstSizeListByNetLayer(uint32_t netLayer, uint32_t **instSizeList, uint32_t *listSize);
      37              :         HcclResult GetTopoInstsByLayer(uint32_t netLayer, uint32_t** topoInsts, uint32_t* topoInstNum);
      38              :         HcclResult GetTopoType(const uint32_t netLayer, const uint32_t topoInstId, CommTopo* topoType);
      39              :         HcclResult GetRanksByTopoInst(const uint32_t netLayer, const uint32_t topoInstId, uint32_t** ranks, uint32_t* rankNum);
      40              :         HcclResult GetEndpointNum(uint32_t netLayer, uint32_t topoInstId, uint32_t *num);
      41              :             HcclResult GetEndpointDesc(uint32_t netLayer, uint32_t topoInstId, uint32_t *descNum, EndpointDesc *endpointDesc);
      42              :             HcclResult GetEndpointInfo(uint32_t rankId, const EndpointDesc *endPointDesc, EndpointAttr endpointAttr, uint32_t infoLen, void *info);
      43              :         HcclResult GetDeviceId(uint32_t rankId, uint32_t *deviceId);
      44              : 
      45              :     private:
      46              :         void *rankGraphPtr_;
      47              :         std::vector<uint32_t> instSizeVec_;
      48              :         std::vector<uint32_t> rankListVec_;
      49              :         std::vector<uint32_t> netLayersVec_;
      50              :         std::vector<CommLink> linkListVec_;
      51              :         std::vector<uint32_t> topoInstsVec_;
      52              :         std::vector<uint32_t> ranksVec_;
      53              :     };
      54              : 
      55              : }  // namespace Hccl
      56              : 
      57              : #endif  // RANK_GRAPH_INTERFACE_H
        

Generated by: LCOV version 2.0-1