LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor/coll_all_reduce/310P - coll_all_reduce_for_310p_ring_executor.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 52 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 5 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_for_310p_ring_executor.h"
      12              : 
      13              : namespace hccl {
      14            0 : CollAllReduceFor310PRingExecutor::CollAllReduceFor310PRingExecutor(
      15            0 :     const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher)
      16            0 :     : CollAllReduceExecutor(dispatcher, topoMatcher)
      17              : {
      18            0 :     DMAReduceFlag_ = false;
      19            0 : }
      20              : 
      21            0 : HcclResult CollAllReduceFor310PRingExecutor::KernelRun(const OpParam& param, ExecMem& execMem)
      22              : {
      23            0 :     bool isInlineReduce = IsSupportSDMAReduce(
      24            0 :         execMem.inputMem.ptr(), execMem.outputMem.ptr(), param.DataDes.dataType, param.reduceType);
      25            0 :     HCCL_CONFIG_INFO(
      26              :         HCCL_ALG, "[CollAllReduceFor310PRingExecutor][KernelRun] userRank[%u] starts with isInlineReduce[%d]",
      27              :         topoAttr_.userRank, isInlineReduce);
      28            0 :     u64 reduceAttr = 0;
      29            0 :     if (isInlineReduce) {
      30            0 :         SalSetBitOne(reduceAttr, ATTR_POS_INLINE_REDUCE);
      31              :     }
      32              : 
      33            0 :     CHK_RET(CheckCommSize(COMM_LEVEL0, COMM_INDEX_0 + 1));
      34            0 :     SubCommInfo level0CommInfo = GetSubCommInfo(COMM_LEVEL0, COMM_INDEX_0);
      35              : 
      36            0 :     std::unique_ptr<AlgTemplateBase> tempAlg;
      37            0 :     tempAlg = AlgTemplateRegistry::Instance().GetAlgTemplate(TemplateType::TEMPLATE_ALL_REDUCE_RING, dispatcher_);
      38            0 :     CHK_SMART_PTR_NULL(tempAlg);
      39            0 :     CHK_RET(tempAlg->Prepare(reduceAttr));
      40              : 
      41            0 :     CHK_RET(tempAlg->Prepare(
      42              :         execMem.inputMem, execMem.outputMem, execMem.outputMem, execMem.count, param.DataDes.dataType, param.stream,
      43              :         param.reduceType, LEVEL0_BRIDGE_RANK_ID, std::vector<Slice>(0), 0));
      44              : 
      45            0 :     CHK_RET(tempAlg->RegisterProfiler(
      46              :         (level0CommInfo.localRankSize << PROF_RANKSIZE_OFFSET_OF_PLANEID) + level0CommInfo.localRank, PROF_STAGE_0,
      47              :         HCCL_EXEC_STEP_NOT_SET, param.stream));
      48              : 
      49            0 :     CHK_RET(RunTemplate(tempAlg, level0CommInfo));
      50            0 :     return HCCL_SUCCESS;
      51            0 : }
      52              : 
      53            0 : HcclResult CollAllReduceFor310PRingExecutor::CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport)
      54              : {
      55            0 :     TransportMemType inputType = TransportMemType::RESERVED;
      56            0 :     TransportMemType outputType = TransportMemType::RESERVED;
      57            0 :     CHK_RET(CalcTransportMemType(inputType, outputType));
      58            0 :     CHK_RET(CalcLevel0CommInfo(inputType, outputType, opTransport));
      59            0 :     return HCCL_SUCCESS;
      60              : }
      61              : 
      62            0 : HcclResult CollAllReduceFor310PRingExecutor::CalcLevel0CommInfo(
      63              :     TransportMemType inputType, TransportMemType outputType, std::vector<LevelNSubCommTransport>& opTransport)
      64              : {
      65            0 :     HCCL_INFO("[CollAllReduceFor310PRingExecutor][CalcLevel0CommInfo]tag[%s] start", tag_.c_str());
      66              : 
      67            0 :     if (algType_.algoLevel0 == AlgTypeLevel0::ALG_LEVEL0_NP_HD) {
      68            0 :         CommParaInfo commParaInfo(COMM_LEVEL0, CommType::COMM_TAG_HALVING_DOUBLING);
      69            0 :         CHK_RET(CalcCommPlaneInfo(tag_, commParaInfo, opTransport[COMM_LEVEL0], inputType, outputType));
      70            0 :     } else if (
      71            0 :         algType_.algoLevel0 == AlgTypeLevel0::ALG_LEVEL0_WHOLE_RING
      72            0 :         && algType_.algoLevel1 == AlgTypeLevel1::ALG_LEVEL1_WHOLE_RING) {
      73            0 :         CommParaInfo commParaInfo(COMM_LEVEL0, CommType::COMM_TAG_RING_INNER);
      74            0 :         CHK_RET(CalcCommPlaneInfo(tag_, commParaInfo, opTransport[COMM_LEVEL0], inputType, outputType));
      75            0 :     } else {
      76            0 :         HCCL_ERROR("unsupported algType %d plus %d", algType_.algoLevel0, algType_.algoLevel1);
      77            0 :         return HCCL_E_INTERNAL;
      78              :     }
      79              : 
      80            0 :     HCCL_INFO("[CollAllReduceFor310PRingExecutor][CalcLevel0CommInfo]tag[%s] Calc RingComm finish", tag_.c_str());
      81            0 :     return HCCL_SUCCESS;
      82              : }
      83              : 
      84              : HcclResult
      85            0 : CollAllReduceFor310PRingExecutor::CalcTransportMemType(TransportMemType& inputType, TransportMemType& outputType)
      86              : {
      87            0 :     if (workflowMode_ == HcclWorkflowMode::HCCL_WORKFLOW_MODE_OP_BASE) {
      88            0 :         inputType = TransportMemType::CCL_INPUT;
      89            0 :         outputType = TransportMemType::CCL_OUTPUT;
      90              :     } else {
      91            0 :         inputType = TransportMemType::PARAM_INPUT;
      92            0 :         outputType = TransportMemType::PARAM_OUTPUT;
      93              :     }
      94            0 :     HCCL_INFO(
      95              :         "[CollAllReduceFor310PRingExecutor][CalcTransportMemType] tag[%s] inputType[%d], outputType[%d]", tag_.c_str(),
      96              :         inputType, outputType);
      97            0 :     return HCCL_SUCCESS;
      98              : }
      99              : 
     100              : REGISTER_EXEC("AllReduceRing", AllReduceFor310PRing, CollAllReduceFor310PRingExecutor);
     101              : } // namespace hccl
        

Generated by: LCOV version 2.0-1