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 % 34 0
Test Date: 2026-08-18 17:47:01 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              : #include "calc_partial_mesh_transport_req.h"
      12              : 
      13              : namespace hccl {
      14            0 : CalcPartialMeshTransportReq::CalcPartialMeshTransportReq(
      15            0 :     std::vector<std::vector<u32>>& subCommPlaneVector, std::vector<bool>& isBridgeVector, u32 userRank)
      16            0 :     : CalcTransportReqBase(subCommPlaneVector, isBridgeVector, userRank)
      17            0 : {}
      18              : 
      19            0 : CalcPartialMeshTransportReq::~CalcPartialMeshTransportReq() {}
      20              : 
      21            0 : HcclResult CalcPartialMeshTransportReq::CalcTransportRequest(
      22              :     const std::string& tag, TransportMemType inputMemType, TransportMemType outputMemType,
      23              :     const CommParaInfo& commParaInfo, std::vector<SingleSubCommTransport>& commTransport,
      24              :     [[maybe_unused]] u32 subUserRankRoot)
      25              : {
      26              :     // send/recv分别使用一个comm
      27            0 :     u32 ringSize = 2;
      28            0 :     commTransport.resize(ringSize);
      29              : 
      30            0 :     for (u32 ringIndex = 0; ringIndex < ringSize; ringIndex++) {
      31            0 :         if (commParaInfo.commPlane == COMM_LEVEL1 && !isBridgeVector_.empty() && !isBridgeVector_[0]) {
      32            0 :             continue; // 跳出本次循环
      33              :         }
      34            0 :         CHK_PRT_RET(
      35              :             subCommPlaneVector_.empty(),
      36              :             HCCL_ERROR("[CalcPartialMeshTransportReq][CalcTransportRequest] "
      37              :                        "the vector named subCommPlaneVector_ is empty."),
      38              :             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(
      63              :                     "[CommFactory][CalcPartialMeshCommInfo] param_.tag[%s] ringIndex[%u], localRank[%u], "
      64              :                     "remoteRank[%u], inputMemType[%d], outputMemType[%d]",
      65              :                     tag.c_str(), ringIndex, userRank_, tmpTransport.remoteUserRank, inputMemType, outputMemType);
      66              :             } else {
      67            0 :                 tmpTransport.isValid = false;
      68            0 :                 continue;
      69              :             }
      70              :         }
      71              :     }
      72            0 :     return HCCL_SUCCESS;
      73              : }
      74              : 
      75              : } // namespace hccl
        

Generated by: LCOV version 2.0-1