LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/base/communicator - calc_partial_mesh_transport_req.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 35 0
Test Date: 2026-07-28 12:11:00 Functions: 0.0 % 4 0

            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              : 
      12              : #include "calc_partial_mesh_transport_req.h"
      13              : 
      14              : namespace hccl {
      15            0 : CalcPartialMeshTransportReq::CalcPartialMeshTransportReq(std::vector<std::vector<u32>> &subCommPlaneVector,
      16            0 :     std::vector<bool> &isBridgeVector, u32 userRank)
      17            0 :     : CalcTransportReqBase(subCommPlaneVector, isBridgeVector, userRank)
      18              : {
      19            0 : }
      20              : 
      21            0 : CalcPartialMeshTransportReq::~CalcPartialMeshTransportReq()
      22              : {
      23            0 : }
      24              : 
      25            0 : HcclResult CalcPartialMeshTransportReq::CalcTransportRequest(const std::string &tag, TransportMemType inputMemType,
      26              :     TransportMemType outputMemType, const CommParaInfo &commParaInfo,
      27              :     std::vector<SingleSubCommTransport> &commTransport, u32 subUserRankRoot)
      28              : {
      29              :     // send/recv分别使用一个comm
      30            0 :     u32 ringSize = 2;
      31            0 :     commTransport.resize(ringSize);
      32              : 
      33            0 :     for (u32 ringIndex = 0; ringIndex < ringSize; ringIndex++) {
      34            0 :         if (commParaInfo.commPlane == COMM_LEVEL1 && !isBridgeVector_.empty() && !isBridgeVector_[0]) {
      35            0 :             continue; // 跳出本次循环
      36              :         }
      37            0 :         CHK_PRT_RET(subCommPlaneVector_.empty(), HCCL_ERROR("[CalcPartialMeshTransportReq][CalcTransportRequest] "\
      38              :             "the vector named subCommPlaneVector_ is empty."), HCCL_E_NOT_FOUND);
      39            0 :         u32 rank = GetSubCollectiveRank(subCommPlaneVector_[0]);
      40            0 :         if (rank == INVALID_VALUE_RANKID) {
      41            0 :             continue;
      42              :         }
      43              : 
      44            0 :         u32 rankSize = subCommPlaneVector_[0].size();
      45            0 :         SingleSubCommTransport &subCommTransport = commTransport[ringIndex];
      46            0 :         subCommTransport.transportRequests.resize(rankSize);
      47              :         // 只有一张卡时不需要建链
      48            0 :         if (rankSize == HCCL_RANK_SIZE_EQ_ONE) {
      49            0 :             HCCL_INFO("comm base needn't to create links, rankSize_[%u].", rankSize);
      50            0 :             return HCCL_SUCCESS;
      51              :         }
      52              : 
      53            0 :         for (u32 rankIndex = 0; rankIndex < rankSize; rankIndex++) {
      54            0 :             TransportRequest &tmpTransport = subCommTransport.transportRequests[rankIndex];
      55            0 :             auto it = commParaInfo.batchSendRecvtargetRanks.find(subCommPlaneVector_[0][rankIndex]);
      56            0 :             if (rankIndex != rank && it != commParaInfo.batchSendRecvtargetRanks.end()) {
      57            0 :                 tmpTransport.isValid = true;
      58            0 :                 tmpTransport.localUserRank  = userRank_;
      59            0 :                 tmpTransport.remoteUserRank = subCommPlaneVector_[0][rankIndex];
      60            0 :                 tmpTransport.inputMemType = inputMemType;
      61            0 :                 tmpTransport.outputMemType = outputMemType;
      62            0 :                 HCCL_INFO("[CommFactory][CalcPartialMeshCommInfo] param_.tag[%s] ringIndex[%u], localRank[%u], "\
      63              :                     "remoteRank[%u], inputMemType[%d], outputMemType[%d]", tag.c_str(), ringIndex, userRank_,
      64              :                     tmpTransport.remoteUserRank, inputMemType, outputMemType);
      65              :             } else {
      66            0 :                 tmpTransport.isValid = false;
      67            0 :                 continue;
      68              :             }
      69              :         }
      70              :     }
      71            0 :     return HCCL_SUCCESS;
      72              : }
      73              : 
      74              : }  // namespace hccl
        

Generated by: LCOV version 2.0-1