LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor/coll_all_gather - coll_all_gather_mesh_graph_pipeline_executor.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 48 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 "coll_all_gather_mesh_graph_pipeline_executor.h"
      12              : 
      13              : namespace hccl {
      14            0 : CollAllGatherMeshGraphPipelineExecutor::CollAllGatherMeshGraphPipelineExecutor(
      15            0 :     const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher> &topoMatcher)
      16            0 :     : CollAllGatherExecutor(dispatcher, topoMatcher)
      17            0 : {}
      18              : 
      19            0 : HcclResult CollAllGatherMeshGraphPipelineExecutor::CalcStreamNum(u32 &streamNum)
      20              : {
      21            0 :     u32 totalStreamNum = topoAttr_.deviceNumPerAggregation + 1U;
      22            0 :     streamNum = totalStreamNum - 1U;
      23            0 :     HCCL_INFO("[CollAllGatherMeshGraphPipelineExecutor][CalcStreamNum] tag[%s] streamNum[%u]", tag_.c_str(), streamNum);
      24            0 :     return HCCL_SUCCESS;
      25              : }
      26              : 
      27            0 : HcclResult CollAllGatherMeshGraphPipelineExecutor::CalcCommInfo(std::vector<LevelNSubCommTransport> &opTransport)
      28              : {
      29            0 :     TransportMemType inputType = TransportMemType::RESERVED;
      30            0 :     TransportMemType outputType = TransportMemType::RESERVED;
      31            0 :     CHK_RET(CalcTransportMemType(inputType, outputType));
      32            0 :     CHK_RET(CalcLevel0CommInfo(inputType, outputType, opTransport));
      33            0 :     CHK_RET(CalcLevel1CommInfo(inputType, outputType, opTransport));
      34            0 :     return HCCL_SUCCESS;
      35              : }
      36              : 
      37            0 : HcclResult CollAllGatherMeshGraphPipelineExecutor::CalcTransportMemType(
      38              :     TransportMemType &inputType, TransportMemType &outputType)
      39              : {
      40            0 :     inputType = TransportMemType::PARAM_INPUT;
      41            0 :     outputType = TransportMemType::PARAM_OUTPUT;
      42            0 :     HCCL_INFO("[CollAllGatherMeshGraphPipelineExecutor][CalcTransportMemType]"
      43              :               "tag[%s] inputType[%d], outputType[%d]",
      44              :         tag_.c_str(),
      45              :         inputType,
      46              :         outputType);
      47            0 :     return HCCL_SUCCESS;
      48              : }
      49              : 
      50            0 : HcclResult CollAllGatherMeshGraphPipelineExecutor::CalcLevel0CommInfo(
      51              :     TransportMemType inputType, TransportMemType outputType, std::vector<LevelNSubCommTransport> &opTransport)
      52              : {
      53            0 :     CommParaInfo commParaInfo(COMM_LEVEL0, CommType::COMM_TAG_MESH);
      54            0 :     commParaInfo.meshSinglePlane = true;
      55            0 :     CHK_RET(CalcCommPlaneInfo(tag_, commParaInfo, opTransport[COMM_LEVEL0], inputType, outputType));
      56            0 :     return HCCL_SUCCESS;
      57            0 : }
      58              : 
      59              : // PipeLine模式下使用Ring算法
      60            0 : HcclResult CollAllGatherMeshGraphPipelineExecutor::CalcLevel1CommInfo(
      61              :     TransportMemType inputType, TransportMemType outputType, std::vector<LevelNSubCommTransport> &opTransport)
      62              : {
      63            0 :     CommParaInfo commParaInfo(COMM_LEVEL1, CommType::COMM_TAG_RING_INNER);
      64            0 :     CHK_RET(CalcCommPlaneInfo(tag_, commParaInfo, opTransport[COMM_LEVEL1], inputType, outputType));
      65            0 :     return HCCL_SUCCESS;
      66            0 : }
      67              : 
      68            0 : HcclResult CollAllGatherMeshGraphPipelineExecutor::KernelRun(const OpParam &param, ExecMem &execMem)
      69              : {
      70            0 :     HCCL_CONFIG_INFO(HCCL_ALG,
      71              :         "[CollAllGatherMeshGraphPipelineExecutor][KernelRun]AllGatherMeshGraphPipelineExecutor begins.");
      72              : 
      73              :     // 先获取 comm level0 和 comm level1 的value
      74            0 :     CHK_RET(CheckCommSize(COMM_LEVEL0, COMM_INDEX_0 + 1));
      75            0 :     SubCommInfo level0CommInfo = GetSubCommInfo(COMM_LEVEL0, COMM_INDEX_0);
      76            0 :     u32 commIndex = level0CommInfo.localRank;
      77            0 :     CHK_RET(CheckCommSize(COMM_LEVEL1, commIndex + 1));
      78            0 :     SubCommInfo level1CommInfo = GetSubCommInfo(COMM_LEVEL1, commIndex);
      79              : 
      80              :     // 激活从流
      81            0 :     CHK_RET(ActiveSlaveStreams(param.stream));
      82              : 
      83            0 :     HcomCollOpInfo opInfo = {
      84            0 :         "", execMem.inputPtr, execMem.outputPtr, param.DataDes.count, param.DataDes.dataType, 0, HCCL_REDUCE_RESERVED};
      85              : 
      86              :     std::unique_ptr<AlgTemplateBase> tempAlg =
      87            0 :         AlgTemplateRegistry::Instance().GetAlgTemplate(TemplateType::TEMPLATE_ALL_GATHER_GRAPH_PIPELINE, dispatcher_);
      88            0 :     CHK_SMART_PTR_NULL(tempAlg);
      89            0 :     CHK_RET(tempAlg->Prepare(&opInfo,
      90              :         topoAttr_.userRank,
      91              :         execMem.count,
      92              :         execMem.inputMem,
      93              :         execMem.outputMem,
      94              :         level0CommInfo,
      95              :         level1CommInfo,
      96              :         const_cast<Stream &>(param.stream),
      97              :         algResResp_->slaveStreams,
      98              :         algResResp_->notifiesMain,
      99              :         algResResp_->notifiesAux));
     100            0 :     CHK_RET(tempAlg->RunAsync());
     101            0 :     return HCCL_SUCCESS;
     102            0 : }
     103              : 
     104              : REGISTER_EXEC("AllGatherMeshGraphPipelineExecutor", AllGatherGraphPipeline, CollAllGatherMeshGraphPipelineExecutor);
     105              : 
     106              : }  // namespace hccl
        

Generated by: LCOV version 2.0-1