LCOV - code coverage report
Current view: top level - coll_communicator_mgr/rank_graph - rank_graph_v2.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 77.3 % 44 34
Test Date: 2026-08-18 17:47:01 Functions: 81.8 % 22 18

            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 "rank_graph_v2.h"
      12              : 
      13              : namespace hccl {
      14              : 
      15            0 : RankGraphV2::RankGraphV2() {}
      16              : 
      17          341 : RankGraphV2::~RankGraphV2() {}
      18              : 
      19          197 : RankGraphV2::RankGraphV2(void* rankGraphPtr) { pImpl = std::make_unique<Hccl::IRankGraph>(rankGraphPtr); }
      20              : 
      21          484 : HcclResult RankGraphV2::GetRankSize(uint32_t* rankSize) { return pImpl->GetRankSize(rankSize); }
      22              : 
      23            2 : HcclResult RankGraphV2::GetDevicePort(const uint32_t rank, uint32_t* devPort)
      24              : {
      25            2 :     CHK_RET(pImpl->GetDevicePort(rank, devPort));
      26            2 :     return HCCL_SUCCESS;
      27              : }
      28              : 
      29           77 : HcclResult RankGraphV2::GetListenPort(const uint32_t rank, uint32_t* listenPort, EndpointLocType locType)
      30              : {
      31           77 :     if (locType == EndpointLocType::ENDPOINT_LOC_TYPE_DEVICE) {
      32           77 :         CHK_RET(pImpl->GetDevicePort(rank, listenPort));
      33            0 :     } else if (locType == EndpointLocType::ENDPOINT_LOC_TYPE_HOST) {
      34            0 :         CHK_RET(pImpl->GetHostPort(rank, listenPort));
      35              :     } else {
      36            0 :         HCCL_ERROR("[%s] Invalid locType[%d] for rank[%u]", __func__, locType, rank);
      37            0 :         return HcclResult::HCCL_E_PARA;
      38              :     }
      39           77 :     return HCCL_SUCCESS;
      40              : }
      41              : 
      42            0 : HcclResult RankGraphV2::GetRankId(uint32_t* rank) { return pImpl->GetRankId(rank); }
      43              : 
      44              : HcclResult
      45            2 : RankGraphV2::GetLinks(uint32_t netLayer, uint32_t srcRank, uint32_t dstRank, CommLink** linkList, uint32_t* listSize)
      46              : {
      47            2 :     return pImpl->GetLinks(netLayer, srcRank, dstRank, linkList, listSize);
      48              : }
      49              : 
      50            0 : HcclResult RankGraphV2::GetRankGraphInfo([[maybe_unused]] GraphType type, void** graph, uint32_t* len)
      51              : {
      52            0 :     return pImpl->GetRankGraphInfo(graph, len);
      53              : }
      54              : 
      55           80 : HcclResult RankGraphV2::GetDeviceId(uint32_t rankId, uint32_t* deviceId)
      56              : {
      57           80 :     return pImpl->GetDeviceId(rankId, deviceId);
      58              : }
      59              : 
      60            1 : HcclResult RankGraphV2::GetNetLayers(uint32_t** netLayers, uint32_t* netLayerNum)
      61              : {
      62            1 :     return pImpl->GetNetLayers(netLayers, netLayerNum);
      63              : }
      64              : 
      65            2 : HcclResult RankGraphV2::GetInstTopoTypeByNetLayer(uint32_t netLayer, CommTopo* topoType)
      66              : {
      67            2 :     return pImpl->GetInstTopoTypeByNetLayer(netLayer, topoType);
      68              : }
      69              : 
      70            2 : HcclResult RankGraphV2::GetInstSizeByNetLayer(uint32_t netLayer, uint32_t* rankNum)
      71              : {
      72            2 :     return pImpl->GetInstSizeByNetLayer(netLayer, rankNum);
      73              : }
      74              : 
      75            2 : HcclResult RankGraphV2::GetInstRanksByNetLayer(uint32_t netLayer, uint32_t** rankList, uint32_t* rankNum)
      76              : {
      77            2 :     return pImpl->GetInstRanksByNetLayer(netLayer, rankList, rankNum);
      78              : }
      79              : 
      80            2 : HcclResult RankGraphV2::GetInstSizeListByNetLayer(uint32_t netLayer, uint32_t** instSizeList, uint32_t* listSize)
      81              : {
      82            2 :     return pImpl->GetInstSizeListByNetLayer(netLayer, instSizeList, listSize);
      83              : }
      84              : 
      85            1 : HcclResult RankGraphV2::GetTopoInstsByLayer(uint32_t netLayer, uint32_t** topoInsts, uint32_t* topoInstNum)
      86              : {
      87            1 :     return pImpl->GetTopoInstsByLayer(netLayer, topoInsts, topoInstNum);
      88              : }
      89              : 
      90            2 : HcclResult RankGraphV2::GetTopoType(const uint32_t netLayer, const uint32_t topoInstId, CommTopo* topoType)
      91              : {
      92            2 :     return pImpl->GetTopoType(netLayer, topoInstId, topoType);
      93              : }
      94              : 
      95              : HcclResult
      96            2 : RankGraphV2::GetRanksByTopoInst(const uint32_t netLayer, const uint32_t topoInstId, uint32_t** ranks, uint32_t* rankNum)
      97              : {
      98            2 :     return pImpl->GetRanksByTopoInst(netLayer, topoInstId, ranks, rankNum);
      99              : }
     100              : 
     101            1 : HcclResult RankGraphV2::GetEndpointNum(uint32_t netLayer, uint32_t topoInstId, uint32_t* num)
     102              : {
     103            1 :     return pImpl->GetEndpointNum(netLayer, topoInstId, num);
     104              : }
     105              : 
     106              : HcclResult
     107            1 : RankGraphV2::GetEndpointDesc(uint32_t netLayer, uint32_t topoInstId, uint32_t* descNum, EndpointDesc* endpointDesc)
     108              : {
     109            1 :     return pImpl->GetEndpointDesc(netLayer, topoInstId, descNum, endpointDesc);
     110              : }
     111              : 
     112            0 : HcclResult RankGraphV2::GetEndpointInfo(
     113              :     uint32_t rankId, const EndpointDesc* endPointDesc, EndpointAttr endpointAttr, uint32_t infoLen, void* info)
     114              : {
     115            0 :     return pImpl->GetEndpointInfo(rankId, endPointDesc, endpointAttr, infoLen, info);
     116              : }
     117              : 
     118              : }; // namespace hccl
        

Generated by: LCOV version 2.0-1