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 % 34 0
Test Date: 2026-08-04 10:52:23 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 : }
      18              : 
      19            0 : AllReduceAHCBroke::~AllReduceAHCBroke()
      20              : {
      21            0 : }
      22              : 
      23            0 : HcclResult AllReduceAHCBroke::DisposeSubGroups(const u32 rank)
      24              : {
      25            0 :     CommAHCBaseInfo::DisposeSubGroups(rank, globalSubGroups_, level0SubGroups_, level1SubGroups_);
      26            0 :     return HCCL_SUCCESS;
      27              : }
      28              :  
      29            0 : HcclResult AllReduceAHCBroke::CommAHCInfoInit()
      30              : {
      31            0 :     commAHCBaseInfo_.reset(new (std::nothrow) CommBrokeAlignInfo(level0SubGroups_));
      32            0 :     CHK_SMART_PTR_NULL(commAHCBaseInfo_);
      33            0 :     CHK_RET(commAHCBaseInfo_->Init(AHCOpType::AHC_OP_TYPE_ALLREDUCE, ahcAlgOption_));
      34            0 :     return HCCL_SUCCESS;
      35              : }
      36              : 
      37            0 : HcclResult AllReduceAHCBroke::RunInterAllReduce(const u32 rank, const std::vector<LINK> &links, 
      38              :     const std::unique_ptr<CommAHCBaseInfo> &commAHCBaseInfo)
      39              : {
      40            0 :     if (!commAHCBaseInfo->IsNeedInterProc(rank) ) {
      41            0 :         HCCL_DEBUG("[AllReduceAHCBroke][RunInterAllReduceBrokeType] rank[%u] bypass inter proc", rank);
      42            0 :         return HCCL_SUCCESS;
      43              :     }
      44              : 
      45            0 :     HCCL_INFO("[AllReduceAHCBroke][RunInterAllReduceBrokeType] begin inter AllReduce rank[%u]", rank);
      46              : 
      47              :     // 获取当前rank的组间rank
      48            0 :     u32 interRank = commAHCBaseInfo->GetInterRank(0, rank);
      49              : 
      50              :     // 创建执行算子实列
      51            0 :     std::unique_ptr<AlgTemplateBase> tempAlg;
      52            0 :     CHK_RET(commAHCBaseInfo->GetInterAlgTemplateOpInstance(AHCOpType::AHC_OP_TYPE_ALLREDUCE, tempAlg, dispatcher_, reduceAttr_,
      53              :         extendFlag_, ahcExtendPreparePara_));
      54              : 
      55            0 :     HCCL_DEBUG("[AllReduceAHCBroke][perform] rank[%u] begin calc inter slices", rank);
      56              : 
      57            0 :     std::vector<std::vector<Slice>> interSlicesVector;
      58            0 :     std::vector<std::vector<LINK>>  interLinksVector;
      59            0 :     std::vector<u32>                logicCardList;
      60            0 :     CHK_RET(commAHCBaseInfo->CalcInterSlicesAndLinks(rank, DataUnitSize(dataType_), count_, links, 
      61              :         interLinksVector, interSlicesVector, logicCardList));
      62              : 
      63            0 :     HCCL_DEBUG("[AllReduceAHCBroke][perform] rank[%u] end calc inter slices", rank);
      64              : 
      65            0 :     if(interLinksVector.size() != interSlicesVector.size()) {
      66            0 :         HCCL_ERROR("[AllReduceAHCBroke][RunInterAllReduceBrokeType]rank[%u] linksVector size[%llu] is no equal to slicesVector size [%u]", 
      67              :             rank, interLinksVector.size(), interSlicesVector.size());
      68            0 :         return HCCL_E_INTERNAL;
      69              :     }
      70              : 
      71            0 :     HCCL_DEBUG("[AllReduceAHCBroke][RunInterAllReduceBrokeType] run inst rank[%u] interRank=%u, interLinksSize=%u",
      72              :         rank, interRank, interLinksVector[0].size());
      73              : 
      74            0 :     CHK_RET(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              : }
        

Generated by: LCOV version 2.0-1