LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor/coll_all_gather - coll_all_gather_hccs_sio_executor.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 63 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_gather_hccs_sio_executor.h"
      12              : 
      13              : namespace hccl {
      14            0 : CollAllGatherHccsSioExecutor::CollAllGatherHccsSioExecutor(
      15            0 :     const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher)
      16            0 :     : CollAllGatherExecutor(dispatcher, topoMatcher)
      17              : {
      18            0 :     desc_.isZeroCopy = false;
      19            0 :     DMAReduceFlag_ = true;
      20            0 : }
      21              : 
      22            0 : HcclResult CollAllGatherHccsSioExecutor::CalcStreamNum(u32& streamNum)
      23              : {
      24            0 :     u32 totalStreamNum = topoAttr_.deviceNumPerAggregation + 1U;
      25              :     // 本地拷贝两条流并发,跨片两条流并发
      26              :     static u32 MULTIPLIER = 2;
      27            0 :     streamNum = MULTIPLIER * (totalStreamNum - 1);
      28            0 :     HCCL_INFO("[CollAllGatherHccsSioExecutor][CalcStreamNum] tag[%s] streamNum[%u]", tag_.c_str(), streamNum);
      29              : 
      30            0 :     return HCCL_SUCCESS;
      31              : }
      32              : 
      33            0 : u64 CollAllGatherHccsSioExecutor::CalcLoopMaxCount(const u64 cclBuffSize, const u32 unitSize)
      34              : {
      35              :     // 中转内存单次最多能够接受的output count
      36            0 :     u64 maxCountPerLoop = cclBuffSize / HCCL_MIN_SLICE_ALIGN * HCCL_MIN_SLICE_ALIGN / unitSize;
      37            0 :     HCCL_INFO(
      38              :         "[CollAllGatherHccsSioExecutor][CalcLoopMaxCount]"
      39              :         "using default maxCountPerLoop[%llu] as CCLBuffSize / unitSize.",
      40              :         maxCountPerLoop);
      41            0 :     return maxCountPerLoop;
      42              : }
      43              : 
      44            0 : HcclResult CollAllGatherHccsSioExecutor::CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport)
      45              : {
      46            0 :     TransportMemType inputType = TransportMemType::RESERVED;
      47            0 :     TransportMemType outputType = TransportMemType::RESERVED;
      48            0 :     CHK_RET(CalcTransportMemType(inputType, outputType));
      49            0 :     CHK_RET(CalcLevel0CommInfo(inputType, outputType, opTransport));
      50            0 :     return HCCL_SUCCESS;
      51              : }
      52              : 
      53            0 : HcclResult CollAllGatherHccsSioExecutor::CalcLevel0CommInfo(
      54              :     TransportMemType inputType, TransportMemType outputType, std::vector<LevelNSubCommTransport>& opTransport)
      55              : {
      56            0 :     CommParaInfo commParaLevel0(COMM_LEVEL0, CommType::COMM_TAG_HCCS_PLUS_SIO); // 新建通信平面
      57            0 :     CHK_RET(CalcCommPlaneInfo(tag_, commParaLevel0, opTransport[COMM_LEVEL0], inputType, outputType));
      58              : 
      59            0 :     LevelNSubCommTransport& commTransportLevel0 = opTransport[COMM_LEVEL0];
      60            0 :     for (u32 subCommIndex = 0; subCommIndex < commTransportLevel0.size(); subCommIndex++) {
      61            0 :         for (auto& transportRequest :
      62            0 :              commTransportLevel0[subCommIndex].transportRequests) { // 两个transport分别设置ishccs为false、true
      63              :             // 根据子通信索引设置isHccs的值
      64            0 :             transportRequest.linkType = (subCommIndex == 0) ? TransportLinkType::SIO : TransportLinkType::HCCS;
      65            0 :             HCCL_INFO(
      66              :                 "[CollAllGatherHccsSioExecutor][CalcLevel0CommInfo] set extral notifyNum[%u]",
      67              :                 transportRequest.notifyNum);
      68              :         }
      69              :     }
      70            0 :     return HCCL_SUCCESS;
      71            0 : }
      72              : 
      73            0 : HcclResult CollAllGatherHccsSioExecutor::CalcTransportMemType(TransportMemType& inputType, TransportMemType& outputType)
      74              : {
      75            0 :     if (workflowMode_ == HcclWorkflowMode::HCCL_WORKFLOW_MODE_OP_BASE) {
      76            0 :         inputType = TransportMemType::CCL_INPUT;
      77            0 :         outputType = TransportMemType::CCL_OUTPUT;
      78              :     } else {
      79            0 :         inputType = TransportMemType::PARAM_INPUT;
      80            0 :         outputType = TransportMemType::PARAM_OUTPUT;
      81              :     }
      82              : 
      83            0 :     HCCL_INFO(
      84              :         "[CollAllGatherHccsSioExecutor][CalcTransportMemType]"
      85              :         "tag[%s] inputType[%d], outputType[%d]",
      86              :         tag_.c_str(), inputType, outputType);
      87            0 :     return HCCL_SUCCESS;
      88              : }
      89              : 
      90            0 : HcclResult CollAllGatherHccsSioExecutor::KernelRun(const OpParam& param, ExecMem& execMem)
      91              : {
      92            0 :     HCCL_CONFIG_INFO(HCCL_ALG, "[%s] The AllGatherHccsSioExecutor starts.", __func__);
      93            0 :     HcomCollOpInfo opInfo = {"",
      94            0 :                              execMem.inputPtr,
      95            0 :                              execMem.outputPtr,
      96            0 :                              param.DataDes.count,
      97            0 :                              param.DataDes.dataType,
      98            0 :                              param.root,
      99            0 :                              param.reduceType,
     100            0 :                              0};
     101              : 
     102              :     // step 1 先获取 comm inner \ comm outer 的value
     103            0 :     CHK_RET(CheckCommSize(COMM_LEVEL0, COMM_INDEX_0 + 1));
     104            0 :     SubCommInfo outerCommInfoHccs = GetSubCommInfo(COMM_LEVEL0, COMM_INDEX_0);
     105            0 :     CHK_RET(CheckCommSize(COMM_LEVEL0, COMM_INDEX_1 + 1));
     106            0 :     SubCommInfo outerCommInfoSio = GetSubCommInfo(COMM_LEVEL0, COMM_INDEX_1);
     107              : 
     108              :     // 执行
     109              :     std::unique_ptr<AlgTemplateBase> tempAlg
     110            0 :         = AlgTemplateRegistry::Instance().GetAlgTemplate(TemplateType::TEMPLATE_ALL_GATHER_HCCS_SIO, dispatcher_);
     111            0 :     HCCL_CONFIG_INFO(HCCL_ALG, "[%s] Run TEMPLATE_ALL_GATHER_HCCS_SIO in COMM_LEVEL0", __func__);
     112            0 :     CHK_SMART_PTR_NULL(tempAlg);
     113              : 
     114            0 :     CHK_RET(tempAlg->Prepare(
     115              :         outerCommInfoHccs, outerCommInfoSio, execMem.inputMem, execMem.outputMem, execMem.count, param.DataDes.dataType,
     116              :         param.stream, algResResp_->slaveStreams, algResResp_->notifiesMain, algResResp_->notifiesAux,
     117              :         topoAttr_.userRank, &opInfo));
     118              : 
     119            0 :     CHK_RET(tempAlg->RegisterProfiler(
     120              :         (outerCommInfoHccs.localRankSize << PROF_RANKSIZE_OFFSET_OF_PLANEID) + outerCommInfoHccs.localRank,
     121              :         PROF_STAGE_1, HCCL_EXEC_STEP_NOT_SET, param.stream));
     122              : 
     123            0 :     CHK_RET(RunTemplate(tempAlg, outerCommInfoHccs));
     124              : 
     125            0 :     HCCL_INFO("[CollAllGatherHccsSioExecutor][KernelRun] AllGatherHccsSioExecutor ends.");
     126              : 
     127            0 :     return HCCL_SUCCESS;
     128            0 : }
     129              : 
     130              : REGISTER_EXEC("AllGatherHccsSioExecutor", AllGatherHccsSio, CollAllGatherHccsSioExecutor);
     131              : 
     132              : } // namespace hccl
        

Generated by: LCOV version 2.0-1