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

Generated by: LCOV version 2.0-1