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_mesh_1D_mem2mem_with_stride.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 58 0
Test Date: 2026-08-04 10:52:23 Functions: 0.0 % 7 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 "log.h"
      15              : 
      16              : #include "ccu_instruction_all_gather_mesh1d_mem2mem_with_stride.h"
      17              : #include "ccu_rank_group.h"
      18              : #include "ccu_ctx_creator_registry.h"
      19              : #include "ccu_context_all_gather_mesh1d_mem2mem_with_stride.h"
      20              : #include "ccu_temp_all_gather_mesh_1D_mem2mem_with_stride.h"
      21              : 
      22              : namespace Hccl {
      23              : 
      24              : static CcuInstRegister<CcuContextAllGatherMesh1DMem2MemWithStride>
      25              :     g_registrarAllGather(CcuInstType::CCU_ALLGATHER_MESH_1D_MEM2MEM_WITH_STRIDE_DIRECT);
      26              : 
      27            0 : CcuTempAllGatherMesh1DMem2MemWithStride::CcuTempAllGatherMesh1DMem2MemWithStride(
      28              :     const RankId virtualRank, const u32 tempRankSize, 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 : CcuTempAllGatherMesh1DMem2MemWithStride::~CcuTempAllGatherMesh1DMem2MemWithStride()
      35              : {
      36            0 : }
      37              : 
      38            0 : HcclResult CcuTempAllGatherMesh1DMem2MemWithStride::CalcRes(AlgTempResReq &tempResReq)
      39              : {
      40            0 :     tempResReq.queNum    = 1;
      41            0 :     tempResReq.streamNum = tempResReq.queNum;
      42            0 :     HCCL_DEBUG("[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 : uint64_t CcuTempAllGatherMesh1DMem2MemWithStride::GetMaxSliceSize() const
      48              : {
      49            0 :     return UB_MAX_DATA_SIZE;
      50              : }
      51              : 
      52            0 : HcclResult CcuTempAllGatherMesh1DMem2MemWithStride::GenExtIns(const TempFuncs          &tempFuncs,
      53              :                                                               const TemplateDataParams &templateDataParams,
      54              :                                                               const ResLinks           &tempLinks,
      55              :                                                               std::vector<InsQuePtr>   &tempInsQues)
      56              : {
      57            0 :     CHK_PRT_RET(tempInsQues.empty(),
      58              :         HCCL_ERROR("[CcuTempAllGatherMesh1DMem2MemWithStride] empty queue"), HcclResult::HCCL_E_INTERNAL);
      59            0 :     CHK_PTR_NULL(tempInsQues[0]);
      60              : 
      61            0 :     opMode_   = tempFuncs.opMode;
      62            0 :     buffInfo_ = templateDataParams.buffInfo;
      63            0 :     CcuInstructionAllGatherMesh1DMem2MemWithStride ccuIns;
      64            0 :     std::vector<uint64_t> dimSize;
      65            0 :     dimSize.push_back(tempRankSize_);
      66              : 
      67            0 :     uint32_t                                rankId    = myRank_;
      68            0 :     uint32_t                                repeatNum = templateDataParams.repeatNum;
      69            0 :     const CollAlgOperator                  &op        = op_;
      70            0 :     const std::vector<std::vector<RankId>> &tempVTopo = tempVTopo_;
      71            0 :     uint64_t inputAddr  = BufferTypeToAddr(buffInfo_.inBuffType) + buffInfo_.inBuffBaseOff;
      72            0 :     uint64_t outputAddr = BufferTypeToAddr(buffInfo_.outBuffType) + buffInfo_.outBuffBaseOff;
      73              :     uint64_t token;
      74            0 :     CHK_RET(GetToken(op_, token));
      75            0 :     uint64_t inputSliceStride   = templateDataParams.inputSliceStride;
      76            0 :     uint64_t outputSliceStride  = templateDataParams.outputSliceStride;
      77            0 :     uint64_t inputRepeatStride  = templateDataParams.inputRepeatStride;
      78            0 :     uint64_t outputRepeatStride = templateDataParams.outputRepeatStride;
      79            0 :     uint64_t normalSliceSize    = templateDataParams.sliceSize;
      80            0 :     uint64_t lastSliceSize      = templateDataParams.tailSize;
      81            0 :     uint64_t isInputOutputEqual = (inputAddr == outputAddr) ? 1 : 0;
      82              : 
      83            0 :     ccuIns.Init(tempVirtRankMap_[rankId], repeatNum, op, tempVTopo, inputAddr, outputAddr, token, inputSliceStride,
      84              :                 outputSliceStride, inputRepeatStride, outputRepeatStride, normalSliceSize, lastSliceSize,
      85              :                 isInputOutputEqual);
      86              : 
      87            0 :     HCCL_DEBUG("[CcuTempAllGatherMesh1DMem2MemWithStride] Run Init: rankId[%u], repeatNum[%u], inputAddr[%llu], "
      88              :                "outputAddr[%llu], inputSliceStride[%llu], outputSliceStride[%llu], "
      89              :                "inputRepeatStride[%llu], outputRepeatStride[%llu], normalSliceSize[%llu], lastSliceSize[%llu]",
      90              :                rankId, repeatNum, inputAddr, outputAddr, inputSliceStride, outputSliceStride, inputRepeatStride,
      91              :                outputRepeatStride, normalSliceSize, lastSliceSize);
      92              : 
      93            0 :     std::vector<LinkData> links;
      94            0 :     for (auto &pair : tempLinks) {
      95            0 :         if (pair.second.empty()) {
      96            0 :             continue;
      97              :         }
      98            0 :         links.push_back(pair.second[0]);
      99              :     }
     100            0 :     HCCL_DEBUG("[CcuTempAllGatherMesh1DMem2MemWithStride] links.size[%zu]", links.size());
     101            0 :     ccuIns.SetLinks(links);
     102              : 
     103            0 :     RankGroup rankGroup;
     104            0 :     for (auto &peer : tempVTopo_[0]) {
     105            0 :         rankGroup.AddRank(peer);
     106              :     }
     107            0 :     u32 cntCkeNum = 3;
     108            0 :     ccuIns.SetCntCkeNum(cntCkeNum);
     109            0 :     ccuIns.SetRankGroup(rankGroup);
     110            0 :     HCCL_DEBUG("CcuInstructionAllGatherMesh1DMem2MemWithStride is [%s]", ccuIns.Describe().c_str());
     111            0 :     ccuIns.Describe();
     112            0 :     tempInsQues[0]->Append(std::move(std::make_unique<CcuInstructionAllGatherMesh1DMem2MemWithStride>(ccuIns)));
     113              : 
     114            0 :     return HcclResult::HCCL_SUCCESS;
     115            0 : }
     116              : 
     117            0 : HcclResult CcuTempAllGatherMesh1DMem2MemWithStride::GenExtIns(const RankGraph *rankGraph, const TemplateInfo &tmpInfo,
     118              :                                                               const std::vector<InsQuePtr> &tempInsQues) const
     119              : {
     120              :     (void)rankGraph;
     121              :     (void)tmpInfo;
     122              :     (void)tempInsQues;
     123              :     // 框架解析aicpuIns,算法的algCompnnetLite在device侧直接调用Run()
     124            0 :     return HcclResult::HCCL_SUCCESS;
     125              : }
     126              : 
     127              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1