LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor/coll_all_gather/310P - coll_all_gather_for_310p_executor.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 59.5 % 37 22
Test Date: 2026-08-18 17:47:01 Functions: 80.0 % 5 4

            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_for_310p_executor.h"
      12              : 
      13              : namespace hccl {
      14            4 : CollAllGatherFor310PExecutor::CollAllGatherFor310PExecutor(
      15            4 :     const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher)
      16            4 :     : CollAllGatherExecutor(dispatcher, topoMatcher)
      17              : {
      18            4 :     DMAReduceFlag_ = false;
      19            4 : }
      20              : 
      21            4 : HcclResult CollAllGatherFor310PExecutor::CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport)
      22              : {
      23            4 :     TransportMemType inputType = TransportMemType::RESERVED;
      24            4 :     TransportMemType outputType = TransportMemType::RESERVED;
      25            4 :     CHK_RET(CalcTransportMemType(inputType, outputType));
      26            4 :     CHK_RET(CalcLevel0CommInfo(inputType, outputType, opTransport));
      27            4 :     return HCCL_SUCCESS;
      28              : }
      29              : 
      30            4 : HcclResult CollAllGatherFor310PExecutor::CalcTransportMemType(TransportMemType& inputType, TransportMemType& outputType)
      31              : {
      32            4 :     if (workflowMode_ == HcclWorkflowMode::HCCL_WORKFLOW_MODE_OP_BASE) {
      33            4 :         inputType = TransportMemType::CCL_INPUT;
      34            4 :         outputType = TransportMemType::CCL_OUTPUT;
      35              :     } else {
      36            0 :         inputType = TransportMemType::PARAM_INPUT;
      37            0 :         outputType = TransportMemType::PARAM_OUTPUT;
      38              :     }
      39            4 :     HCCL_INFO(
      40              :         "[CollAllGatherFor310PExecutor][CalcTransportMemType]"
      41              :         "tag[%s] inputType[%d], outputType[%d]",
      42              :         tag_.c_str(), inputType, outputType);
      43            4 :     return HCCL_SUCCESS;
      44              : }
      45              : 
      46            4 : HcclResult CollAllGatherFor310PExecutor::CalcLevel0CommInfo(
      47              :     TransportMemType inputType, TransportMemType outputType, std::vector<LevelNSubCommTransport>& opTransport)
      48              : {
      49            4 :     CommParaInfo commParaInfo(COMM_LEVEL0, CommType::COMM_TAG_RING_INNER);
      50            4 :     CHK_RET(CalcCommPlaneInfo(tag_, commParaInfo, opTransport[COMM_LEVEL0], inputType, outputType));
      51            4 :     return HCCL_SUCCESS;
      52            4 : }
      53              : 
      54            0 : HcclResult CollAllGatherFor310PExecutor::KernelRun(const OpParam& param, ExecMem& execMem)
      55              : {
      56            0 :     HCCL_CONFIG_INFO(HCCL_ALG, "[CollAllGatherFor310PExecutor] AllGather starts.");
      57            0 :     CHK_RET(CheckCommSize(COMM_LEVEL0, COMM_INDEX_0 + 1));
      58            0 :     SubCommInfo level0CommInfo = GetSubCommInfo(COMM_LEVEL0, COMM_INDEX_0);
      59              : 
      60              :     std::unique_ptr<AlgTemplateBase> tempAlg
      61            0 :         = AlgTemplateRegistry::Instance().GetAlgTemplate(TemplateType::TEMPLATE_ALL_GATHER_RING, dispatcher_);
      62            0 :     CHK_SMART_PTR_NULL(tempAlg);
      63              : 
      64            0 :     CHK_RET(tempAlg->Prepare(
      65              :         execMem.inputMem, execMem.outputMem, execMem.outputMem, execMem.count, param.DataDes.dataType, param.stream,
      66              :         param.reduceType));
      67              : 
      68            0 :     u32 rankSize = level0CommInfo.localRankSize;
      69            0 :     CHK_RET(tempAlg->RegisterProfiler(
      70              :         (rankSize << PROF_RANKSIZE_OFFSET_OF_PLANEID) + level0CommInfo.localRank, PROF_STAGE_0, HCCL_EXEC_STEP_NOT_SET,
      71              :         param.stream));
      72              : 
      73            0 :     CHK_RET(RunTemplate(tempAlg, level0CommInfo));
      74            0 :     HCCL_INFO("[CollAllGatherFor310PExecutor]AllGather for 310P run success");
      75              : 
      76            0 :     return HCCL_SUCCESS;
      77            0 : }
      78              : 
      79              : REGISTER_EXEC("AllGatherFor310PExecutor", AllGatherFor310P, CollAllGatherFor310PExecutor);
      80              : 
      81              : } // namespace hccl
        

Generated by: LCOV version 2.0-1