LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor/coll_all_gather - coll_all_gather_mesh_opbase_pipeline_executor.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 72 0
Test Date: 2026-07-28 12:11:00 Functions: 0.0 % 11 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 "coll_all_gather_mesh_opbase_pipeline_executor.h"
      12              : 
      13              : namespace hccl {
      14            0 : CollAllGatherMeshOpbasePipelineExecutor::CollAllGatherMeshOpbasePipelineExecutor(const HcclDispatcher dispatcher,
      15            0 :     std::unique_ptr<TopoMatcher> &topoMatcher)
      16            0 :     : CollAllGatherExecutor(dispatcher, topoMatcher)
      17              : {
      18            0 :     DMAReduceFlag_ = true;
      19            0 : }
      20              : 
      21            0 : HcclResult CollAllGatherMeshOpbasePipelineExecutor::CalcStreamNum(u32& streamNum)
      22              : {
      23            0 :     u32 totalStreamNum = topoAttr_.deviceNumPerAggregation + 1U;
      24            0 :     streamNum = totalStreamNum - 1U;
      25            0 :     HCCL_INFO("[CollAllGatherMeshOpbasePipelineExecutor][CalcStreamNum] tag[%s] streamNum[%u]",
      26              :         tag_.c_str(), streamNum);
      27            0 :     return HCCL_SUCCESS;
      28              : }
      29              : 
      30            0 : HcclResult CollAllGatherMeshOpbasePipelineExecutor::CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport)
      31              : {
      32            0 :     TransportMemType inputType = TransportMemType::RESERVED;
      33            0 :     TransportMemType outputType = TransportMemType::RESERVED;
      34            0 :     CHK_RET(CalcTransportMemType(inputType, outputType));
      35            0 :     CHK_RET(CalcLevel0CommInfo(inputType, outputType, opTransport));
      36            0 :     CHK_RET(CalcLevel1CommInfo(inputType, outputType, opTransport));
      37            0 :     return HCCL_SUCCESS;
      38              : }
      39              : 
      40            0 : HcclResult CollAllGatherMeshOpbasePipelineExecutor::CalcTransportMemType(TransportMemType &inputType,
      41              :     TransportMemType &outputType)
      42              : {
      43            0 :     inputType = TransportMemType::CCL_INPUT;
      44            0 :     outputType = TransportMemType::CCL_OUTPUT;
      45            0 :     HCCL_INFO("[CollAllGatherMeshOpbasePipelineExecutor][CalcTransportMemType]" \
      46              :         "tag[%s] inputType[%d], outputType[%d]",
      47              :         tag_.c_str(), inputType, outputType);
      48            0 :     return HCCL_SUCCESS;
      49              : }
      50              : 
      51            0 : HcclResult CollAllGatherMeshOpbasePipelineExecutor::CalcLevel0CommInfo(TransportMemType inputType,
      52              :     TransportMemType outputType,
      53              :     std::vector<LevelNSubCommTransport>& opTransport)
      54              : {
      55            0 :     CommParaInfo commParaInfo(COMM_LEVEL0, CommType::COMM_TAG_MESH);
      56            0 :     CHK_RET(CalcCommPlaneInfo(tag_, commParaInfo, opTransport[COMM_LEVEL0], inputType, outputType));
      57            0 :     return HCCL_SUCCESS;
      58            0 : }
      59              : 
      60              : // PipeLine模式下使用Ring算法
      61            0 : HcclResult CollAllGatherMeshOpbasePipelineExecutor::CalcLevel1CommInfo(TransportMemType inputType,
      62              :     TransportMemType outputType,
      63              :     std::vector<LevelNSubCommTransport>& opTransport)
      64              : {
      65            0 :     CommParaInfo commParaInfo(COMM_LEVEL1, CommType::COMM_TAG_RING_INNER);
      66            0 :     CHK_RET(CalcCommPlaneInfo(tag_, commParaInfo, opTransport[COMM_LEVEL1], inputType, outputType));
      67            0 :     return HCCL_SUCCESS;
      68            0 : }
      69              : 
      70            0 : u64 CollAllGatherMeshOpbasePipelineExecutor::CalcLoopMaxCount(const u64 cclBuffSize, const u32 unitSize)
      71              : {
      72            0 :     u64 maxCountPerLoop = (cclBuffSize - HCCL_MIN_SLICE_ALIGN_910B) / unitSize;
      73            0 :     return maxCountPerLoop;
      74              : }
      75              : 
      76            0 : bool CollAllGatherMeshOpbasePipelineExecutor::IsHugeData(const u64 curSize)
      77              : {
      78            0 :     bool hugeData = curSize > RDMA_SEND_MAX_SIZE || curSize > SDMA_SEND_MAX_SIZE;
      79            0 :     return hugeData;
      80              : }
      81              : 
      82            0 : HcclResult CollAllGatherMeshOpbasePipelineExecutor::KernelRun(const OpParam &param, ExecMem &execMem)
      83              : {
      84            0 :     HCCL_CONFIG_INFO(HCCL_ALG,
      85              :         "[CollAllGatherMeshOpbasePipelineExecutor][KernelRun]AllGatherMeshOpbasePipelineExecutor begins.");
      86              : 
      87              :     // step 1 先获取 comm level0 \ comm level1 的value
      88            0 :     CHK_RET(CheckCommSize(COMM_LEVEL0, COMM_INDEX_0 + 1));
      89            0 :     SubCommInfo level0CommInfo = GetSubCommInfo(COMM_LEVEL0, COMM_INDEX_0);
      90            0 :     u32 commIndex = level0CommInfo.localRank;
      91            0 :     CHK_RET(CheckCommSize(COMM_LEVEL1, commIndex + 1));
      92            0 :     SubCommInfo level1CommInfo = GetSubCommInfo(COMM_LEVEL1, commIndex);
      93              : 
      94              :     // DMA消减场景,打包opInfo
      95            0 :     HcomCollOpInfo opInfo = {
      96            0 :         "", execMem.inputPtr, execMem.outputPtr, param.DataDes.count, param.DataDes.dataType, 0, HCCL_REDUCE_RESERVED
      97            0 :     };
      98              : 
      99            0 :     std::unique_ptr<AlgTemplateBase> tempAlg = AlgTemplateRegistry::Instance().GetAlgTemplate(
     100            0 :                 TemplateType::TEMPLATE_ALL_GATHER_PIPELINE, dispatcher_);
     101            0 :     CHK_SMART_PTR_NULL(tempAlg);
     102            0 :     CHK_RET(tempAlg->Prepare(&opInfo, topoAttr_.userRank, execMem.count, execMem.inputMem, execMem.outputMem,
     103              :         level0CommInfo, level1CommInfo, const_cast<Stream&>(param.stream),
     104              :         algResResp_->slaveStreams, algResResp_->notifiesMain, algResResp_->notifiesAux));
     105            0 :     CHK_RET(tempAlg->RunAsync());
     106            0 :     return HCCL_SUCCESS;
     107            0 : }
     108              : 
     109            0 : HcclResult CollAllGatherMeshOpbasePipelineExecutor::Getlevel1CommRank(SubCommInfo& level1CommInfo)
     110              : {
     111            0 :     CHK_RET(CheckCommSize(COMM_LEVEL0, COMM_INDEX_0 + 1));
     112            0 :     SubCommInfo level0CommInfo = GetSubCommInfo(COMM_LEVEL0, COMM_INDEX_0);
     113            0 :     u32 ringNum = (topoType_ == TopoType::TOPO_TYPE_8P_RING) ? LEVEL0_PLANE_NUM_IN_8PRING :
     114              :         LEVEL0_PLANE_NUM_IN_NPRING_SINGLE;
     115            0 :     u32 commIndex = (ringNum == LEVEL0_PLANE_NUM_IN_8PRING) ? topoAttr_.devicePhyId : level0CommInfo.localRank;
     116              : 
     117            0 :     CHK_RET(CheckCommSize(COMM_LEVEL1, commIndex + 1));
     118              : 
     119            0 :     level1CommInfo = GetSubCommInfo(COMM_LEVEL1, commIndex);
     120            0 :     HCCL_DEBUG("[CollAllGatherMeshOpbasePipelineExecutor]Getlevel1CommRank for level1CommInfo");
     121            0 :     return HCCL_SUCCESS;
     122            0 : }
     123              : 
     124            0 : HcclResult CollAllGatherMeshOpbasePipelineExecutor::SelectTempAlg(std::unique_ptr<AlgTemplateBase> &level1TempAlg, u32 level1RankSize)
     125              : {
     126            0 :     if (level1RankSize > 1) {
     127            0 :         level1TempAlg = AlgTemplateRegistry::Instance().GetAlgTemplate(
     128            0 :                 TemplateType::TEMPLATE_ALL_GATHER_PIPELINE, dispatcher_);
     129            0 :         CHK_SMART_PTR_NULL(level1TempAlg);
     130            0 :         return HCCL_SUCCESS;
     131              :     }
     132            0 :     return HCCL_E_UNAVAIL;
     133              : }
     134              : REGISTER_EXEC("AllGatherMeshOpbasePipelineExecutor", AllGatherOpbasePipeline, CollAllGatherMeshOpbasePipelineExecutor);
     135              : 
     136              : } // namespace hccl
        

Generated by: LCOV version 2.0-1