LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor - coll_executor_base.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 59.8 % 82 49
Test Date: 2026-08-04 10:52:23 Functions: 56.5 % 23 13

            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_executor_base.h"
      12              : #include "hccl_aiv.h"
      13              : 
      14              : namespace hccl {
      15              : 
      16          181 : CollExecutorBase::CollExecutorBase(const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher> &topoMatcher)
      17          181 :     : dispatcher_(dispatcher), topoMatcher_(topoMatcher)
      18              : {
      19          168 : }
      20              : 
      21           97 : HcclResult CollExecutorBase::SetAlgType(const AlgType algType)
      22              : {
      23           97 :     const std::vector<AlgTypeLevel0> &l0Algo = desc_.level0SupportedAlgos;
      24           97 :     const std::vector<AlgTypeLevel1> &l1Algo = desc_.level1SupportedAlgos;
      25           97 :     const std::vector<AlgTypeLevel2> &l2Algo = desc_.level2SupportedAlgos;
      26              : 
      27           97 :     algType_ = algType;
      28           97 :     if (!l0Algo.empty()
      29           94 :         && std::find(l0Algo.begin(), l0Algo.end(), algType_.algoLevel0) == l0Algo.end()) {
      30            0 :         HCCL_WARNING("[%s] not support level0 algo[%d], reset to algo[%d]", __func__,
      31              :             algType_.algoLevel0, l0Algo[0]);
      32            0 :         algType_.algoLevel0 = l0Algo[0];
      33              :     }
      34           94 :     if (!l1Algo.empty()
      35           95 :         && std::find(l1Algo.begin(), l1Algo.end(), algType_.algoLevel1) == l1Algo.end()) {
      36            0 :         HCCL_WARNING("[%s] not support level1 algo[%d], reset to algo[%d]", __func__,
      37              :             algType_.algoLevel1, l1Algo[0]);
      38            0 :         algType_.algoLevel1 = l1Algo[0];
      39              :     }
      40           95 :     if (!l2Algo.empty()
      41           93 :         && std::find(l2Algo.begin(), l2Algo.end(), algType_.algoLevel2) == l2Algo.end()) {
      42            1 :         HCCL_WARNING("[%s] not support level2 algo[%d], reset to algo[%d]", __func__,
      43              :             algType_.algoLevel2, l2Algo[0]);
      44            1 :         algType_.algoLevel2 = l2Algo[0];
      45              :     }
      46              :     // 记录刷新后的算法类型到executor的描述中
      47           93 :     desc_.algType = algType_;
      48           93 :     return HCCL_SUCCESS;
      49              : }
      50              : 
      51           75 : HcclResult CollExecutorBase::SetCCLInBuffer(u64 cclbufferSize)
      52              : {
      53           75 :     inCCLbufferSize_ = cclbufferSize;
      54           75 :     return HCCL_SUCCESS;
      55              : }
      56              : 
      57           35 : HcclResult CollExecutorBase::SetIsSupportSDMAReduce(bool isSupportSDMAReduce)
      58              : {
      59           35 :     isSupportSDMAReduce_ = isSupportSDMAReduce;
      60           35 :     return HCCL_SUCCESS;
      61              : }
      62              : 
      63            0 : HcclResult CollExecutorBase::RunTemplate(const std::unique_ptr<AlgTemplateBase> &tempAlg, const SubCommInfo &commInfo)
      64              : {
      65            0 :     HcclResult ret = tempAlg->RunAsync(commInfo.localRank, commInfo.localRankSize, commInfo.links);
      66            0 :     CHK_PRT_RET(ret == HCCL_E_AGAIN, HCCL_WARNING("[CollExecutorBase][RunTemplate]" \
      67              :         "group has been destroyed. Break!"), ret);
      68            0 :     CHK_PRT_RET(ret != HCCL_SUCCESS,
      69              :         HCCL_ERROR("[CollExecutorBase][RunTemplate]run tempAlg rank[%u] rank size[%u] failed",
      70              :         commInfo.localRank, commInfo.localRankSize), ret);
      71            0 :     return HCCL_SUCCESS;
      72              : }
      73              : 
      74            1 : HcclResult CollExecutorBase::GetAivExecParam(const OpParam& param, AlgResourceResponse& algRes, AivSuperKernelArgs &args)
      75              : {
      76            1 :     return HCCL_SUCCESS;
      77              : }
      78              : 
      79           25 : HcclResult CollExecutorBase::PrepareCommInfoToDevice(AlgResourceResponse& algResource)
      80              : {
      81              :     (void) algResource;
      82           25 :     return HCCL_SUCCESS;
      83              : }
      84              : 
      85            0 : HcclResult CollExecutorBase::SetRmaInfo(void* rmaInfo)
      86              : {
      87            0 :     CHK_PTR_NULL(rmaInfo);
      88            0 :     rmaInfo_ = rmaInfo;
      89            0 :     return HCCL_SUCCESS;
      90              : }
      91              : 
      92            0 : HcclResult CollExecutorBase::CalcIncreLinkRequest(const OpParam& param, std::set<u32>& ranksLinked, 
      93              :     AlgResourceRequest &resourceRequest, bool& needIncreLink)
      94              : {
      95              :     (void) ranksLinked;
      96              :     (void) needIncreLink;
      97            0 :     return HCCL_SUCCESS;
      98              : }
      99              : 
     100            0 : HcclResult CollExecutorBase::CreatePairWiseList(HcclSendRecvItem *sendRecvInfo, u32 itemNum)
     101              : {
     102            0 :     return HCCL_SUCCESS;
     103              : }
     104              : 
     105            0 : HcclResult CollExecutorBase::GetPairWiseList(std::vector<std::vector<HcclSendRecvItem*>> &sendRecvPairList)
     106              : {
     107            0 :     return HCCL_SUCCESS;
     108              : }
     109              : 
     110           24 : HcclResult CollExecutorBase::SetAlgOpContext(AlgOpContext algOpContext)
     111              : {
     112           24 :     algOpContext_ = algOpContext;
     113           24 :     return HCCL_SUCCESS;
     114              : }
     115              : 
     116           24 : HcclResult CollExecutorBase::SetAivClearEnable(bool aivClearEnable)
     117              : {
     118           24 :     aivClearEnable_ = aivClearEnable;
     119           24 :     return HCCL_SUCCESS;
     120              : }
     121              : 
     122            1 : HcclResult CollExecutorBase::CalNumBlocks(u32& numBlocks, u32 rankSize, u64 dataSize, HcclCMDType cmdType)
     123              : {
     124            1 :     numBlocks = rankSize;
     125            1 :     return HCCL_SUCCESS;
     126              : }
     127              : 
     128           21 : HcclResult CollExecutorBase::GetNumBlocks(u32& numBlocks) const
     129              : {
     130           21 :     numBlocks = numBlocks_;
     131           21 :     return HCCL_SUCCESS;
     132              : }
     133              : 
     134            6 : HcclResult CollExecutorBase::SetNumBlocks(const u32& numBlocks)
     135              : {
     136            6 :     numBlocks_ = numBlocks;
     137            6 :     return HCCL_SUCCESS;
     138              : }
     139              : 
     140            2 : HcclResult CollExecutorBase::GetCache(HcclCacheInfo& cacheInfo){
     141            2 :     cacheInfo = cacheInfo_;
     142            2 :     return HCCL_SUCCESS;
     143              : }
     144              : 
     145           24 : HcclResult CollExecutorBase::SetOpCounter(const OpCounterInfo& opCounter)
     146              : {
     147           24 :     opCounter_ = opCounter;
     148           24 :     return HCCL_SUCCESS;
     149              : }
     150            0 : HcclResult CollExecutorBase::GetAdjInfo(AlgResourceResponse& algRes, AdjInfo& adjInfo)
     151              : {
     152              :     (void) adjInfo;
     153            0 :     return HCCL_SUCCESS;
     154              : }
     155              : 
     156            0 : HcclResult CollExecutorBase::MarkNeedAlltoallvCache()
     157              : {
     158            0 :     HCCL_ERROR("[CollExecutorBase][MarkNeedAlltoallvCache] not supported for current executor!");
     159            0 :     return HCCL_E_NOT_SUPPORT;
     160              : }
     161              : 
     162            0 : HcclResult CollExecutorBase::GetHcclOffsetDstRanksMap(std::unordered_map<uint64_t, std::vector<uint32_t>>& hcclOffsetDstRanksMap) const
     163              : {
     164              :     UNUSED_PARAM(hcclOffsetDstRanksMap);
     165            0 :     HCCL_ERROR("[CollExecutorBase][GetHcclOffsetDstRanksMap] not supported for current executor!");
     166            0 :     return HCCL_E_NOT_SUPPORT;
     167              : }
     168              : 
     169            0 : void CollExecutorBase::SetWorkflowMode(HcclWorkflowMode workflowMode)
     170              : {
     171              :     UNUSED_PARAM(workflowMode);
     172            0 :     HCCL_DEBUG("[CollExecutorBase][SetWorkflowMode] base class default, no effect");
     173            0 : }
     174              : 
     175            0 : HcclWorkflowMode CollExecutorBase::GetExecutorWorkflowMode() const
     176              : {
     177            0 :     HCCL_ERROR("[CollExecutorBase][GetExecutorWorkflowMode] base class should not be called");
     178            0 :     return HcclWorkflowMode::HCCL_WORKFLOW_MODE_OP_BASE;
     179              : }
     180              : 
     181              : }
        

Generated by: LCOV version 2.0-1