LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor/coll_all_reduce - coll_all_reduce_mesh_graph_pipeline_executor.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 51 0
Test Date: 2026-08-18 17:47:01 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_reduce_mesh_graph_pipeline_executor.h"
      12              : 
      13              : namespace hccl {
      14              : // 准入条件: pipeLine && 910B && 图模式 && sdmaReduce && rdmaReduce && 多Mesh && MeshTopo && 非确定性
      15            0 : CollAllReduceMeshGraphPipelineExecutor::CollAllReduceMeshGraphPipelineExecutor(
      16            0 :     const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher)
      17            0 :     : CollAllReduceExecutor(dispatcher, topoMatcher)
      18            0 : {}
      19              : 
      20            0 : HcclResult CollAllReduceMeshGraphPipelineExecutor::CalcStreamNum(u32& streamNum)
      21              : {
      22            0 :     u32 totalStreamNum = topoAttr_.deviceNumPerAggregation;
      23            0 :     streamNum = totalStreamNum - 1U;
      24            0 :     HCCL_INFO("[CollAllReduceMeshGraphPipelineExecutor][CalcStreamNum] tag[%s] streamNum[%u]", tag_.c_str(), streamNum);
      25            0 :     return HCCL_SUCCESS;
      26              : }
      27              : 
      28            0 : HcclResult CollAllReduceMeshGraphPipelineExecutor::CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport)
      29              : {
      30            0 :     TransportMemType inputType = TransportMemType::RESERVED;
      31            0 :     TransportMemType outputType = TransportMemType::RESERVED;
      32            0 :     CHK_RET(CalcTransportMemType(inputType, outputType));
      33            0 :     CHK_RET(CalcLevel0CommInfo(inputType, outputType, opTransport));
      34            0 :     CHK_RET(CalcLevel1CommInfo(inputType, outputType, opTransport));
      35            0 :     return HCCL_SUCCESS;
      36              : }
      37              : 
      38              : HcclResult
      39            0 : CollAllReduceMeshGraphPipelineExecutor::CalcTransportMemType(TransportMemType& inputType, TransportMemType& outputType)
      40              : {
      41            0 :     inputType = TransportMemType::PARAM_INPUT;
      42            0 :     outputType = TransportMemType::PARAM_OUTPUT;
      43            0 :     HCCL_INFO(
      44              :         "[CollAllReduceMeshGraphPipelineExecutor][CalcTransportMemType]"
      45              :         "tag[%s] inputType[%d], outputType[%d]",
      46              :         tag_.c_str(), inputType, outputType);
      47            0 :     return HCCL_SUCCESS;
      48              : }
      49              : 
      50            0 : HcclResult CollAllReduceMeshGraphPipelineExecutor::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 CollAllReduceMeshGraphPipelineExecutor::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 CollAllReduceMeshGraphPipelineExecutor::KernelRun(const OpParam& param, ExecMem& execMem)
      69              : {
      70            0 :     HCCL_CONFIG_INFO(
      71              :         HCCL_ALG, "[CollAllReduceMeshGraphPipelineExecutor][Run]CollAllReduceMeshGraphPipelineExecutor begins.");
      72              : 
      73            0 :     CHK_RET(CheckCommSize(COMM_LEVEL0, COMM_INDEX_0 + 1));
      74            0 :     SubCommInfo level0CommInfo = GetSubCommInfo(COMM_LEVEL0, COMM_INDEX_0);
      75            0 :     u32 commIndex = level0CommInfo.localRank;
      76            0 :     CHK_RET(CheckCommSize(COMM_LEVEL1, commIndex + 1));
      77            0 :     SubCommInfo level1CommInfo = GetSubCommInfo(COMM_LEVEL1, commIndex);
      78              : 
      79            0 :     CHK_RET(ActiveSlaveStreams(param.stream));
      80              : 
      81            0 :     u64 reduceAttr = GetReduceAttr(execMem.inputMem, execMem.inputMem, param.DataDes.dataType, param.reduceType);
      82              : 
      83            0 :     HcomCollOpInfo opInfo
      84            0 :         = {"", execMem.inputPtr, execMem.outputPtr, execMem.count, param.DataDes.dataType, param.root, param.reduceType,
      85            0 :            0};
      86              : 
      87              :     std::unique_ptr<AlgTemplateBase> tempAlg
      88            0 :         = AlgTemplateRegistry::Instance().GetAlgTemplate(TemplateType::TEMPLATE_ALLREDUCE_GRAPH_PIPELINE, dispatcher_);
      89            0 :     CHK_SMART_PTR_NULL(tempAlg);
      90            0 :     CHK_RET(tempAlg->Prepare(reduceAttr));
      91            0 :     CHK_RET(tempAlg->Prepare(
      92              :         &opInfo, execMem.inputMem, execMem.outputMem, execMem.count, level1CommInfo, level0CommInfo,
      93              :         const_cast<Stream&>(param.stream), algResResp_->slaveStreams, algResResp_->notifiesMain,
      94              :         algResResp_->notifiesAux));
      95            0 :     CHK_RET(tempAlg->RunAsync());
      96            0 :     return HCCL_SUCCESS;
      97            0 : }
      98              : 
      99              : REGISTER_EXEC("AllReduceMeshGraphPipelineExecutor", AllReduceMeshGraphPipeline, CollAllReduceMeshGraphPipelineExecutor);
     100              : 
     101              : } // namespace hccl
        

Generated by: LCOV version 2.0-1