LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_template/ccu_alg_template - ccu_temp_all_gather_v_mesh_1D.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 43 0
Test Date: 2026-07-28 12:11:00 Functions: 0.0 % 5 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 <ios>
      12              : #include <iostream>
      13              : 
      14              : #include "ccu_temp_all_gather_v_mesh_1D.h"
      15              : #include "ccu_instruction_all_gather_v_mesh1d.h"
      16              : #include "ccu_context_all_gather_v_mesh1d.h"
      17              : 
      18              : #include "log.h"
      19              : #include "ccu_rank_group.h"
      20              : #include "ccu_ctx_creator_registry.h"
      21              : #include "alg_data_trans_wrapper.h"
      22              : 
      23              : namespace Hccl {
      24              : static CcuInstRegister<CcuContextAllGatherVMesh1D>
      25              :     g_registrarAllGatherV(CcuInstType::CCU_ALL_GATHER_V_MESH_1D_DIRECT);
      26              : 
      27            0 : CcuTempAllGatherVMesh1D::CcuTempAllGatherVMesh1D(const RankId virtualRank, const u32 tempRankSize,
      28              :                                                          const std::vector<std::vector<RankId>> &tempVTopo,
      29            0 :                                                          const std::map<RankId, u32>            &tempVirtRankMap)
      30            0 :     : CcuAlgTemplateBase(virtualRank, tempRankSize, tempVTopo, tempVirtRankMap)
      31              : {
      32            0 : }
      33              : 
      34            0 : CcuTempAllGatherVMesh1D::~CcuTempAllGatherVMesh1D()
      35              : {
      36            0 : }
      37              : 
      38            0 : HcclResult CcuTempAllGatherVMesh1D::CalcRes(AlgTempResReq &tempResReq)
      39              : {
      40            0 :     tempResReq.queNum    = 1;
      41            0 :     tempResReq.streamNum = tempResReq.queNum;
      42            0 :     HCCL_INFO("[CalcRes] tempResReq.queNum[%u]", tempResReq.queNum);
      43            0 :     CHK_RET(CalcResLinksMesh(myRank_, tempRankSize_, tempVTopo_, linkNumBtwPeers_, tempResReq));
      44            0 :     return HcclResult::HCCL_SUCCESS;
      45              : }
      46              : 
      47            0 : HcclResult CcuTempAllGatherVMesh1D::GenExtIns(const TempFuncs          &tempFuncs,
      48              :                                                   const TemplateDataParams &templateDataParams,
      49              :                                                   const ResLinks &tempLinks, std::vector<InsQuePtr> &tempInsQues)
      50              : {
      51            0 :     CHK_PRT_RET(tempInsQues.empty(),
      52              :         HCCL_ERROR("[CcuTempAllGatherVMesh1D] empty queue"), HcclResult::HCCL_E_INTERNAL);
      53            0 :     CHK_PTR_NULL(tempInsQues[0]);
      54            0 :     opMode_   = tempFuncs.opMode;
      55            0 :     buffInfo_ = templateDataParams.buffInfo;
      56            0 :     CcuInstructionAllGatherVMesh1D ccuIns;
      57            0 :     std::vector<uint64_t>              dimSize;
      58            0 :     dimSize.push_back(tempRankSize_);
      59              : 
      60              :     uint64_t inputAddr
      61            0 :         = BufferTypeToAddr(templateDataParams.buffInfo.inBuffType) + templateDataParams.buffInfo.inBuffBaseOff;
      62              :     uint64_t outputAddr
      63            0 :         = BufferTypeToAddr(templateDataParams.buffInfo.outBuffType) + templateDataParams.buffInfo.outBuffBaseOff;
      64              : 
      65            0 :     uint64_t mySliceSize         = templateDataParams.sliceSize;
      66            0 :     uint64_t mySliceOutputOffset = templateDataParams.outputSliceStride;
      67              : 
      68              :     uint64_t token;
      69            0 :     CHK_RET(GetToken(op_, token));
      70              : 
      71            0 :     ccuIns.Init(static_cast<uint32_t>(myRank_), inputAddr, outputAddr, mySliceSize, mySliceOutputOffset, token, op_, tempVTopo_);
      72            0 :     HCCL_INFO("[CcuTempAllGatherVMesh1D] Run Init: myRank_[%d], dimSize[%llu], inputAddr[%llu],"
      73              :               "outputAddr[%llu], mySliceSize[%llu], mySliceOutputOffset[%llu]",
      74              :               myRank_, dimSize[0], inputAddr, outputAddr, mySliceSize, mySliceOutputOffset);
      75              : 
      76            0 :     std::vector<LinkData> links;
      77            0 :     for (auto &pair : tempLinks) {
      78            0 :         if (pair.second.empty()) {
      79            0 :             continue;
      80              :         }
      81            0 :         links.push_back(pair.second[0]);
      82              :     }
      83            0 :     HCCL_INFO("[CcuTempAllGatherVMesh1D] links.size[%zu]", links.size());
      84            0 :     ccuIns.SetLinks(links);
      85              : 
      86            0 :     RankGroup rankGroup;
      87            0 :     for (auto &peer : tempVTopo_[0]) {
      88            0 :         rankGroup.AddRank(peer);
      89              :     }
      90            0 :     ccuIns.SetRankGroup(rankGroup);
      91              : 
      92            0 :     u32 cntCkeNum = 3;
      93            0 :     ccuIns.SetCntCkeNum(cntCkeNum);
      94            0 :     tempInsQues[0]->Append(std::move(std::make_unique<CcuInstructionAllGatherVMesh1D>(ccuIns)));
      95              : 
      96            0 :     return HcclResult::HCCL_SUCCESS;
      97            0 : }
      98              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1