LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/base/alg_template/temp_reduce_scatter - reduce_scatter_ahc.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 34 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 "reduce_scatter_ahc.h"
      12              : #include "alg_template_register.h"
      13              : 
      14              : namespace hccl {
      15              : 
      16            0 : ReduceScatterAHC::ReduceScatterAHC(const HcclDispatcher dispatcher) : ReduceScatterAHCBase(dispatcher) {}
      17              : 
      18            0 : ReduceScatterAHC::~ReduceScatterAHC() {}
      19              : 
      20            0 : HcclResult ReduceScatterAHC::DisposeSubGroups(const u32 rank)
      21              : {
      22            0 :     CommAHCBaseInfo::DisposeSubGroups(rank, globalSubGroups_, level0SubGroups_, level1SubGroups_);
      23            0 :     return HCCL_SUCCESS;
      24              : }
      25              : 
      26            0 : HcclResult ReduceScatterAHC::CommAHCInfoInit()
      27              : {
      28            0 :     commAHCBaseInfo_.reset(new (std::nothrow) CommAHCAlignInfo(level0SubGroups_));
      29            0 :     CHK_SMART_PTR_NULL(commAHCBaseInfo_);
      30            0 :     CHK_RET(commAHCBaseInfo_->Init(AHCOpType::AHC_OP_TYPE_REDUCE_SCATTER, ahcAlgOption_));
      31            0 :     return HCCL_SUCCESS;
      32              : }
      33              : 
      34            0 : HcclResult ReduceScatterAHC::RunInterReduceScatter(
      35              :     u32 rank, const std::vector<LINK>& links, const std::unique_ptr<CommAHCBaseInfo>& commAHCBaseInfo)
      36              : {
      37              :     // 获取当前rank的组间rank
      38            0 :     HCCL_INFO("[ReduceScatterAHC][RunInterReduceScatter] begin inter ReduceScatter rank[%u]", rank);
      39              : 
      40            0 :     u32 interRank = commAHCBaseInfo->GetInterRank(0, rank);
      41              : 
      42              :     // 创建执行算子实列
      43            0 :     std::unique_ptr<AlgTemplateBase> tempAlg;
      44            0 :     commAHCBaseInfo->GetInterAlgTemplateOpInstance(
      45            0 :         AHCOpType::AHC_OP_TYPE_REDUCE_SCATTER, tempAlg, dispatcher_, reduceAttr_, extendFlag_, ahcExtendPreparePara_);
      46              : 
      47            0 :     std::vector<std::vector<Slice>> interSlicesVector;
      48            0 :     std::vector<std::vector<LINK>> interLinksVector;
      49            0 :     std::vector<u32> logicCardList;
      50            0 :     CHK_RET(commAHCBaseInfo->CalcInterSlicesAndLinks(
      51              :         rank, DataUnitSize(dataType_), count_, links, interLinksVector, interSlicesVector, logicCardList));
      52              : 
      53            0 :     HCCL_DEBUG("[ReduceScatterAHC][RunInterReduceScatter] run inst rank[%u] interRank[%u]", rank, interRank);
      54              : 
      55            0 :     for (u32 i = 0; i < logicCardList.size(); i++) {
      56            0 :         std::vector<Slice> interSlices = interSlicesVector[i];
      57            0 :         std::vector<LINK> interLinks = interLinksVector[i];
      58            0 :         if (interLinks.size() <= 1) {
      59            0 :             continue;
      60              :         }
      61            0 :         HCCL_INFO("[ReduceScatterAHC][RunInterReduceScatter] rank[%u] logicCardList[%u]", rank, logicCardList[i]);
      62            0 :         for (u32 j = 0; j < interSlices.size(); ++j) {
      63            0 :             HCCL_INFO(
      64              :                 "[ReduceScatterAHC][RunInterReduceScatter] interSlices[%u].size[%u] interSlices[%u].offset[%u]", j,
      65              :                 interSlices[j].size, j, interSlices[j].offset);
      66              :         }
      67            0 :         CHK_RET(RunInstance(interRank, interLinks, interSlices, tempAlg, AHCOpType::AHC_OP_TYPE_REDUCE_SCATTER));
      68            0 :     }
      69              : 
      70            0 :     HCCL_DEBUG("[ReduceScatterAHC][RunInterReduceScatter] end inter ReduceScatter rank[%u]", rank);
      71              : 
      72            0 :     return HCCL_SUCCESS;
      73            0 : }
      74              : REGISTER_TEMPLATE(TemplateType::TEMPLATE_REDUCESCATTER_AHC, ReduceScatterAHC);
      75              : } // namespace hccl
        

Generated by: LCOV version 2.0-1