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

Generated by: LCOV version 2.0-1