LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/base/alg_template/temp_all_reduce - all_reduce_ahc_broke.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 32 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 6 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 "alg_template_register.h"
      12              : #include "all_reduce_ahc_broke.h"
      13              : 
      14              : namespace hccl {
      15            0 : AllReduceAHCBroke::AllReduceAHCBroke(const HcclDispatcher dispatcher) : AllReduceAHCBase(dispatcher) {}
      16              : 
      17            0 : AllReduceAHCBroke::~AllReduceAHCBroke() {}
      18              : 
      19            0 : HcclResult AllReduceAHCBroke::DisposeSubGroups(const u32 rank)
      20              : {
      21            0 :     CommAHCBaseInfo::DisposeSubGroups(rank, globalSubGroups_, level0SubGroups_, level1SubGroups_);
      22            0 :     return HCCL_SUCCESS;
      23              : }
      24              : 
      25            0 : HcclResult AllReduceAHCBroke::CommAHCInfoInit()
      26              : {
      27            0 :     commAHCBaseInfo_.reset(new (std::nothrow) CommBrokeAlignInfo(level0SubGroups_));
      28            0 :     CHK_SMART_PTR_NULL(commAHCBaseInfo_);
      29            0 :     CHK_RET(commAHCBaseInfo_->Init(AHCOpType::AHC_OP_TYPE_ALLREDUCE, ahcAlgOption_));
      30            0 :     return HCCL_SUCCESS;
      31              : }
      32              : 
      33            0 : HcclResult AllReduceAHCBroke::RunInterAllReduce(
      34              :     const u32 rank, const std::vector<LINK>& links, const std::unique_ptr<CommAHCBaseInfo>& commAHCBaseInfo)
      35              : {
      36            0 :     if (!commAHCBaseInfo->IsNeedInterProc(rank)) {
      37            0 :         HCCL_DEBUG("[AllReduceAHCBroke][RunInterAllReduceBrokeType] rank[%u] bypass inter proc", rank);
      38            0 :         return HCCL_SUCCESS;
      39              :     }
      40              : 
      41            0 :     HCCL_INFO("[AllReduceAHCBroke][RunInterAllReduceBrokeType] begin inter AllReduce rank[%u]", rank);
      42              : 
      43              :     // 获取当前rank的组间rank
      44            0 :     u32 interRank = commAHCBaseInfo->GetInterRank(0, rank);
      45              : 
      46              :     // 创建执行算子实列
      47            0 :     std::unique_ptr<AlgTemplateBase> tempAlg;
      48            0 :     CHK_RET(commAHCBaseInfo->GetInterAlgTemplateOpInstance(
      49              :         AHCOpType::AHC_OP_TYPE_ALLREDUCE, tempAlg, dispatcher_, reduceAttr_, extendFlag_, ahcExtendPreparePara_));
      50              : 
      51            0 :     HCCL_DEBUG("[AllReduceAHCBroke][perform] rank[%u] begin calc inter slices", rank);
      52              : 
      53            0 :     std::vector<std::vector<Slice>> interSlicesVector;
      54            0 :     std::vector<std::vector<LINK>> interLinksVector;
      55            0 :     std::vector<u32> logicCardList;
      56            0 :     CHK_RET(commAHCBaseInfo->CalcInterSlicesAndLinks(
      57              :         rank, DataUnitSize(dataType_), count_, links, interLinksVector, interSlicesVector, logicCardList));
      58              : 
      59            0 :     HCCL_DEBUG("[AllReduceAHCBroke][perform] rank[%u] end calc inter slices", rank);
      60              : 
      61            0 :     if (interLinksVector.size() != interSlicesVector.size()) {
      62            0 :         HCCL_ERROR(
      63              :             "[AllReduceAHCBroke][RunInterAllReduceBrokeType]rank[%u] linksVector size[%llu] is no equal to "
      64              :             "slicesVector size [%u]",
      65              :             rank, interLinksVector.size(), interSlicesVector.size());
      66            0 :         return HCCL_E_INTERNAL;
      67              :     }
      68              : 
      69            0 :     HCCL_DEBUG(
      70              :         "[AllReduceAHCBroke][RunInterAllReduceBrokeType] run inst rank[%u] interRank=%u, interLinksSize=%u", rank,
      71              :         interRank, interLinksVector[0].size());
      72              : 
      73            0 :     CHK_RET(
      74              :         RunInstance(interRank, interLinksVector[0], interSlicesVector[0], tempAlg, AHCOpType::AHC_OP_TYPE_ALLREDUCE));
      75              : 
      76            0 :     HCCL_DEBUG("[AllReduceAHCBroke][RunInterAllReduceBrokeType] end inter AllReduce rank[%u]", rank);
      77              : 
      78            0 :     return HCCL_SUCCESS;
      79            0 : }
      80              : REGISTER_TEMPLATE(TemplateType::TEMPLATE_ALL_REDUCE_AHC_BROKE, AllReduceAHCBroke);
      81              : } // namespace hccl
        

Generated by: LCOV version 2.0-1