LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor/coll_reduce_scatter/310P - coll_reduce_scatter_slim_ring_for_310p_executor.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 47 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_reduce_scatter_slim_ring_for_310p_executor.h"
      12              : 
      13              : namespace hccl {
      14            0 : CollReduceScatterSlimRingFor310PExecutor::CollReduceScatterSlimRingFor310PExecutor(
      15            0 :     const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher)
      16            0 :     : CollReduceScatterExecutor(dispatcher, topoMatcher)
      17              : {
      18            0 :     DMAReduceFlag_ = false;
      19            0 : }
      20              : 
      21            0 : HcclResult CollReduceScatterSlimRingFor310PExecutor::CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport)
      22              : {
      23            0 :     TransportMemType inputType = TransportMemType::RESERVED;
      24            0 :     TransportMemType outputType = TransportMemType::RESERVED;
      25            0 :     CHK_RET(CalcTransportMemType(inputType, outputType));
      26            0 :     CHK_RET(CalcLevel0CommInfo(inputType, outputType, opTransport));
      27            0 :     return HCCL_SUCCESS;
      28              : }
      29              : 
      30            0 : HcclResult CollReduceScatterSlimRingFor310PExecutor::CalcTransportMemType(
      31              :     TransportMemType& inputType, TransportMemType& outputType)
      32              : {
      33            0 :     if (workflowMode_ == HcclWorkflowMode::HCCL_WORKFLOW_MODE_OP_BASE) {
      34            0 :         inputType = TransportMemType::CCL_INPUT;
      35            0 :         outputType = TransportMemType::CCL_OUTPUT;
      36              :     } else {
      37            0 :         inputType = TransportMemType::PARAM_INPUT;
      38            0 :         outputType = TransportMemType::PARAM_OUTPUT;
      39              :     }
      40            0 :     HCCL_INFO(
      41              :         "[CollReduceScatterSlimRingFor310PExecutor][CalcTransportMemType] tag[%s] inputType[%d], outputType[%d]",
      42              :         tag_.c_str(), inputType, outputType);
      43            0 :     return HCCL_SUCCESS;
      44              : }
      45              : 
      46            0 : HcclResult CollReduceScatterSlimRingFor310PExecutor::CalcLevel0CommInfo(
      47              :     TransportMemType inputType, TransportMemType outputType, std::vector<LevelNSubCommTransport>& opTransport)
      48              : {
      49            0 :     HCCL_INFO("[CollReduceScatterSlimRingFor310PExecutor][CalcLevel0CommInfo]tag[%s] start", tag_.c_str());
      50            0 :     CommParaInfo commParaInfo(COMM_LEVEL0, CommType::COMM_TAG_RING_INNER);
      51            0 :     CHK_RET(CalcCommPlaneInfo(tag_, commParaInfo, opTransport[COMM_LEVEL0], inputType, outputType));
      52              : 
      53            0 :     LevelNSubCommTransport& commTransportLevel0 = opTransport[COMM_LEVEL0];
      54            0 :     for (u32 subCommIndex = 0; subCommIndex < commTransportLevel0.size(); subCommIndex++) {
      55            0 :         for (auto& transportRequest : commTransportLevel0[subCommIndex].transportRequests) {
      56            0 :             transportRequest.notifyNum = HCCL_NIC_MAX_NUM; // 卡间notify num数量
      57              :         }
      58              :     }
      59              : 
      60            0 :     HCCL_INFO(
      61              :         "[CollReduceScatterSlimRingFor310PExecutor][CalcLevel0CommInfo]tag[%s] Calc RingComm finish", tag_.c_str());
      62            0 :     return HCCL_SUCCESS;
      63            0 : }
      64              : 
      65            0 : HcclResult CollReduceScatterSlimRingFor310PExecutor::KernelRun(const OpParam& param, ExecMem& execMem)
      66              : {
      67            0 :     HCCL_CONFIG_INFO(HCCL_ALG, "[CollReduceScatterSlimRingFor310PExecutor][KernelRun] 310p ReduceScatter start");
      68            0 :     CHK_RET(CheckCommSize(COMM_LEVEL0, COMM_INDEX_0 + 1));
      69            0 :     SubCommInfo level0CommInfo = GetSubCommInfo(COMM_LEVEL0, COMM_INDEX_0);
      70              : 
      71            0 :     bool isInlineReduce = IsSupportSDMAReduce(
      72            0 :         execMem.inputMem.ptr(), execMem.outputMem.ptr(), param.DataDes.dataType, param.reduceType);
      73            0 :     u64 reduceAttr = 0;
      74            0 :     if (isInlineReduce) {
      75            0 :         SalSetBitOne(reduceAttr, ATTR_POS_INLINE_REDUCE);
      76              :     }
      77              : 
      78              :     std::unique_ptr<AlgTemplateBase> tempAlg
      79            0 :         = AlgTemplateRegistry::Instance().GetAlgTemplate(TemplateType::TEMPLATE_REDUCESCATTER_SLIM_RING, dispatcher_);
      80            0 :     CHK_SMART_PTR_NULL(tempAlg);
      81            0 :     CHK_RET(tempAlg->Prepare(reduceAttr));
      82              : 
      83            0 :     CHK_RET(tempAlg->Prepare(
      84              :         execMem.inputMem, execMem.outputMem, execMem.outputMem, execMem.count, param.DataDes.dataType, param.stream,
      85              :         param.reduceType));
      86              : 
      87            0 :     CHK_RET(tempAlg->RegisterProfiler(
      88              :         (level0CommInfo.localRankSize << PROF_RANKSIZE_OFFSET_OF_PLANEID) + level0CommInfo.localRank, PROF_STAGE_0,
      89              :         HCCL_EXEC_STEP_NOT_SET, param.stream));
      90              : 
      91            0 :     CHK_RET(RunTemplate(tempAlg, level0CommInfo));
      92            0 :     return HCCL_SUCCESS;
      93            0 : }
      94              : 
      95              : REGISTER_EXEC("ReduceScatterSlimRing", ReduceScatterSlimRingFor310P, CollReduceScatterSlimRingFor310PExecutor);
      96              : } // namespace hccl
        

Generated by: LCOV version 2.0-1